From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: add-log.el Date: Fri, 28 Oct 2005 04:16:06 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1130500569 19701 80.91.229.2 (28 Oct 2005 11:56:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2005 11:56:09 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 28 13:56:07 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EVSno-0002iJ-U8 for ged-emacs-devel@m.gmane.org; Fri, 28 Oct 2005 13:53:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVSno-0000m6-5c for ged-emacs-devel@m.gmane.org; Fri, 28 Oct 2005 07:53:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EVSDR-0005fR-Q8 for emacs-devel@gnu.org; Fri, 28 Oct 2005 07:16:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EVSDQ-0005ei-AG for emacs-devel@gnu.org; Fri, 28 Oct 2005 07:16:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVSDQ-0005eX-0R for emacs-devel@gnu.org; Fri, 28 Oct 2005 07:16:08 -0400 Original-Received: from [128.32.35.215] (helo=roar.quarl.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EVSDP-0004JH-Qr for emacs-devel@gnu.org; Fri, 28 Oct 2005 07:16:08 -0400 Original-Received: by roar.quarl.org (Postfix, from userid 18378) id 404525C132; Fri, 28 Oct 2005 04:16:06 -0700 (PDT) Original-To: Emacs Developement List X-Quack-Archive: 1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45022 Archived-At: I'd like to use change-log-mode in ChangeLog files outside of the Emacs project. What do you think of these changes? (And should the variables indent-tabs-mode, tab-always-indent really be set by add-log.el?) 2005-10-28 Karl Chen * add-log.el (add-log-indent-text): Document as a defcustom. (change-log-bullet): New face for bullets. (change-log-font-lock-keywords): Fontify bullets; recognize bullets other than *. Don't fontify entries not in the "filename (function):" format. (change-log--file-match): New temporary variable used by above. --- add-log.el (revision 8993) +++ add-log.el (working copy) @@ -166,6 +166,12 @@ :type '(repeat regexp) :group 'change-log) =20 +(defcustom add-log-indent-text 0 + "*How many spaces to indent subsequent lines in a change entry." + :version "21.1" + :type 'integer + :group 'change-log) + (defface change-log-date '((t (:inherit font-lock-string-face))) "Face used to highlight dates in date lines." @@ -190,6 +196,12 @@ ;; backward-compatibility alias (put 'change-log-email-face 'face-alias 'change-log-email) =20 +(defface change-log-bullet + '((t (:inherit font-lock-preprocessor-face))) + "Face for highlighting bullets." + :version "21.4" + :group 'change-log) + (defface change-log-file '((t (:inherit font-lock-function-name-face))) "Face for highlighting file names." @@ -230,6 +242,9 @@ ;; backward-compatibility alias (put 'change-log-acknowledgement-face 'face-alias 'change-log-acknowledgem= ent) =20 +(defvar change-log--file-match nil + "Temporary variable internal to change-log font-lock code.") + (defvar change-log-font-lock-keywords '(;; ;; Date lines, new (2000-01-01) and old (Sat Jan 1 00:00:00 2000) sty= les. @@ -244,16 +259,45 @@ (1 'change-log-name) (2 'change-log-email))) ;; - ;; File names. - ("^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)" - (2 'change-log-file) + ;; Change entries + ("^\\( +\\|\t\\)\\([*-=E2=80=A2]\\) " + (2 'change-log-bullet) + + ;; File name + ("\\=3D\\([^ ,:([\n]+\\)" nil + ;; this actually saves the beginning of the expression since it's + ;; evaluated on the previous match data + (setq change-log--file-match (match-end 0)) + (1 'change-log-file)) + ;; Possibly further names in a list: - ("\\=3D, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) + ("\\=3D, *\\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) ;; Possibly a parenthesized list of names: ("\\=3D (\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" nil nil (1 'change-log-list)) ("\\=3D, *\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" - nil nil (1 'change-log-list))) + nil nil (1 'change-log-list)) + + ("\\=3D)" nil nil) + + ((lambda (x) + (prog1 + (if change-log--file-match + (prog1 + (if (looking-at ":") + nil + ;; We didn't find a colon, so this is not in the for= mat + ;; "* filename (function): ". Undo the fontificatio= n of + ;; the first word. + (set-match-data (list change-log--file-match (point)= )) + t) + (setq change-log--file-match nil))) + (forward-char 1))) + nil nil + (0 'normal t)) + + ) + ;; ;; Function or variable names. ("^\\( +\\|\t\\)(\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" @@ -646,8 +690,6 @@ (add-change-log-entry whoami file-name t)) ;;;###autoload (define-key ctl-x-4-map "a" 'add-change-log-entry-other-win= dow) =20 -(defvar add-log-indent-text 0) - (defun add-log-indent () (let* ((indent (save-excursion @@ -659,7 +701,7 @@ ;; but I'll get it has at least two adjacent digits. (string-match "[[:digit:]][[:digit:]]" (match-string 1))) 0) - ((looking-at "[^*(]") + ((looking-at "[^*-=E2=80=A2(]") (+ (current-left-margin) add-log-indent-text)) (t (current-left-margin))))) (pos (save-excursion (indent-line-to indent) (point)))) --=20 Karl 2005-10-28 04:06