]> code.delx.au - gnu-emacs/blobdiff - lisp/add-log.el
(info-insert-file-contents): Always check for conflict with jka-compr.
[gnu-emacs] / lisp / add-log.el
index db16929544197a8445a3c3a895c1e36ccfecd094..b7557b0150ad0e3a81c98073a0f67e1b275fab6e 100644 (file)
 \\[add-change-log-entry] calls this function (if nil, `add-log-current-defun'
 instead) with no arguments.  It returns a string or nil if it cannot guess.")
 
 \\[add-change-log-entry] calls this function (if nil, `add-log-current-defun'
 instead) with no arguments.  It returns a string or nil if it cannot guess.")
 
-;; This MUST not be autoloaded, since user-login-name
-;; cannot be known at Emacs dump time.
-(defvar add-log-full-name (user-full-name)
+(defvar add-log-full-name nil
   "*Full name of user, for inclusion in ChangeLog daily headers.
 This defaults to the value returned by the `user-full-name' function.")
 
   "*Full name of user, for inclusion in ChangeLog daily headers.
 This defaults to the value returned by the `user-full-name' function.")
 
-;; This MUST not be autoloaded, since user-login-name
-;; cannot be known at Emacs dump time.
-(defvar add-log-mailing-address user-mail-address
+(defvar add-log-mailing-address nil
   "*Electronic mail address of user, for inclusion in ChangeLog daily headers.
 This defaults to the value of `user-mail-address'.")
 
   "*Electronic mail address of user, for inclusion in ChangeLog daily headers.
 This defaults to the value of `user-mail-address'.")
 
+(defvar change-log-font-lock-keywords
+  '(("^[SMTWF].+$" . font-lock-function-name-face)     ; Date line.
+    ("^\t\\* \\([^ :\n]+\\)" 1 font-lock-comment-face) ; File name.
+    ("\(\\([^)\n]+\\)\)" 1 font-lock-keyword-face))    ; Function name.
+  "Additional expressions to highlight in Change Log mode.")
+
+(defvar change-log-mode-map nil
+  "Keymap for Change Log major mode.")
+(if change-log-mode-map
+    nil
+  (setq change-log-mode-map (make-sparse-keymap))
+  (define-key change-log-mode-map "\M-q" 'change-log-fill-paragraph))
+
 (defun change-log-name ()
   (or change-log-default-name
       (if (eq system-type 'vax-vms) 
 (defun change-log-name ()
   (or change-log-default-name
       (if (eq system-type 'vax-vms) 
@@ -133,6 +142,10 @@ never append to an existing entry."
         ;; s/he can edit the full name field in prompter if s/he wants.
        (setq add-log-mailing-address
              (read-input "Mailing address: " add-log-mailing-address))))
         ;; s/he can edit the full name field in prompter if s/he wants.
        (setq add-log-mailing-address
              (read-input "Mailing address: " add-log-mailing-address))))
+  (or add-log-full-name
+      (setq add-log-full-name (user-full-name)))
+  (or add-log-mailing-address
+      (setq add-log-mailing-address user-mail-address))
   (let ((defun (funcall (or add-log-current-defun-function
                            'add-log-current-defun)))
        paragraph-end entry)
   (let ((defun (funcall (or add-log-current-defun-function
                            'add-log-current-defun)))
        paragraph-end entry)
@@ -259,15 +272,10 @@ Runs `change-log-mode-hook'."
   (set (make-local-variable 'page-delimiter) "^\\<\\|^\f")
   (set (make-local-variable 'version-control) 'never)
   (set (make-local-variable 'adaptive-fill-regexp) "\\s *")
   (set (make-local-variable 'page-delimiter) "^\\<\\|^\f")
   (set (make-local-variable 'version-control) 'never)
   (set (make-local-variable 'adaptive-fill-regexp) "\\s *")
+  (set (make-local-variable 'font-lock-defaults)
+       '(change-log-font-lock-keywords t))
   (run-hooks 'change-log-mode-hook))
 
   (run-hooks 'change-log-mode-hook))
 
-(defvar change-log-mode-map nil
-  "Keymap for Change Log major mode.")
-(if change-log-mode-map
-    nil
-  (setq change-log-mode-map (make-sparse-keymap))
-  (define-key change-log-mode-map "\M-q" 'change-log-fill-paragraph))
-
 ;; It might be nice to have a general feature to replace this.  The idea I
 ;; have is a variable giving a regexp matching text which should not be
 ;; moved from bol by filling.  change-log-mode would set this to "^\\s *\\s(".
 ;; It might be nice to have a general feature to replace this.  The idea I
 ;; have is a variable giving a regexp matching text which should not be
 ;; moved from bol by filling.  change-log-mode would set this to "^\\s *\\s(".
@@ -289,7 +297,7 @@ Prefix arg means justify as well."
   "Return name of function definition point is in, or nil.
 
 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...),
   "Return name of function definition point is in, or nil.
 
 Understands C, Lisp, LaTeX (\"functions\" are chapters, sections, ...),
-Texinfo (@node titles), and Fortran.
+Texinfo (@node titles), Perl, and Fortran.
 
 Other modes are handled by a heuristic that looks in the 10K before
 point for uppercase headings starting in the first column or
 
 Other modes are handled by a heuristic that looks in the 10K before
 point for uppercase headings starting in the first column or
@@ -420,7 +428,11 @@ Has a preference of looking backwards."
                                           (end-of-line)
                                           (point))))))
                ((eq major-mode 'texinfo-mode)
                                           (end-of-line)
                                           (point))))))
                ((eq major-mode 'texinfo-mode)
-                (if (re-search-backward "^@node[ \t]+\\([^,]+\\)," nil t)
+                (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
+                    (buffer-substring (match-beginning 1)
+                                      (match-end 1))))
+               ((eq major-mode 'perl-mode)
+                (if (re-search-backward "^sub[ \t]+\\([^ \t\n]+\\)" nil t)
                     (buffer-substring (match-beginning 1)
                                       (match-end 1))))
                 ((eq major-mode 'fortran-mode)
                     (buffer-substring (match-beginning 1)
                                       (match-end 1))))
                 ((eq major-mode 'fortran-mode)