emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107318: 2012-02-17 Tassilo Horn <add


From: Tassilo Horn
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107318: 2012-02-17 Tassilo Horn <address@hidden>
Date: Fri, 17 Feb 2012 21:19:30 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107318
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Fri 2012-02-17 21:19:30 +0100
message:
  2012-02-17  Tassilo Horn  <address@hidden>
  
        * saveplace.el (save-place-ignore-files-regexp): New variable
        allowing for excluding files from saving their location.  The
        default value matches the temporary commit message editing files
        from Git, SVN, Bazaar, and Mercurial.
        (save-place-to-alist): Use it.
modified:
  lisp/ChangeLog
  lisp/saveplace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-02-17 15:44:32 +0000
+++ b/lisp/ChangeLog    2012-02-17 20:19:30 +0000
@@ -1,3 +1,11 @@
+2012-02-17  Tassilo Horn  <address@hidden>
+
+       * saveplace.el (save-place-ignore-files-regexp): New variable
+       allowing for excluding files from saving their location of point.
+       The default value matches the temporary commit message editing
+       files from Git, SVN, Bazaar, and Mercurial.
+       (save-place-to-alist): Use it.
+
 2012-02-17  Lawrence Mitchell <address@hidden>
             Stefan Monnier  <address@hidden>
 

=== modified file 'lisp/saveplace.el'
--- a/lisp/saveplace.el 2012-01-19 07:21:25 +0000
+++ b/lisp/saveplace.el 2012-02-17 20:19:30 +0000
@@ -130,6 +130,13 @@
 removable and network volumes."
   :type 'regexp :group 'save-place)
 
+(defcustom save-place-ignore-files-regexp
+  
"\\(?:COMMIT_EDITMSG\\|hg-editor-[[:alnum:]]+\\.txt\\|svn-commit\\.tmp\\|bzr_log\\.[[:alnum:]]+\\)$"
+  "Regexp matching files for which no location should be recorded.
+Useful for temporary file such as commit message files that are
+automatically created by the VCS."
+  :type 'regexp :group 'save-place)
+
 (defun toggle-save-place (&optional parg)
   "Toggle whether to save your place in this file between sessions.
 If this mode is enabled, point is recorded when you kill the buffer
@@ -160,20 +167,21 @@
   ;; file.  If not, do so, then feel free to modify the alist.  It
   ;; will be saved again when Emacs is killed.
   (or save-place-loaded (load-save-place-alist-from-file))
-  (if buffer-file-name
-      (progn
-        (let ((cell (assoc buffer-file-name save-place-alist))
-             (position (if (not (eq major-mode 'hexl-mode))
-                           (point)
-                         (with-no-warnings
-                           (1+ (hexl-current-address))))))
-          (if cell
-              (setq save-place-alist (delq cell save-place-alist)))
-         (if (and save-place
-                  (not (= position 1)))  ;; Optimize out the degenerate case.
-             (setq save-place-alist
-                   (cons (cons buffer-file-name position)
-                         save-place-alist)))))))
+  (when (and buffer-file-name
+            (not (string-match save-place-ignore-files-regexp
+                               buffer-file-name)))
+    (let ((cell (assoc buffer-file-name save-place-alist))
+         (position (if (not (eq major-mode 'hexl-mode))
+                       (point)
+                     (with-no-warnings
+                       (1+ (hexl-current-address))))))
+      (if cell
+         (setq save-place-alist (delq cell save-place-alist)))
+      (if (and save-place
+              (not (= position 1)))  ;; Optimize out the degenerate case.
+         (setq save-place-alist
+               (cons (cons buffer-file-name position)
+                     save-place-alist))))))
 
 (defun save-place-forget-unreadable-files ()
   "Remove unreadable files from `save-place-alist'.


reply via email to

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