emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch: add-log.el: changelog find file under poin


From: Richard Stallman
Subject: Re: patch: add-log.el: changelog find file under poin
Date: Sun, 20 Jan 2008 01:14:55 -0500

Would someone please install this, and update NEWS?
(Please add a doc string for the new variable.)

From: Jan Nieuwenhuizen <address@hidden>
To: address@hidden
Content-Type: text/plain
Organization: lilypond-design.org
Date: Sun, 04 Nov 2007 22:18:12 +0100
Mime-Version: 1.0
Subject: patch: add-log.el: changelog find file under poin

Hi,

I found this function missing after applying a patch that had minor
conflicts in almost every file.

Greetings,
Jan.

ChangeLog
2007-11-04  Jan Nieuwenhuizen  <address@hidden>

        * add-log.el (change-log-search-file-name, change-log-find-file):
        New function.
        (change-log-mode-map): New binding C-c C-f to change-log-find-file.

--- lisp/add-log.el~    2007-11-04 22:12:20.000000000 +0100
+++ lisp/add-log.el     2007-11-04 22:12:31.000000000 +0100
@@ -240,8 +240,10 @@
 ;; backward-compatibility alias
 (put 'change-log-acknowledgement-face 'face-alias 'change-log-acknowledgement)
 
+(defvar change-log-file-names-re "^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)")
+
 (defvar change-log-font-lock-keywords
-  '(;;
+  `(;;
     ;; Date lines, new (2000-01-01) and old (Sat Jan  1 00:00:00 2000) styles.
     ;; Fixme: this regepx is just an approximate one and may match
     ;; wrongly with a non-date line existing as a random note.  In
@@ -255,7 +257,7 @@
       (2 'change-log-email)))
     ;;
     ;; File names.
-    ("^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)"
+    (,change-log-file-names-re
      (2 'change-log-file)
      ;; Possibly further names in a list:
      ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file))
@@ -287,10 +289,27 @@
      3 'change-log-acknowledgement))
   "Additional expressions to highlight in Change Log mode.")
 
+(defun change-log-search-file-name (where)
+  "Return the file-name for the change under point."
+  (save-excursion
+    (goto-char where)
+    (beginning-of-line 1)
+    (re-search-forward change-log-file-names-re)
+    (match-string 2)))
+
+(defun change-log-find-file ()
+  "Visit the file for the change under point."
+  (interactive)
+  (let ((file (change-log-search-file-name (point))))
+    (if (and file (file-exists-p file))
+       (find-file file)
+      (message "No such file or directory: ~s" file))))
+
 (defvar change-log-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment)
     (define-key map [?\C-c ?\C-n] 'add-log-edit-next-comment)
+    (define-key map [?\C-c ?\C-f] 'change-log-find-file)
     map)
   "Keymap for Change Log major mode.")
 


-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org



_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]