diff options
| author | Stephen Berman | 2013-07-29 00:34:32 +0200 |
|---|---|---|
| committer | Stephen Berman | 2013-07-29 00:34:32 +0200 |
| commit | d5a845b4d03cf35b4dafcd7632df88c74e6785d0 (patch) | |
| tree | ef839d5b54f78030102dfdb6c7dea753e2229911 | |
| parent | e560aba9d13100bf448e14e5fceeddf1df2e4705 (diff) | |
| download | emacs-d5a845b4d03cf35b4dafcd7632df88c74e6785d0.tar.gz emacs-d5a845b4d03cf35b4dafcd7632df88c74e6785d0.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/calendar/todo-mode.el | 30 |
2 files changed, 29 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5fe335ecda6..3708758df4b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-07-28 Stephen Berman <stephen.berman@gmx.net> | ||
| 2 | |||
| 3 | * calendar/todo-mode.el (todo-rename-file): Fix incorrect use of | ||
| 4 | replace-regexp-in-string and inadvertent omissions in previous change. | ||
| 5 | (todo-filter-items): Ensure only file names are comma-separated in | ||
| 6 | renamed filtered items buffer. | ||
| 7 | |||
| 1 | 2013-07-28 Juanma Barranquero <lekktu@gmail.com> | 8 | 2013-07-28 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 9 | ||
| 3 | * desktop.el: Optionally force offscreen frames back onscreen. | 10 | * desktop.el: Optionally force offscreen frames back onscreen. |
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index d578950a802..943aa8b34b5 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el | |||
| @@ -1117,9 +1117,10 @@ these files, also rename them accordingly." | |||
| 1117 | (concat ".*" (regexp-quote soname) | 1117 | (concat ".*" (regexp-quote soname) |
| 1118 | ".*\.tod[aorty]$") t))) | 1118 | ".*\.tod[aorty]$") t))) |
| 1119 | (dolist (f files) | 1119 | (dolist (f files) |
| 1120 | (let ((sfname (todo-short-file-name f)) | 1120 | (let* ((sfname (todo-short-file-name f)) |
| 1121 | (fext (file-name-extension f t)) | 1121 | (fext (file-name-extension f t)) |
| 1122 | (fbuf (find-buffer-visiting f))) | 1122 | (fbuf (find-buffer-visiting f)) |
| 1123 | (fbname (buffer-name fbuf))) | ||
| 1123 | (when (string-match (regexp-quote soname) sfname) | 1124 | (when (string-match (regexp-quote soname) sfname) |
| 1124 | (let* ((snfname (replace-match snname t t sfname)) | 1125 | (let* ((snfname (replace-match snname t t sfname)) |
| 1125 | (nfname (concat todo-directory snfname fext))) | 1126 | (nfname (concat todo-directory snfname fext))) |
| @@ -1135,7 +1136,14 @@ these files, also rename them accordingly." | |||
| 1135 | (t | 1136 | (t |
| 1136 | (rename-buffer | 1137 | (rename-buffer |
| 1137 | (replace-regexp-in-string | 1138 | (replace-regexp-in-string |
| 1138 | (regexp-quote soname) snfname)))))))))))) | 1139 | (regexp-quote soname) snname fbname)))))))))) |
| 1140 | (setq todo-files (funcall todo-files-function) | ||
| 1141 | todo-archives (funcall todo-files-function t)) | ||
| 1142 | (when (string= todo-default-todo-file soname) | ||
| 1143 | (setq todo-default-todo-file snname)) | ||
| 1144 | (when (string= todo-global-current-todo-file oname) | ||
| 1145 | (setq todo-global-current-todo-file nname)) | ||
| 1146 | (todo-reevaluate-filelist-defcustoms))) | ||
| 1139 | 1147 | ||
| 1140 | (defun todo-delete-file () | 1148 | (defun todo-delete-file () |
| 1141 | "Delete the current todo, archive or filtered items file. | 1149 | "Delete the current todo, archive or filtered items file. |
| @@ -4159,7 +4167,8 @@ multifile commands for further details." | |||
| 4159 | (regexp ".todr"))))) | 4167 | (regexp ".todr"))))) |
| 4160 | (rxfiles (when regexp | 4168 | (rxfiles (when regexp |
| 4161 | (directory-files todo-directory t ".*\\.todr$" t))) | 4169 | (directory-files todo-directory t ".*\\.todr$" t))) |
| 4162 | (file-exists (or (file-exists-p fname) rxfiles))) | 4170 | (file-exists (or (file-exists-p fname) rxfiles)) |
| 4171 | bufname) | ||
| 4163 | (cond ((and top new (natnump new)) | 4172 | (cond ((and top new (natnump new)) |
| 4164 | (todo-filter-items-1 (cons 'top new) flist)) | 4173 | (todo-filter-items-1 (cons 'top new) flist)) |
| 4165 | ((and (not new) file-exists) | 4174 | ((and (not new) file-exists) |
| @@ -4173,10 +4182,15 @@ multifile commands for further details." | |||
| 4173 | (todo-check-filtered-items-file)) | 4182 | (todo-check-filtered-items-file)) |
| 4174 | (t | 4183 | (t |
| 4175 | (todo-filter-items-1 filter flist))) | 4184 | (todo-filter-items-1 filter flist))) |
| 4176 | (setq fname (replace-regexp-in-string "-" ", " | 4185 | (dolist (s (split-string (todo-short-file-name fname) "-")) |
| 4177 | (todo-short-file-name fname))) | 4186 | (setq bufname (if bufname |
| 4187 | (concat bufname (if (member s (mapcar | ||
| 4188 | 'todo-short-file-name | ||
| 4189 | todo-files)) | ||
| 4190 | ", " "-") s) | ||
| 4191 | s))) | ||
| 4178 | (rename-buffer (format (concat "%s for file" (if multi "s" "") | 4192 | (rename-buffer (format (concat "%s for file" (if multi "s" "") |
| 4179 | " \"%s\"") buf fname)))) | 4193 | " \"%s\"") buf bufname)))) |
| 4180 | 4194 | ||
| 4181 | (defun todo-filter-items-1 (filter file-list) | 4195 | (defun todo-filter-items-1 (filter file-list) |
| 4182 | "Build a list of items by applying FILTER to FILE-LIST. | 4196 | "Build a list of items by applying FILTER to FILE-LIST. |