emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113578: * calendar/todo-mode.el (todo-rename-file):


From: Stephen Berman
Subject: [Emacs-diffs] trunk r113578: * calendar/todo-mode.el (todo-rename-file): Fix incorrect use of
Date: Sun, 28 Jul 2013 22:34:38 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113578
revision-id: address@hidden
parent: address@hidden
committer: Stephen Berman <address@hidden>
branch nick: trunk
timestamp: Mon 2013-07-29 00:34:32 +0200
message:
  * calendar/todo-mode.el (todo-rename-file): Fix incorrect use of
  replace-regexp-in-string and inadvertent omissions in previous change.
  (todo-filter-items): Ensure only file names are comma-separated in
  renamed filtered items buffer.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/calendar/todo-mode.el     todos.el-20120911155047-0ytqo2nidwqquefa-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-07-28 03:03:45 +0000
+++ b/lisp/ChangeLog    2013-07-28 22:34:32 +0000
@@ -1,3 +1,10 @@
+2013-07-28  Stephen Berman  <address@hidden>
+
+       * calendar/todo-mode.el (todo-rename-file): Fix incorrect use of
+       replace-regexp-in-string and inadvertent omissions in previous change.
+       (todo-filter-items): Ensure only file names are comma-separated in
+       renamed filtered items buffer.
+
 2013-07-28  Juanma Barranquero  <address@hidden>
 
        * desktop.el: Optionally force offscreen frames back onscreen.

=== modified file 'lisp/calendar/todo-mode.el'
--- a/lisp/calendar/todo-mode.el        2013-07-27 15:58:56 +0000
+++ b/lisp/calendar/todo-mode.el        2013-07-28 22:34:32 +0000
@@ -1117,9 +1117,10 @@
                                 (concat ".*" (regexp-quote soname)
                                         ".*\.tod[aorty]$") t)))
     (dolist (f files)
-      (let ((sfname (todo-short-file-name f))
-           (fext (file-name-extension f t))
-           (fbuf (find-buffer-visiting f)))
+      (let* ((sfname (todo-short-file-name f))
+            (fext (file-name-extension f t))
+            (fbuf (find-buffer-visiting f))
+            (fbname (buffer-name fbuf)))
        (when (string-match (regexp-quote soname) sfname)
          (let* ((snfname (replace-match snname t t sfname))
                 (nfname (concat todo-directory snfname fext)))
@@ -1135,7 +1136,14 @@
                      (t
                       (rename-buffer
                        (replace-regexp-in-string
-                        (regexp-quote soname) snfname))))))))))))
+                        (regexp-quote soname) snname fbname))))))))))
+    (setq todo-files (funcall todo-files-function)
+         todo-archives (funcall todo-files-function t))
+    (when (string= todo-default-todo-file soname)
+      (setq todo-default-todo-file snname))
+    (when (string= todo-global-current-todo-file oname)
+      (setq todo-global-current-todo-file nname))
+    (todo-reevaluate-filelist-defcustoms)))
 
 (defun todo-delete-file ()
   "Delete the current todo, archive or filtered items file.
@@ -4159,7 +4167,8 @@
                                (regexp ".todr")))))
         (rxfiles (when regexp
                    (directory-files todo-directory t ".*\\.todr$" t)))
-        (file-exists (or (file-exists-p fname) rxfiles)))
+        (file-exists (or (file-exists-p fname) rxfiles))
+        bufname)
     (cond ((and top new (natnump new))
           (todo-filter-items-1 (cons 'top new) flist))
          ((and (not new) file-exists)
@@ -4173,10 +4182,15 @@
           (todo-check-filtered-items-file))
          (t
           (todo-filter-items-1 filter flist)))
-    (setq fname (replace-regexp-in-string "-" ", "
-                                         (todo-short-file-name fname)))
+    (dolist (s (split-string (todo-short-file-name fname) "-"))
+      (setq bufname (if bufname
+                       (concat bufname (if (member s (mapcar
+                                                      'todo-short-file-name
+                                                      todo-files))
+                                           ", " "-") s)
+                     s)))
     (rename-buffer (format (concat "%s for file" (if multi "s" "")
-                                  " \"%s\"") buf fname))))
+                                  " \"%s\"") buf bufname))))
 
 (defun todo-filter-items-1 (filter file-list)
   "Build a list of items by applying FILTER to FILE-LIST.


reply via email to

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