aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2014-05-25 19:28:09 -0700
committerGlenn Morris2014-05-25 19:28:09 -0700
commit015936fba1bcaa51b7886a73144d4c088200c0aa (patch)
treec9628339352c1a97e574df28966e977143c43e41 /lisp
parent5e26d9849a79bf78fda821979fc937f7e5e6df52 (diff)
parente8f2cc26e712f42f6391fa52cd67c3e791096f1e (diff)
downloademacs-015936fba1bcaa51b7886a73144d4c088200c0aa.tar.gz
emacs-015936fba1bcaa51b7886a73144d4c088200c0aa.zip
Merge from emacs-24; up to 2014-05-26T10:21:18Z!rgm@gnu.org
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog142
-rw-r--r--lisp/avoid.el25
-rw-r--r--lisp/calendar/todo-mode.el494
-rw-r--r--lisp/cus-face.el4
-rw-r--r--lisp/emacs-lisp/eieio-opt.el2
-rw-r--r--lisp/emacs-lisp/lisp.el36
-rw-r--r--lisp/emacs-lisp/nadvice.el16
-rw-r--r--lisp/emacs-lisp/package.el17
-rw-r--r--lisp/emacs-lisp/timer.el80
-rw-r--r--lisp/frame.el12
-rw-r--r--lisp/hippie-exp.el2
-rw-r--r--lisp/menu-bar.el2
-rw-r--r--lisp/minibuffer.el2
-rw-r--r--lisp/mouse.el2
-rw-r--r--lisp/net/dbus.el12
-rw-r--r--lisp/net/tramp-sh.el2
-rw-r--r--lisp/nxml/nxml-mode.el5
-rw-r--r--lisp/progmodes/scheme.el58
-rw-r--r--lisp/simple.el10
-rw-r--r--lisp/vc/vc-rcs.el7
-rw-r--r--lisp/window.el5
21 files changed, 595 insertions, 340 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 78dcac1399e..594feb08980 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,145 @@
12014-05-26 Andreas Schwab <schwab@linux-m68k.org>
2
3 * cus-face.el (custom-face-attributes): Add :distant-foreground.
4
52014-05-26 Martin Rudalics <rudalics@gmx.at>
6
7 * window.el (window--dump-frame): Remove interactive specification.
8
92014-05-26 Glenn Morris <rgm@gnu.org>
10
11 * hippie-exp.el (he-line-search-regexp):
12 Handle comint-prompt-regexp containing subgroups. (Bug#17529)
13
142014-05-26 Stephen Berman <stephen.berman@gmx.net>
15
16 * calendar/todo-mode.el: Remove dependence on auto-mode-alist,
17 to avoid errors when trying to create or visit a file foo.todo
18 located outside to todo-directory, and to allow having such files
19 without them being tied to Todo mode (bug#17482).
20 (todo-show, todo-move-category, todo-merge-category, todo-find-archive)
21 (todo-archive-done-item, todo-find-filtered-items-file)
22 (todo-filter-items, todo-find-item, todo-diary-goto-entry)
23 (todo-category-completions, todo-read-category): When visiting a
24 Todo file, make sure we're in the right mode and the buffer local
25 variables are set.
26 (todo-make-categories-list, todo-reset-nondiary-marker)
27 (todo-reset-done-string, todo-reset-comment-string): After
28 processing all Todo files, kill the buffers of those files that
29 weren't being visited before the processing.
30 (todo-display-as-todo-file, todo-add-to-buffer-list)
31 (todo-visit-files-commands): Comment out.
32 (todo-modes-set-3, todo-mode): Comment out additions to find-file-hook.
33 (auto-mode-alist): Remove add-to-list calls making Todo file
34 extensions unrestrictedly tied to Todo modes.
35
362014-05-26 Stefan Monnier <monnier@iro.umontreal.ca>
37
38 * emacs-lisp/nadvice.el (advice--member-p): Change second arg.
39 (advice-function-member-p): Tell it to check both names and functions
40 (bug#17531).
41 (advice--add-function): Adjust call accordingly.
42
432014-05-26 Stephen Berman <stephen.berman@gmx.net>
44
45 * calendar/todo-mode.el: Miscellaneous bug fixes.
46 (todo-delete-file): When deleting an archive but not its todo
47 file, make sure to update the todo file's category sexp.
48 (todo-move-category): Keep the moved category's name unless the
49 file moved to already has a category with that name. If the
50 numerically last category of the source file was moved, make the
51 first category current to avoid selecting a nonexisting category.
52 (todo-merge-category): Fix implementation to make merging to a
53 category in another file work as documented. Eliminate now
54 insufficient and unnecessary renaming of archive category, correct
55 document string accordingly, and clarify it. If the numerically
56 last category of the source file was merged, make the first
57 category current to avoid selecting a nonexisting category.
58 (todo-archive-done-item): When there are marked items and point
59 happens to be on an unmarked item, ignore the latter. Don't leave
60 point below last item after archiving marked items.
61 (todo-unarchive-items): Fix logic to ensure unarchiving an item
62 from an archive with only one category deletes the archive only
63 when the category is empty after unarchiving. Make sure the todo
64 file's category sexp is updated.
65 (todo-read-file-name): Allow an existing file name even when it is
66 not required (todo-move-category needs this to work as documented).
67 (todo-add-file): Call todo-validate-name to reject the name of an
68 existing todo file (needed due to fix in todo-read-file-name).
69 (todo-reset-nondiary-marker): Also reset in filtered items files.
70 (todo-reset-done-string, todo-reset-comment-string): Also reset in
71 regexp filtered items files.
72 (todo-reset-highlight-item): Also reset in filtered items files.
73 Fix incorrect variable reference in document string.
74
752014-05-26 Glenn Morris <rgm@gnu.org>
76
77 * window.el (window--dump-frame): Avoid error in --without-x builds.
78
792014-05-26 Glenn Morris <rgm@gnu.org>
80
81 * nxml/nxml-mode.el (xml-mode): Only define this alias once.
82
832014-05-26 Eli Zaretskii <eliz@gnu.org>
84
85 * frame.el (set-frame-font): Doc fix.
86
87 * menu-bar.el (menu-set-font): Doc fix. (Bug#17532)
88
892014-05-26 Dmitry Gutov <dgutov@yandex.ru>
90
91 * emacs-lisp/package.el (package--download-one-archive): Use
92 `write-region' instead of `save-buffer' to avoid running various
93 hooks. (Bug#17155)
94 (describe-package-1): Same. Insert newline at the end of the
95 buffer if appropriate.
96
972014-05-26 Juri Linkov <juri@jurta.org>
98
99 * avoid.el (mouse-avoidance-set-mouse-position): Don't raise frame.
100 (mouse-avoidance-ignore-p): Remove `switch-frame', add `focus-out'.
101 Add more modifiers: meta, control, shift, hyper, super, alt.
102 (Bug#17439)
103
104 * avoid.el (mouse-avoidance-banish-position): Fix defcustom :options
105 to allow changing its value with `set-variable'.
106
1072014-05-26 Stefan Monnier <monnier@iro.umontreal.ca>
108
109 * progmodes/scheme.el (scheme-mode-syntax-table): Remove hack for
110 #; comments.
111 (scheme-syntax-propertize, scheme-syntax-propertize-sexp-comment):
112 New functions.
113 (scheme-mode-variables): Set syntax-propertize-function instead of
114 font-lock-syntactic-face-function.
115 (scheme-font-lock-syntactic-face-function): Delete.
116
117 * emacs-lisp/lisp.el (end-of-defun): Ensure we move (bug#17274).
118
119 * emacs-lisp/timer.el (timer-event-handler): Don't run if canceled
120 (bug#17392).
121
1222014-05-26 Michael Albinus <michael.albinus@gmx.de>
123
124 * net/tramp-sh.el (tramp-find-inline-encoding): Do not match "%%t"
125 for a temporary file name.
126
1272014-05-26 Eli Zaretskii <eliz@gnu.org>
128
129 * simple.el (line-move-ignore-invisible): Doc fix. (Bug#17511)
130
1312014-05-26 Michael Albinus <michael.albinus@gmx.de>
132
133 * net/dbus.el (dbus-init-bus, dbus-call-method)
134 (dbus-call-method-asynchronously, dbus-send-signal)
135 (dbus-method-return-internal, dbus-method-error-internal):
136 Check, whether Emacs has been compiled with D-Bus support. (Bug#17508)
137
1382014-05-26 Nicolas Richard <theonewiththeevillook@yahoo.fr>
139
140 * emacs-lisp/eieio-opt.el (eieio-help-class): Correctly deal with
141 methods which do not have a doc string. (Bug#17490)
142
12014-05-25 Tassilo Horn <tsdh@gnu.org> 1432014-05-25 Tassilo Horn <tsdh@gnu.org>
2 144
3 * textmodes/reftex-ref.el (reftex-format-special): Make it work 145 * textmodes/reftex-ref.el (reftex-format-special): Make it work
diff --git a/lisp/avoid.el b/lisp/avoid.el
index f3013728931..680e509ceba 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -52,9 +52,6 @@
52;; 52;;
53;; - Using this code does slow Emacs down. "banish" mode shouldn't 53;; - Using this code does slow Emacs down. "banish" mode shouldn't
54;; be too bad, and on my workstation even "animate" is reasonable. 54;; be too bad, and on my workstation even "animate" is reasonable.
55;;
56;; - It ought to find out where any overlapping frames are and avoid them,
57;; rather than always raising the frame.
58 55
59;; Credits: 56;; Credits:
60;; This code was helped by all those who contributed suggestions, 57;; This code was helped by all those who contributed suggestions,
@@ -129,9 +126,9 @@ TOP-OR-BOTTOM: banish the mouse to top or bottom of frame or window.
129TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window." 126TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window."
130 :group 'avoid 127 :group 'avoid
131 :version "24.3" 128 :version "24.3"
132 :type '(alist :key-type symbol :value-type symbol) 129 :type '(alist :key-type symbol :value-type (choice symbol integer))
133 :options '(frame-or-window side (side-pos integer) 130 :options '((frame-or-window symbol) (side symbol) (side-pos integer)
134 top-or-bottom (top-or-bottom-pos integer))) 131 (top-or-bottom symbol) (top-or-bottom-pos integer)))
135 132
136;; Internal variables 133;; Internal variables
137(defvar mouse-avoidance-state nil) 134(defvar mouse-avoidance-state nil)
@@ -172,12 +169,8 @@ Analogous to `mouse-position'."
172 169
173(defun mouse-avoidance-set-mouse-position (pos) 170(defun mouse-avoidance-set-mouse-position (pos)
174 ;; Carefully set mouse position to given position (X . Y) 171 ;; Carefully set mouse position to given position (X . Y)
175 ;; Ideally, should check if X,Y is in the current frame, and if not,
176 ;; leave the mouse where it was. However, this is currently
177 ;; difficult to do, so we just raise the frame to avoid frame switches.
178 ;; Returns t if it moved the mouse. 172 ;; Returns t if it moved the mouse.
179 (let ((f (selected-frame))) 173 (let ((f (selected-frame)))
180 (raise-frame f)
181 (set-mouse-position f (car pos) (cdr pos)) 174 (set-mouse-position f (car pos) (cdr pos))
182 t)) 175 t))
183 176
@@ -342,12 +335,18 @@ redefine this function to suit your own tastes."
342 (let ((modifiers (event-modifiers (car last-input-event)))) 335 (let ((modifiers (event-modifiers (car last-input-event))))
343 (or (memq (car last-input-event) 336 (or (memq (car last-input-event)
344 '(mouse-movement scroll-bar-movement 337 '(mouse-movement scroll-bar-movement
345 select-window switch-frame)) 338 select-window focus-out))
346 (memq 'click modifiers) 339 (memq 'click modifiers)
347 (memq 'double modifiers) 340 (memq 'double modifiers)
348 (memq 'triple modifiers) 341 (memq 'triple modifiers)
349 (memq 'drag modifiers) 342 (memq 'drag modifiers)
350 (memq 'down modifiers))))))) 343 (memq 'down modifiers)
344 (memq 'meta modifiers)
345 (memq 'control modifiers)
346 (memq 'shift modifiers)
347 (memq 'hyper modifiers)
348 (memq 'super modifiers)
349 (memq 'alt modifiers)))))))
351 350
352(defun mouse-avoidance-banish () 351(defun mouse-avoidance-banish ()
353 (if (not (mouse-avoidance-ignore-p)) 352 (if (not (mouse-avoidance-ignore-p))
@@ -403,8 +402,6 @@ Effects of the different modes:
403 * cat-and-mouse: Same as `animate'. 402 * cat-and-mouse: Same as `animate'.
404 * proteus: As `animate', but changes the shape of the mouse pointer too. 403 * proteus: As `animate', but changes the shape of the mouse pointer too.
405 404
406Whenever the mouse is moved, the frame is also raised.
407
408\(See `mouse-avoidance-threshold' for definition of \"too close\", 405\(See `mouse-avoidance-threshold' for definition of \"too close\",
409and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for 406and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for
410definition of \"random distance\".)" 407definition of \"random distance\".)"
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index f7f2b1d1539..ab2ab3e4cb8 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -566,13 +566,13 @@ less than or equal the category's top priority setting."
566;;; Entering and exiting 566;;; Entering and exiting
567;; ----------------------------------------------------------------------------- 567;; -----------------------------------------------------------------------------
568 568
569(defcustom todo-visit-files-commands (list 'find-file 'dired-find-file) 569;; (defcustom todo-visit-files-commands (list 'find-file 'dired-find-file)
570 "List of file finding commands for `todo-display-as-todo-file'. 570;; "List of file finding commands for `todo-display-as-todo-file'.
571Invoking these commands to visit a todo file or todo archive file 571;; Invoking these commands to visit a todo file or todo archive file
572calls `todo-show' or `todo-find-archive', so that the file is 572;; calls `todo-show' or `todo-find-archive', so that the file is
573displayed correctly." 573;; displayed correctly."
574 :type '(repeat function) 574;; :type '(repeat function)
575 :group 'todo) 575;; :group 'todo)
576 576
577(defun todo-short-file-name (file) 577(defun todo-short-file-name (file)
578 "Return the short form of todo file FILE's name. 578 "Return the short form of todo file FILE's name.
@@ -740,9 +740,12 @@ corresponding todo file, displaying the corresponding category."
740 "Choose a regexp items file: " 740 "Choose a regexp items file: "
741 rxf) 'regexp)))))) 741 rxf) 'regexp))))))
742 (if (file-exists-p fi-file) 742 (if (file-exists-p fi-file)
743 (set-window-buffer 743 (progn
744 (selected-window) 744 (set-window-buffer
745 (set-buffer (find-file-noselect fi-file 'nowarn))) 745 (selected-window)
746 (set-buffer (find-file-noselect fi-file 'nowarn)))
747 (unless (derived-mode-p 'todo-filtered-items-mode)
748 (todo-filtered-items-mode)))
746 (message "There is no %s file for %s" 749 (message "There is no %s file for %s"
747 (cond ((eq todo-show-first 'top) 750 (cond ((eq todo-show-first 'top)
748 "top priorities") 751 "top priorities")
@@ -757,6 +760,9 @@ corresponding todo file, displaying the corresponding category."
757 (unless (todo-check-file file) (throw 'end nil)) 760 (unless (todo-check-file file) (throw 'end nil))
758 (set-window-buffer (selected-window) 761 (set-window-buffer (selected-window)
759 (set-buffer (find-file-noselect file 'nowarn))) 762 (set-buffer (find-file-noselect file 'nowarn)))
763 (if (equal (file-name-extension (buffer-file-name)) "toda")
764 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
765 (unless (derived-mode-p 'todo-mode) (todo-mode)))
760 ;; When quitting an archive file, show the corresponding 766 ;; When quitting an archive file, show the corresponding
761 ;; category in the corresponding todo file, if it exists. 767 ;; category in the corresponding todo file, if it exists.
762 (when (assoc cat todo-categories) 768 (when (assoc cat todo-categories)
@@ -1090,6 +1096,9 @@ Noninteractively, return the name of the new file."
1090 (let* ((prompt (concat "Enter name of new todo file " 1096 (let* ((prompt (concat "Enter name of new todo file "
1091 "(TAB or SPC to see current names): ")) 1097 "(TAB or SPC to see current names): "))
1092 (file (todo-read-file-name prompt))) 1098 (file (todo-read-file-name prompt)))
1099 ;; Don't accept the name of an existing todo file.
1100 (setq file (todo-absolute-file-name
1101 (todo-validate-name (todo-short-file-name file) 'file)))
1093 (with-current-buffer (get-buffer-create file) 1102 (with-current-buffer (get-buffer-create file)
1094 (erase-buffer) 1103 (erase-buffer)
1095 (write-region (point-min) (point-max) file nil 'nomessage nil t) 1104 (write-region (point-min) (point-max) file nil 'nomessage nil t)
@@ -1179,10 +1188,28 @@ visiting the deleted files."
1179 (when (file-exists-p file1) (delete-file file1)) 1188 (when (file-exists-p file1) (delete-file file1))
1180 (setq todo-visited (delete file1 todo-visited)) 1189 (setq todo-visited (delete file1 todo-visited))
1181 (kill-buffer buf1) 1190 (kill-buffer buf1)
1182 (when delete2 1191 (if delete2
1183 (when (file-exists-p file2) (delete-file file2)) 1192 (progn
1184 (setq todo-visited (delete file2 todo-visited)) 1193 (when (file-exists-p file2) (delete-file file2))
1185 (and buf2 (kill-buffer buf2))) 1194 (setq todo-visited (delete file2 todo-visited))
1195 (and buf2 (kill-buffer buf2)))
1196 ;; If we deleted an archive but not its todo file, update the
1197 ;; latter's category sexp.
1198 (when (equal (file-name-extension file2) "todo")
1199 (with-current-buffer (or buf2 (find-file-noselect file2))
1200 (save-excursion
1201 (save-restriction
1202 (widen)
1203 (goto-char (point-min))
1204 (let ((sexp (read (buffer-substring-no-properties
1205 (line-beginning-position)
1206 (line-end-position))))
1207 (buffer-read-only nil))
1208 (mapc (lambda (x) (aset (cdr x) 3 0)) sexp)
1209 (delete-region (line-beginning-position) (line-end-position))
1210 (prin1 sexp (current-buffer)))))
1211 (todo-set-categories)
1212 (unless buf2 (kill-buffer)))))
1186 (setq todo-files (funcall todo-files-function) 1213 (setq todo-files (funcall todo-files-function)
1187 todo-archives (funcall todo-files-function t)) 1214 todo-archives (funcall todo-files-function t))
1188 (when (or (string= file1-sn todo-default-todo-file) 1215 (when (or (string= file1-sn todo-default-todo-file)
@@ -1197,7 +1224,8 @@ visiting the deleted files."
1197 (concat "and its " 1224 (concat "and its "
1198 (cond (todo "archive") (archive "todo")) 1225 (cond (todo "archive") (archive "todo"))
1199 " file ")) 1226 " file "))
1200 "deleted") file1-sn)))) 1227 "deleted")
1228 file1-sn))))
1201 1229
1202(defvar todo-edit-buffer "*Todo Edit*" 1230(defvar todo-edit-buffer "*Todo Edit*"
1203 "Name of current buffer in Todo Edit mode.") 1231 "Name of current buffer in Todo Edit mode.")
@@ -1385,8 +1413,7 @@ the archive of the file moved to, creating it if it does not exist."
1385 "Do you want to proceed? "))) 1413 "Do you want to proceed? ")))
1386 (let* ((ofile todo-current-todo-file) 1414 (let* ((ofile todo-current-todo-file)
1387 (cat (todo-current-category)) 1415 (cat (todo-current-category))
1388 (nfile (todo-read-file-name 1416 (nfile (todo-read-file-name "Todo file to move this category to: "))
1389 "Todo file to move this category to: " nil))
1390 (archive (concat (file-name-sans-extension ofile) ".toda")) 1417 (archive (concat (file-name-sans-extension ofile) ".toda"))
1391 (buffers (append (list ofile) 1418 (buffers (append (list ofile)
1392 (unless (zerop (todo-get-count 'archived cat)) 1419 (unless (zerop (todo-get-count 'archived cat))
@@ -1394,7 +1421,7 @@ the archive of the file moved to, creating it if it does not exist."
1394 new) 1421 new)
1395 (while (equal nfile (file-truename ofile)) 1422 (while (equal nfile (file-truename ofile))
1396 (setq nfile (todo-read-file-name 1423 (setq nfile (todo-read-file-name
1397 "Choose a file distinct from this file: " nil))) 1424 "Choose a file distinct from this file: ")))
1398 (unless (member nfile todo-files) 1425 (unless (member nfile todo-files)
1399 (with-current-buffer (get-buffer-create nfile) 1426 (with-current-buffer (get-buffer-create nfile)
1400 (erase-buffer) 1427 (erase-buffer)
@@ -1428,6 +1455,10 @@ the archive of the file moved to, creating it if it does not exist."
1428 (if (member buf (funcall todo-files-function t)) 1455 (if (member buf (funcall todo-files-function t))
1429 (concat (file-name-sans-extension nfile) ".toda") 1456 (concat (file-name-sans-extension nfile) ".toda")
1430 nfile)) 1457 nfile))
1458 (if (equal (file-name-extension (buffer-file-name)) "toda")
1459 (unless (derived-mode-p 'todo-archive-mode)
1460 (todo-archive-mode))
1461 (unless (derived-mode-p 'todo-mode) (todo-mode)))
1431 (let* ((nfile-short (todo-short-file-name nfile)) 1462 (let* ((nfile-short (todo-short-file-name nfile))
1432 (prompt (concat 1463 (prompt (concat
1433 (format "Todo file \"%s\" already has " 1464 (format "Todo file \"%s\" already has "
@@ -1453,7 +1484,7 @@ the archive of the file moved to, creating it if it does not exist."
1453 "\\(" (regexp-quote cat) "\\)$") nil t) 1484 "\\(" (regexp-quote cat) "\\)$") nil t)
1454 (replace-match new nil nil nil 1))) 1485 (replace-match new nil nil nil 1)))
1455 (setq todo-categories 1486 (setq todo-categories
1456 (append todo-categories (list (cons new counts)))) 1487 (append todo-categories (list (cons (or new cat) counts))))
1457 (todo-update-categories-sexp) 1488 (todo-update-categories-sexp)
1458 ;; If archive was just created, save it to avoid "File 1489 ;; If archive was just created, save it to avoid "File
1459 ;; <xyz> no longer exists!" message on invoking 1490 ;; <xyz> no longer exists!" message on invoking
@@ -1481,6 +1512,8 @@ the archive of the file moved to, creating it if it does not exist."
1481 (setq todo-categories (delete (assoc cat todo-categories) 1512 (setq todo-categories (delete (assoc cat todo-categories)
1482 todo-categories)) 1513 todo-categories))
1483 (todo-update-categories-sexp) 1514 (todo-update-categories-sexp)
1515 (when (> todo-category-number (length todo-categories))
1516 (setq todo-category-number 1))
1484 (todo-category-select))))) 1517 (todo-category-select)))))
1485 (set-window-buffer (selected-window) 1518 (set-window-buffer (selected-window)
1486 (set-buffer (find-file-noselect nfile))) 1519 (set-buffer (find-file-noselect nfile)))
@@ -1495,25 +1528,25 @@ choose (with TAB completion) a category in it to merge into;
1495otherwise, choose and merge into a category in either the 1528otherwise, choose and merge into a category in either the
1496current todo file or a file in `todo-category-completions-files'. 1529current todo file or a file in `todo-category-completions-files'.
1497 1530
1498After merging, the current category's todo and done items are 1531After merging, the source category's todo and done items are
1499appended to the chosen goal category's todo and done items, 1532appended to the chosen goal category's todo and done items,
1500respectively. The goal category becomes the current category, 1533respectively. The goal category becomes the current category,
1501and the previous current category is deleted. 1534and the source category is deleted.
1502 1535
1503If both the first and goal categories also have archived items, 1536If both the source and goal categories also have archived items,
1504the former are merged to the latter. If only the first category 1537they are also merged. If only the source category has archived
1505has archived items, the archived category is renamed to the goal 1538items, the goal category is added as a new category to the
1506category." 1539archive file and the source category is deleted."
1507 (interactive "P") 1540 (interactive "P")
1508 (let* ((tfile todo-current-todo-file) 1541 (let* ((tfile todo-current-todo-file)
1509 (cat (todo-current-category)) 1542 (cat (todo-current-category))
1510 (cat+file (todo-read-category "Merge into category: " 'todo file)) 1543 (cat+file (todo-read-category "Merge into category: " 'todo file))
1511 (goal (car cat+file)) 1544 (goal (car cat+file))
1512 (gfile (cdr cat+file)) 1545 (gfile (cdr cat+file))
1513 (archive (concat (file-name-sans-extension (if file gfile tfile)) 1546 (tarchive (concat (file-name-sans-extension tfile) ".toda"))
1514 ".toda")) 1547 (garchive (concat (file-name-sans-extension gfile) ".toda"))
1515 archived-count here) 1548 (archived-count (todo-get-count 'archived))
1516 ;; Merge in todo file. 1549 here)
1517 (with-current-buffer (get-buffer (find-file-noselect tfile)) 1550 (with-current-buffer (get-buffer (find-file-noselect tfile))
1518 (widen) 1551 (widen)
1519 (let* ((buffer-read-only nil) 1552 (let* ((buffer-read-only nil)
@@ -1536,94 +1569,102 @@ category."
1536 (point-marker)) 1569 (point-marker))
1537 (point-max-marker)))) 1570 (point-max-marker))))
1538 (todo (buffer-substring-no-properties tbeg tend)) 1571 (todo (buffer-substring-no-properties tbeg tend))
1539 (done (buffer-substring-no-properties dbeg cend))) 1572 (done (buffer-substring-no-properties dbeg cend))
1540 (goto-char (point-min)) 1573 (todo-count (todo-get-count 'todo cat))
1541 ;; Merge any todo items. 1574 (done-count (todo-get-count 'done cat)))
1542 (unless (zerop (length todo)) 1575 ;; Merge into goal todo category.
1543 (re-search-forward 1576 (with-current-buffer (get-buffer (find-file-noselect gfile))
1544 (concat "^" (regexp-quote (concat todo-category-beg goal)) "$") 1577 (unless (derived-mode-p 'todo-mode) (todo-mode))
1545 nil t) 1578 (widen)
1546 (re-search-forward 1579 (goto-char (point-min))
1547 (concat "^" (regexp-quote todo-category-done)) nil t) 1580 (let ((buffer-read-only nil))
1548 (forward-line -1) 1581 ;; Merge any todo items.
1549 (setq here (point-marker)) 1582 (unless (zerop (length todo))
1550 (insert todo) 1583 (re-search-forward
1551 (todo-update-count 'todo (todo-get-count 'todo cat) goal)) 1584 (concat "^" (regexp-quote (concat todo-category-beg goal)) "$")
1552 ;; Merge any done items. 1585 nil t)
1553 (unless (zerop (length done)) 1586 (re-search-forward
1554 (goto-char (if (re-search-forward 1587 (concat "^" (regexp-quote todo-category-done)) nil t)
1555 (concat "^" (regexp-quote todo-category-beg)) nil t) 1588 (forward-line -1)
1556 (match-beginning 0) 1589 (setq here (point-marker))
1557 (point-max))) 1590 (insert todo)
1558 (when (zerop (length todo)) (setq here (point-marker))) 1591 (todo-update-count 'todo todo-count goal))
1559 (insert done) 1592 ;; Merge any done items.
1560 (todo-update-count 'done (todo-get-count 'done cat) goal)) 1593 (unless (zerop (length done))
1594 (goto-char (if (re-search-forward
1595 (concat "^" (regexp-quote todo-category-beg))
1596 nil t)
1597 (match-beginning 0)
1598 (point-max)))
1599 (when (zerop (length todo)) (setq here (point-marker)))
1600 (insert done)
1601 (todo-update-count 'done done-count goal)))
1602 (todo-update-categories-sexp))
1603 ;; Update and clean up source todo file.
1561 (remove-overlays cbeg cend) 1604 (remove-overlays cbeg cend)
1562 (delete-region cbeg cend) 1605 (delete-region cbeg cend)
1563 (setq todo-categories (delete (assoc cat todo-categories) 1606 (setq todo-categories (delete (assoc cat todo-categories)
1564 todo-categories)) 1607 todo-categories))
1565 (todo-update-categories-sexp) 1608 (todo-update-categories-sexp)
1566 (mapc (lambda (m) (set-marker m nil)) (list cbeg tbeg dbeg tend cend)))) 1609 (when (> todo-category-number (length todo-categories))
1567 (when (file-exists-p archive) 1610 (setq todo-category-number 1))
1568 ;; Merge in archive file. 1611 (todo-category-select)
1569 (with-current-buffer (get-buffer (find-file-noselect archive)) 1612 (mapc (lambda (m) (set-marker m nil))
1613 (list cbeg tbeg dbeg tend cend))))
1614 (when (> archived-count 0)
1615 (with-current-buffer (get-buffer (find-file-noselect tarchive))
1570 (widen) 1616 (widen)
1571 (goto-char (point-min)) 1617 (goto-char (point-min))
1572 (let ((buffer-read-only nil) 1618 (let* ((buffer-read-only nil)
1573 (cbeg (save-excursion 1619 (cbeg (progn
1574 (when (re-search-forward 1620 (when (re-search-forward
1575 (concat "^" (regexp-quote 1621 (concat "^" (regexp-quote
1576 (concat todo-category-beg cat)) "$") 1622 (concat todo-category-beg cat)) "$")
1577 nil t)
1578 (goto-char (match-beginning 0))
1579 (point-marker))))
1580 (gbeg (save-excursion
1581 (when (re-search-forward
1582 (concat "^" (regexp-quote
1583 (concat todo-category-beg goal)) "$")
1584 nil t)
1585 (goto-char (match-beginning 0))
1586 (point-marker))))
1587 cend carch)
1588 (when cbeg
1589 (setq archived-count (todo-get-count 'done cat))
1590 (setq cend (save-excursion
1591 (if (re-search-forward
1592 (concat "^" (regexp-quote todo-category-beg))
1593 nil t) 1623 nil t)
1624 (goto-char (match-beginning 0))
1625 (point-marker))))
1626 (cend (if (re-search-forward
1627 (concat "^" (regexp-quote todo-category-beg)) nil t)
1628 (match-beginning 0)
1629 (point-max)))
1630 (carch (progn
1631 (goto-char cbeg)
1632 (forward-line)
1633 (buffer-substring-no-properties (point) cend))))
1634 ;; Merge into goal archive category, if it exists, else create it.
1635 (with-current-buffer (get-buffer (find-file-noselect garchive))
1636 (let ((gbeg (when (re-search-forward
1637 (concat "^" (regexp-quote
1638 (concat todo-category-beg goal))
1639 "$")
1640 nil t)
1641 (goto-char (match-beginning 0))
1642 (point-marker))))
1643 (goto-char (if (and gbeg
1644 (re-search-forward
1645 (concat "^" (regexp-quote todo-category-beg))
1646 nil t))
1594 (match-beginning 0) 1647 (match-beginning 0)
1595 (point-max)))) 1648 (point-max)))
1596 (setq carch (save-excursion (goto-char cbeg) (forward-line) 1649 (unless gbeg (todo-add-category nil goal))
1597 (buffer-substring-no-properties (point) cend))) 1650 (insert carch)
1598 ;; If both categories of the merge have archived items, merge the 1651 (todo-update-categories-sexp)))
1599 ;; source items to the goal items, else "merge" by renaming the 1652 ;; Update and clean up source archive file.
1600 ;; source category to goal. 1653 (remove-overlays cbeg cend)
1601 (if gbeg 1654 (delete-region cbeg cend)
1602 (progn 1655 (setq todo-categories (todo-make-categories-list t))
1603 (goto-char (if (re-search-forward 1656 (todo-update-categories-sexp))))
1604 (concat "^" (regexp-quote todo-category-beg)) 1657 ;; Update goal todo file for merged archived items and display it.
1605 nil t) 1658 (set-window-buffer (selected-window) (set-buffer (get-file-buffer gfile)))
1606 (match-beginning 0) 1659 (unless (zerop archived-count)
1607 (point-max))) 1660 (todo-update-count 'archived archived-count goal)
1608 (insert carch) 1661 (todo-update-categories-sexp))
1609 (remove-overlays cbeg cend) 1662 (todo-category-number goal)
1610 (delete-region cbeg cend)) 1663 ;; If there are only merged done items, show them.
1611 (goto-char cbeg) 1664 (let ((todo-show-with-done (zerop (todo-get-count 'todo goal))))
1612 (search-forward cat) 1665 (todo-category-select)
1613 (replace-match goal)) 1666 ;; Put point on the first merged item.
1614 (setq todo-categories (todo-make-categories-list t)) 1667 (goto-char here))
1615 (todo-update-categories-sexp)))))
1616 (with-current-buffer (get-file-buffer tfile)
1617 (when archived-count
1618 (unless (zerop archived-count)
1619 (todo-update-count 'archived archived-count goal)
1620 (todo-update-categories-sexp)))
1621 (todo-category-number goal)
1622 ;; If there are only merged done items, show them.
1623 (let ((todo-show-with-done (zerop (todo-get-count 'todo goal))))
1624 (todo-category-select)
1625 ;; Put point on the first merged item.
1626 (goto-char here)))
1627 (set-marker here nil))) 1668 (set-marker here nil)))
1628 1669
1629;; ----------------------------------------------------------------------------- 1670;; -----------------------------------------------------------------------------
@@ -2965,6 +3006,7 @@ displayed."
2965 (when place 3006 (when place
2966 (set-window-buffer (selected-window) 3007 (set-window-buffer (selected-window)
2967 (set-buffer (find-file-noselect archive))) 3008 (set-buffer (find-file-noselect archive)))
3009 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
2968 (if (member place '(other-archive other-cat)) 3010 (if (member place '(other-archive other-cat))
2969 (setq todo-category-number 1) 3011 (setq todo-category-number 1)
2970 (todo-category-number cat)) 3012 (todo-category-number cat))
@@ -2997,7 +3039,7 @@ this category does not exist in the archive, it is created."
2997 (afile (concat (file-name-sans-extension 3039 (afile (concat (file-name-sans-extension
2998 todo-current-todo-file) ".toda")) 3040 todo-current-todo-file) ".toda"))
2999 (archive (find-file-noselect afile t)) 3041 (archive (find-file-noselect afile t))
3000 (item (and (todo-done-item-p) 3042 (item (and (not marked) (todo-done-item-p)
3001 (concat (todo-item-string) "\n"))) 3043 (concat (todo-item-string) "\n")))
3002 (count 0) 3044 (count 0)
3003 (opoint (unless (todo-done-item-p) (point))) 3045 (opoint (unless (todo-done-item-p) (point)))
@@ -3040,6 +3082,7 @@ this category does not exist in the archive, it is created."
3040 (if (not (or marked all item)) 3082 (if (not (or marked all item))
3041 (throw 'end (message "Only done items can be archived")) 3083 (throw 'end (message "Only done items can be archived"))
3042 (with-current-buffer archive 3084 (with-current-buffer archive
3085 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
3043 (let (buffer-read-only) 3086 (let (buffer-read-only)
3044 (widen) 3087 (widen)
3045 (goto-char (point-min)) 3088 (goto-char (point-min))
@@ -3061,12 +3104,12 @@ this category does not exist in the archive, it is created."
3061 (todo-update-categories-sexp) 3104 (todo-update-categories-sexp)
3062 ;; If archive is new, save to file now (with 3105 ;; If archive is new, save to file now (with
3063 ;; write-region to avoid prompt for file to save to) 3106 ;; write-region to avoid prompt for file to save to)
3064 ;; to update todo-archives, and to let auto-mode-alist 3107 ;; to update todo-archives, and set the mode for
3065 ;; take effect below on visiting the archive. 3108 ;; visiting the archive below.
3066 (unless (nth 7 (file-attributes afile)) 3109 (unless (nth 7 (file-attributes afile))
3067 (write-region nil nil afile t t) 3110 (write-region nil nil afile t t)
3068 (setq todo-archives (funcall todo-files-function t)) 3111 (setq todo-archives (funcall todo-files-function t))
3069 (kill-buffer)))) 3112 (todo-archive-mode))))
3070 (with-current-buffer tbuf 3113 (with-current-buffer tbuf
3071 (cond 3114 (cond
3072 (all 3115 (all
@@ -3092,7 +3135,8 @@ this category does not exist in the archive, it is created."
3092 (todo-update-count 'done -1) 3135 (todo-update-count 'done -1)
3093 (todo-update-count 'archived 1) 3136 (todo-update-count 'archived 1)
3094 ;; Don't leave point below last item. 3137 ;; Don't leave point below last item.
3095 (and item (bolp) (eolp) (< (point-min) (point-max)) 3138 (and (or marked item) (bolp) (eolp)
3139 (< (point-min) (point-max))
3096 (todo-backward-item)) 3140 (todo-backward-item))
3097 (when item 3141 (when item
3098 (throw 'done (setq item nil)))) 3142 (throw 'done (setq item nil))))
@@ -3182,15 +3226,16 @@ the only category in the archive, the archive file is deleted."
3182 (throw 'done (setq item nil)))) 3226 (throw 'done (setq item nil))))
3183 (todo-forward-item)))) 3227 (todo-forward-item))))
3184 (todo-update-count 'done (if marked (- marked-count) -1) cat) 3228 (todo-update-count 'done (if marked (- marked-count) -1) cat)
3185 ;; If that was the last category in the archive, delete the whole file. 3229 ;; If we unarchived the last item in category, then if that was
3186 (if (= (length todo-categories) 1) 3230 ;; the only category, delete the whole file, otherwise, just
3187 (progn 3231 ;; delete the category.
3188 (delete-file todo-current-todo-file) 3232 (when (= 0 (todo-get-count 'done))
3189 ;; Kill the archive buffer silently. 3233 (if (= 1 (length todo-categories))
3190 (set-buffer-modified-p nil) 3234 (progn
3191 (kill-buffer)) 3235 (delete-file todo-current-todo-file)
3192 ;; Otherwise, if the archive category is now empty, delete it. 3236 ;; Kill the archive buffer silently.
3193 (when (eq (point-min) (point-max)) 3237 (set-buffer-modified-p nil)
3238 (kill-buffer))
3194 (widen) 3239 (widen)
3195 (let ((beg (re-search-backward 3240 (let ((beg (re-search-backward
3196 (concat "^" (regexp-quote todo-category-beg) cat "$") 3241 (concat "^" (regexp-quote todo-category-beg) cat "$")
@@ -3203,8 +3248,8 @@ the only category in the archive, the archive file is deleted."
3203 (remove-overlays beg end) 3248 (remove-overlays beg end)
3204 (delete-region beg end) 3249 (delete-region beg end)
3205 (setq todo-categories (delete (assoc cat todo-categories) 3250 (setq todo-categories (delete (assoc cat todo-categories)
3206 todo-categories)) 3251 todo-categories)))))
3207 (todo-update-categories-sexp)))) 3252 (todo-update-categories-sexp)
3208 ;; Visit category in todo file and show restored done items. 3253 ;; Visit category in todo file and show restored done items.
3209 (let ((tfile (buffer-file-name tbuf)) 3254 (let ((tfile (buffer-file-name tbuf))
3210 (todo-show-with-done t)) 3255 (todo-show-with-done t))
@@ -3925,7 +3970,9 @@ regexp items."
3925 (setq file (completing-read "Choose a filtered items file: " 3970 (setq file (completing-read "Choose a filtered items file: "
3926 falist nil t nil nil (car falist))) 3971 falist nil t nil nil (car falist)))
3927 (setq file (cdr (assoc-string file falist))) 3972 (setq file (cdr (assoc-string file falist)))
3928 (find-file file))) 3973 (find-file file)
3974 (unless (derived-mode-p 'todo-filtered-items-mode)
3975 (todo-filtered-items-mode))))
3929 3976
3930(defun todo-go-to-source-item () 3977(defun todo-go-to-source-item ()
3931 "Display the file and category of the filtered item at point." 3978 "Display the file and category of the filtered item at point."
@@ -4056,6 +4103,8 @@ multifile commands for further details."
4056 (completing-read "Choose a regexp items file: " 4103 (completing-read "Choose a regexp items file: "
4057 rxf) 'regexp)))) 4104 rxf) 'regexp))))
4058 (find-file fname) 4105 (find-file fname)
4106 (unless (derived-mode-p 'todo-filtered-items-mode)
4107 (todo-filtered-items-mode))
4059 (todo-prefix-overlays) 4108 (todo-prefix-overlays)
4060 (todo-check-filtered-items-file)) 4109 (todo-check-filtered-items-file))
4061 (t 4110 (t
@@ -4309,6 +4358,9 @@ its priority has changed, and `same' otherwise."
4309 todo-global-current-todo-file))) 4358 todo-global-current-todo-file)))
4310 (find-file-noselect file) 4359 (find-file-noselect file)
4311 (with-current-buffer (find-buffer-visiting file) 4360 (with-current-buffer (find-buffer-visiting file)
4361 (if archive
4362 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
4363 (unless (derived-mode-p 'todo-mode) (todo-mode)))
4312 (save-restriction 4364 (save-restriction
4313 (widen) 4365 (widen)
4314 (goto-char (point-min)) 4366 (goto-char (point-min))
@@ -4885,23 +4937,28 @@ the file."
4885 ;; Make sure to include newly created archives, e.g. due to 4937 ;; Make sure to include newly created archives, e.g. due to
4886 ;; todo-move-category. 4938 ;; todo-move-category.
4887 (when (member archive (funcall todo-files-function t)) 4939 (when (member archive (funcall todo-files-function t))
4888 (let ((archive-count 0)) 4940 (let ((archive-count 0)
4889 (with-current-buffer (find-file-noselect archive) 4941 (visiting (find-buffer-visiting archive)))
4890 (widen) 4942 (with-current-buffer (or visiting
4891 (goto-char (point-min)) 4943 (find-file-noselect archive))
4892 (when (re-search-forward 4944 (save-excursion
4893 (concat "^" (regexp-quote todo-category-beg) 4945 (save-restriction
4894 cat "$") 4946 (widen)
4895 (point-max) t) 4947 (goto-char (point-min))
4896 (forward-line) 4948 (when (re-search-forward
4897 (while (not (or (looking-at 4949 (concat "^" (regexp-quote todo-category-beg)
4898 (concat 4950 cat "$")
4899 (regexp-quote todo-category-beg) 4951 (point-max) t)
4900 "\\(.*\\)\n")) 4952 (forward-line)
4901 (eobp))) 4953 (while (not (or (looking-at
4902 (when (looking-at todo-done-string-start) 4954 (concat
4903 (setq archive-count (1+ archive-count))) 4955 (regexp-quote todo-category-beg)
4904 (forward-line)))) 4956 "\\(.*\\)\n"))
4957 (eobp)))
4958 (when (looking-at todo-done-string-start)
4959 (setq archive-count (1+ archive-count)))
4960 (forward-line)))))
4961 (unless visiting (kill-buffer)))
4905 (todo-update-count 'archived archive-count cat)))) 4962 (todo-update-count 'archived archive-count cat))))
4906 ((looking-at todo-done-string-start) 4963 ((looking-at todo-done-string-start)
4907 (todo-update-count 'done 1 cat)) 4964 (todo-update-count 'done 1 cat))
@@ -5125,6 +5182,11 @@ Overrides `diary-goto-entry'."
5125 (if (not (and (file-exists-p file) 5182 (if (not (and (file-exists-p file)
5126 (find-file-other-window file))) 5183 (find-file-other-window file)))
5127 (message "Unable to locate this diary entry") 5184 (message "Unable to locate this diary entry")
5185 ;; If it's a Todo file, make sure it's in Todo mode.
5186 (when (and (equal (file-name-directory (file-truename file))
5187 (file-truename todo-directory))
5188 (not (derived-mode-p 'todo-mode)))
5189 (todo-mode))
5128 (when (eq major-mode 'todo-mode) (widen)) 5190 (when (eq major-mode 'todo-mode) (widen))
5129 (goto-char (point-min)) 5191 (goto-char (point-min))
5130 (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t) 5192 (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t)
@@ -5564,6 +5626,9 @@ have been removed."
5564 (add-to-list 'files curfile)) 5626 (add-to-list 'files curfile))
5565 (dolist (f files listall) 5627 (dolist (f files listall)
5566 (with-current-buffer (find-file-noselect f 'nowarn) 5628 (with-current-buffer (find-file-noselect f 'nowarn)
5629 (if archive
5630 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
5631 (unless (derived-mode-p 'todo-mode) (todo-mode)))
5567 ;; Ensure category is properly displayed in case user 5632 ;; Ensure category is properly displayed in case user
5568 ;; switches to file via a non-Todo mode command. And if 5633 ;; switches to file via a non-Todo mode command. And if
5569 ;; done items in category are visible, keep them visible. 5634 ;; done items in category are visible, keep them visible.
@@ -5616,7 +5681,7 @@ otherwise, a new file name is allowed."
5616 "")))) 5681 ""))))
5617 (unless (file-exists-p todo-directory) 5682 (unless (file-exists-p todo-directory)
5618 (make-directory todo-directory)) 5683 (make-directory todo-directory))
5619 (unless mustmatch 5684 (unless (or mustmatch (member file files))
5620 (setq file (todo-validate-name file 'file))) 5685 (setq file (todo-validate-name file 'file)))
5621 (setq file (file-truename (concat todo-directory file 5686 (setq file (file-truename (concat todo-directory file
5622 (if archive ".toda" ".todo")))))) 5687 (if archive ".toda" ".todo"))))))
@@ -5649,6 +5714,7 @@ categories from `todo-category-completions-files'."
5649 (categories (cond (file0 5714 (categories (cond (file0
5650 (with-current-buffer 5715 (with-current-buffer
5651 (find-file-noselect file0 'nowarn) 5716 (find-file-noselect file0 'nowarn)
5717 (unless (derived-mode-p 'todo-mode) (todo-mode))
5652 (let ((todo-current-todo-file file0)) 5718 (let ((todo-current-todo-file file0))
5653 todo-categories))) 5719 todo-categories)))
5654 ((and add (not file)) 5720 ((and add (not file))
@@ -5915,8 +5981,9 @@ the empty string (i.e., no time string)."
5915 5981
5916(defun todo-reset-nondiary-marker (symbol value) 5982(defun todo-reset-nondiary-marker (symbol value)
5917 "The :set function for user option `todo-nondiary-marker'." 5983 "The :set function for user option `todo-nondiary-marker'."
5918 (let ((oldvalue (symbol-value symbol)) 5984 (let* ((oldvalue (symbol-value symbol))
5919 (files (append todo-files todo-archives))) 5985 (files (append todo-files todo-archives
5986 (directory-files todo-directory t "\.tod[rty]$" t))))
5920 (custom-set-default symbol value) 5987 (custom-set-default symbol value)
5921 ;; Need to reset these to get font-locking right. 5988 ;; Need to reset these to get font-locking right.
5922 (setq todo-nondiary-start (nth 0 todo-nondiary-marker) 5989 (setq todo-nondiary-start (nth 0 todo-nondiary-marker)
@@ -5927,23 +5994,28 @@ the empty string (i.e., no time string)."
5927 (regexp-quote diary-nonmarking-symbol) "\\)?")) 5994 (regexp-quote diary-nonmarking-symbol) "\\)?"))
5928 (when (not (equal value oldvalue)) 5995 (when (not (equal value oldvalue))
5929 (dolist (f files) 5996 (dolist (f files)
5930 (with-current-buffer (find-file-noselect f) 5997 (let ((buf (find-buffer-visiting f)))
5931 (let (buffer-read-only) 5998 (with-current-buffer (find-file-noselect f)
5932 (widen) 5999 (let (buffer-read-only)
5933 (goto-char (point-min)) 6000 (widen)
5934 (while (not (eobp)) 6001 (goto-char (point-min))
5935 (if (re-search-forward 6002 (while (not (eobp))
5936 (concat "^\\(" todo-done-string-start "[^][]+] \\)?" 6003 (if (re-search-forward
5937 "\\(?1:" (regexp-quote (car oldvalue)) 6004 (concat "^\\(" todo-done-string-start "[^][]+] \\)?"
5938 "\\)" todo-date-pattern "\\( " 6005 "\\(?1:" (regexp-quote (car oldvalue))
5939 diary-time-regexp "\\)?\\(?2:" 6006 "\\)" todo-date-pattern "\\( "
5940 (regexp-quote (cadr oldvalue)) "\\)") 6007 diary-time-regexp "\\)?\\(?2:"
5941 nil t) 6008 (regexp-quote (cadr oldvalue)) "\\)")
5942 (progn 6009 nil t)
5943 (replace-match (nth 0 value) t t nil 1) 6010 (progn
5944 (replace-match (nth 1 value) t t nil 2)) 6011 (replace-match (nth 0 value) t t nil 1)
5945 (forward-line))) 6012 (replace-match (nth 1 value) t t nil 2))
5946 (todo-category-select))))))) 6013 (forward-line)))
6014 (if buf
6015 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6016 (todo-category-select))
6017 (save-buffer)
6018 (kill-buffer)))))))))
5947 6019
5948(defun todo-reset-done-separator-string (symbol value) 6020(defun todo-reset-done-separator-string (symbol value)
5949 "The :set function for `todo-done-separator-string'." 6021 "The :set function for `todo-done-separator-string'."
@@ -5963,51 +6035,63 @@ the empty string (i.e., no time string)."
5963(defun todo-reset-done-string (symbol value) 6035(defun todo-reset-done-string (symbol value)
5964 "The :set function for user option `todo-done-string'." 6036 "The :set function for user option `todo-done-string'."
5965 (let ((oldvalue (symbol-value symbol)) 6037 (let ((oldvalue (symbol-value symbol))
5966 (files (append todo-files todo-archives))) 6038 (files (append todo-files todo-archives
6039 (directory-files todo-directory t "\.todr$" t))))
5967 (custom-set-default symbol value) 6040 (custom-set-default symbol value)
5968 ;; Need to reset this to get font-locking right. 6041 ;; Need to reset this to get font-locking right.
5969 (setq todo-done-string-start 6042 (setq todo-done-string-start
5970 (concat "^\\[" (regexp-quote todo-done-string))) 6043 (concat "^\\[" (regexp-quote todo-done-string)))
5971 (when (not (equal value oldvalue)) 6044 (when (not (equal value oldvalue))
5972 (dolist (f files) 6045 (dolist (f files)
5973 (with-current-buffer (find-file-noselect f) 6046 (let ((buf (find-buffer-visiting f)))
5974 (let (buffer-read-only) 6047 (with-current-buffer (find-file-noselect f)
5975 (widen) 6048 (let (buffer-read-only)
5976 (goto-char (point-min)) 6049 (widen)
5977 (while (not (eobp)) 6050 (goto-char (point-min))
5978 (if (re-search-forward 6051 (while (not (eobp))
5979 (concat "^" (regexp-quote todo-nondiary-start) 6052 (if (re-search-forward
5980 "\\(" (regexp-quote oldvalue) "\\)") 6053 (concat "^" (regexp-quote todo-nondiary-start)
5981 nil t) 6054 "\\(" (regexp-quote oldvalue) "\\)")
5982 (replace-match value t t nil 1) 6055 nil t)
5983 (forward-line))) 6056 (replace-match value t t nil 1)
5984 (todo-category-select))))))) 6057 (forward-line)))
6058 (if buf
6059 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6060 (todo-category-select))
6061 (save-buffer)
6062 (kill-buffer)))))))))
5985 6063
5986(defun todo-reset-comment-string (symbol value) 6064(defun todo-reset-comment-string (symbol value)
5987 "The :set function for user option `todo-comment-string'." 6065 "The :set function for user option `todo-comment-string'."
5988 (let ((oldvalue (symbol-value symbol)) 6066 (let ((oldvalue (symbol-value symbol))
5989 (files (append todo-files todo-archives))) 6067 (files (append todo-files todo-archives
6068 (directory-files todo-directory t "\.todr$" t))))
5990 (custom-set-default symbol value) 6069 (custom-set-default symbol value)
5991 (when (not (equal value oldvalue)) 6070 (when (not (equal value oldvalue))
5992 (dolist (f files) 6071 (dolist (f files)
5993 (with-current-buffer (find-file-noselect f) 6072 (let ((buf (find-buffer-visiting f)))
5994 (let (buffer-read-only) 6073 (with-current-buffer (find-file-noselect f)
5995 (save-excursion 6074 (let (buffer-read-only)
5996 (widen) 6075 (widen)
5997 (goto-char (point-min)) 6076 (goto-char (point-min))
5998 (while (not (eobp)) 6077 (while (not (eobp))
5999 (if (re-search-forward 6078 (if (re-search-forward
6000 (concat 6079 (concat "\\[\\(" (regexp-quote oldvalue)
6001 "\\[\\(" (regexp-quote oldvalue) "\\): [^]]*\\]") 6080 "\\): [^]]*\\]")
6002 nil t) 6081 nil t)
6003 (replace-match value t t nil 1) 6082 (replace-match value t t nil 1)
6004 (forward-line))) 6083 (forward-line)))
6005 (todo-category-select)))))))) 6084 (if buf
6085 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6086 (todo-category-select))
6087 (save-buffer)
6088 (kill-buffer)))))))))
6006 6089
6007(defun todo-reset-highlight-item (symbol value) 6090(defun todo-reset-highlight-item (symbol value)
6008 "The :set function for `todo-toggle-item-highlighting'." 6091 "The :set function for user option `todo-highlight-item'."
6009 (let ((oldvalue (symbol-value symbol)) 6092 (let ((oldvalue (symbol-value symbol))
6010 (files (append todo-files todo-archives))) 6093 (files (append todo-files todo-archives
6094 (directory-files todo-directory t "\.tod[rty]$" t))))
6011 (custom-set-default symbol value) 6095 (custom-set-default symbol value)
6012 (when (not (equal value oldvalue)) 6096 (when (not (equal value oldvalue))
6013 (dolist (f files) 6097 (dolist (f files)
@@ -6399,20 +6483,20 @@ Added to `pre-command-hook' in Todo mode when user option
6399`todo-show-current-file' is set to non-nil." 6483`todo-show-current-file' is set to non-nil."
6400 (setq todo-global-current-todo-file todo-current-todo-file)) 6484 (setq todo-global-current-todo-file todo-current-todo-file))
6401 6485
6402(defun todo-display-as-todo-file () 6486;; (defun todo-display-as-todo-file ()
6403 "Show todo files correctly when visited from outside of Todo mode. 6487;; "Show todo files correctly when visited from outside of Todo mode.
6404Added to `find-file-hook' in Todo mode and Todo Archive mode." 6488;; Added to `find-file-hook' in Todo mode and Todo Archive mode."
6405 (and (member this-command todo-visit-files-commands) 6489;; (and (member this-command todo-visit-files-commands)
6406 (= (- (point-max) (point-min)) (buffer-size)) 6490;; (= (- (point-max) (point-min)) (buffer-size))
6407 (member major-mode '(todo-mode todo-archive-mode)) 6491;; (member major-mode '(todo-mode todo-archive-mode))
6408 (todo-category-select))) 6492;; (todo-category-select)))
6409 6493
6410(defun todo-add-to-buffer-list () 6494;; (defun todo-add-to-buffer-list ()
6411 "Add name of just visited todo file to `todo-file-buffers'. 6495;; "Add name of just visited todo file to `todo-file-buffers'.
6412This function is added to `find-file-hook' in Todo mode." 6496;; This function is added to `find-file-hook' in Todo mode."
6413 (let ((filename (file-truename (buffer-file-name)))) 6497;; (let ((filename (file-truename (buffer-file-name))))
6414 (when (member filename todo-files) 6498;; (when (member filename todo-files)
6415 (add-to-list 'todo-file-buffers filename)))) 6499;; (add-to-list 'todo-file-buffers filename))))
6416 6500
6417(defun todo-update-buffer-list () 6501(defun todo-update-buffer-list ()
6418 "Make current Todo mode buffer file car of `todo-file-buffers'. 6502 "Make current Todo mode buffer file car of `todo-file-buffers'.
@@ -6467,7 +6551,8 @@ Added to `window-configuration-change-hook' in Todo mode."
6467 "Make some settings that apply to multiple Todo modes." 6551 "Make some settings that apply to multiple Todo modes."
6468 (setq-local todo-categories (todo-set-categories)) 6552 (setq-local todo-categories (todo-set-categories))
6469 (setq-local todo-category-number 1) 6553 (setq-local todo-category-number 1)
6470 (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)) 6554 ;; (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)
6555 )
6471 6556
6472(put 'todo-mode 'mode-class 'special) 6557(put 'todo-mode 'mode-class 'special)
6473 6558
@@ -6486,7 +6571,7 @@ Added to `window-configuration-change-hook' in Todo mode."
6486 (setq-local todo-current-todo-file (file-truename (buffer-file-name)))) 6571 (setq-local todo-current-todo-file (file-truename (buffer-file-name))))
6487 (setq-local todo-show-done-only nil) 6572 (setq-local todo-show-done-only nil)
6488 (setq-local todo-categories-with-marks nil) 6573 (setq-local todo-categories-with-marks nil)
6489 (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t) 6574 ;; (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t)
6490 (add-hook 'post-command-hook 'todo-update-buffer-list nil t) 6575 (add-hook 'post-command-hook 'todo-update-buffer-list nil t)
6491 (when todo-show-current-file 6576 (when todo-show-current-file
6492 (add-hook 'pre-command-hook 'todo-show-current-file nil t)) 6577 (add-hook 'pre-command-hook 'todo-show-current-file nil t))
@@ -6555,13 +6640,6 @@ Added to `window-configuration-change-hook' in Todo mode."
6555 (todo-modes-set-1) 6640 (todo-modes-set-1)
6556 (todo-modes-set-2)) 6641 (todo-modes-set-2))
6557 6642
6558;;;###autoload
6559(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
6560;;;###autoload
6561(add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-archive-mode))
6562;;;###autoload
6563(add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todo-filtered-items-mode))
6564
6565;; ----------------------------------------------------------------------------- 6643;; -----------------------------------------------------------------------------
6566(provide 'todo-mode) 6644(provide 'todo-mode)
6567 6645
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 913ef4cb8bf..a9e6f3f5b56 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -218,6 +218,10 @@
218 (color :tag "Foreground" 218 (color :tag "Foreground"
219 :help-echo "Set foreground color (name or #RRGGBB hex spec).")) 219 :help-echo "Set foreground color (name or #RRGGBB hex spec)."))
220 220
221 (:distant-foreground
222 (color :tag "Distant Foreground"
223 :help-echo "Set distant foreground color (name or #RRGGBB hex spec)."))
224
221 (:background 225 (:background
222 (color :tag "Background" 226 (color :tag "Background"
223 :help-echo "Set background color (name or #RRGGBB hex spec).")) 227 :help-echo "Set background color (name or #RRGGBB hex spec)."))
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index a502901a469..ca9b91bed58 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -141,7 +141,7 @@ If CLASS is actually an object, then also display current values of that object.
141 (insert " " (aref type counter) " " 141 (insert " " (aref type counter) " "
142 (prin1-to-string (car cur) (current-buffer)) 142 (prin1-to-string (car cur) (current-buffer))
143 "\n" 143 "\n"
144 (cdr cur))) 144 (or (cdr cur) "")))
145 (setq counter (1+ counter)))) 145 (setq counter (1+ counter))))
146 (insert "\n\n") 146 (insert "\n\n")
147 (setq methods (cdr methods)))))) 147 (setq methods (cdr methods))))))
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 3ff65ff11cd..23b021df177 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -431,16 +431,18 @@ is called as a function to find the defun's end."
431 (push-mark)) 431 (push-mark))
432 (if (or (null arg) (= arg 0)) (setq arg 1)) 432 (if (or (null arg) (= arg 0)) (setq arg 1))
433 (let ((pos (point)) 433 (let ((pos (point))
434 (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point)))) 434 (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point)))
435 (skip (lambda ()
436 ;; When comparing point against pos, we want to consider that if
437 ;; point was right after the end of the function, it's still
438 ;; considered as "in that function".
439 ;; E.g. `eval-defun' from right after the last close-paren.
440 (unless (bolp)
441 (skip-chars-forward " \t")
442 (if (looking-at "\\s<\\|\n")
443 (forward-line 1))))))
435 (funcall end-of-defun-function) 444 (funcall end-of-defun-function)
436 ;; When comparing point against pos, we want to consider that if 445 (funcall skip)
437 ;; point was right after the end of the function, it's still
438 ;; considered as "in that function".
439 ;; E.g. `eval-defun' from right after the last close-paren.
440 (unless (bolp)
441 (skip-chars-forward " \t")
442 (if (looking-at "\\s<\\|\n")
443 (forward-line 1)))
444 (cond 446 (cond
445 ((> arg 0) 447 ((> arg 0)
446 ;; Moving forward. 448 ;; Moving forward.
@@ -463,11 +465,19 @@ is called as a function to find the defun's end."
463 (goto-char beg)) 465 (goto-char beg))
464 (unless (zerop arg) 466 (unless (zerop arg)
465 (beginning-of-defun-raw (- arg)) 467 (beginning-of-defun-raw (- arg))
468 (setq beg (point))
466 (funcall end-of-defun-function)))) 469 (funcall end-of-defun-function))))
467 (unless (bolp) 470 (funcall skip)
468 (skip-chars-forward " \t") 471 (while (and (< arg 0) (>= (point) pos))
469 (if (looking-at "\\s<\\|\n") 472 ;; We intended to move backward, but this ended up not doing so:
470 (forward-line 1))))) 473 ;; Try harder!
474 (goto-char beg)
475 (beginning-of-defun-raw (- arg))
476 (if (>= (point) beg)
477 (setq arg 0)
478 (setq beg (point))
479 (funcall end-of-defun-function)
480 (funcall skip)))))
471 481
472(defun mark-defun (&optional allow-extend) 482(defun mark-defun (&optional allow-extend)
473 "Put mark at end of this defun, point at beginning. 483 "Put mark at end of this defun, point at beginning.
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 66a4f8fdea7..bfd939d69e2 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -180,12 +180,16 @@ WHERE is a symbol to select an entry in `advice--where-alist'."
180 (advice--make-1 (nth 1 desc) (nth 2 desc) 180 (advice--make-1 (nth 1 desc) (nth 2 desc)
181 function main props))))) 181 function main props)))))
182 182
183(defun advice--member-p (function name definition) 183(defun advice--member-p (function use-name definition)
184 (let ((found nil)) 184 (let ((found nil))
185 (while (and (not found) (advice--p definition)) 185 (while (and (not found) (advice--p definition))
186 (if (if name 186 (if (if (eq use-name :use-both)
187 (equal name (cdr (assq 'name (advice--props definition)))) 187 (or (equal function
188 (equal function (advice--car definition))) 188 (cdr (assq 'name (advice--props definition))))
189 (equal function (advice--car definition)))
190 (equal function (if use-name
191 (cdr (assq 'name (advice--props definition)))
192 (advice--car definition))))
189 (setq found definition) 193 (setq found definition)
190 (setq definition (advice--cdr definition)))) 194 (setq definition (advice--cdr definition))))
191 found)) 195 found))
@@ -292,7 +296,7 @@ is also interactive. There are 3 cases:
292;;;###autoload 296;;;###autoload
293(defun advice--add-function (where ref function props) 297(defun advice--add-function (where ref function props)
294 (let* ((name (cdr (assq 'name props))) 298 (let* ((name (cdr (assq 'name props)))
295 (a (advice--member-p function name (gv-deref ref)))) 299 (a (advice--member-p (or name function) (if name t) (gv-deref ref))))
296 (when a 300 (when a
297 ;; The advice is already present. Remove the old one, first. 301 ;; The advice is already present. Remove the old one, first.
298 (setf (gv-deref ref) 302 (setf (gv-deref ref)
@@ -324,7 +328,7 @@ properties alist that was specified when it was added."
324 "Return non-nil if ADVICE is already in FUNCTION-DEF. 328 "Return non-nil if ADVICE is already in FUNCTION-DEF.
325Instead of ADVICE being the actual function, it can also be the `name' 329Instead of ADVICE being the actual function, it can also be the `name'
326of the piece of advice." 330of the piece of advice."
327 (advice--member-p advice advice function-def)) 331 (advice--member-p advice :use-both function-def))
328 332
329;;;; Specific application of add-function to `symbol-function' for advice. 333;;;; Specific application of add-function to `symbol-function' for advice.
330 334
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 5843724a596..e6bc8f9b485 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1266,10 +1266,7 @@ similar to an entry in `package-alist'. Save the cached copy to
1266 ;; may fetch a URL redirect page). 1266 ;; may fetch a URL redirect page).
1267 (when (listp (read (current-buffer))) 1267 (when (listp (read (current-buffer)))
1268 (make-directory dir t) 1268 (make-directory dir t)
1269 (setq buffer-file-name (expand-file-name file dir)) 1269 (write-region nil nil (expand-file-name file dir) nil 'silent)))
1270 (let ((version-control 'never)
1271 (require-final-newline nil))
1272 (save-buffer))))
1273 (when good-signatures 1270 (when good-signatures
1274 ;; Write out good signatures into archive-contents.signed file. 1271 ;; Write out good signatures into archive-contents.signed file.
1275 (write-region (mapconcat #'epg-signature-to-string good-signatures "\n") 1272 (write-region (mapconcat #'epg-signature-to-string good-signatures "\n")
@@ -1515,11 +1512,13 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1515 (package--with-work-buffer 1512 (package--with-work-buffer
1516 (package-archive-base desc) 1513 (package-archive-base desc)
1517 (format "%s-readme.txt" name) 1514 (format "%s-readme.txt" name)
1518 (setq buffer-file-name 1515 (save-excursion
1519 (expand-file-name readme package-user-dir)) 1516 (goto-char (point-max))
1520 (let ((version-control 'never) 1517 (unless (bolp)
1521 (require-final-newline t)) 1518 (insert ?\n)))
1522 (save-buffer)) 1519 (write-region nil nil
1520 (expand-file-name readme package-user-dir)
1521 nil 'silent)
1523 (setq readme-string (buffer-string)) 1522 (setq readme-string (buffer-string))
1524 t)) 1523 t))
1525 (error nil)) 1524 (error nil))
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 515bbc36a06..7fc6bf7b920 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -290,42 +290,50 @@ This function is called, by name, directly by the C code."
290 (cell 290 (cell
291 ;; Delete from queue. Record the cons cell that was used. 291 ;; Delete from queue. Record the cons cell that was used.
292 (cancel-timer-internal timer))) 292 (cancel-timer-internal timer)))
293 ;; Re-schedule if requested. 293 ;; If `cell' is nil, it means the timer was already canceled, so we
294 (if (timer--repeat-delay timer) 294 ;; shouldn't be running it at all. This can happen for example with the
295 (if (timer--idle-delay timer) 295 ;; following scenario (bug#17392):
296 (timer-activate-when-idle timer nil cell) 296 ;; - we run timers, starting with A (and remembering the rest as (B C)).
297 (timer-inc-time timer (timer--repeat-delay timer) 0) 297 ;; - A runs and a does a sit-for.
298 ;; If real time has jumped forward, 298 ;; - during sit-for we run timer D which cancels timer B.
299 ;; perhaps because Emacs was suspended for a long time, 299 ;; - timer A finally finishes, so we move on to timers B and C.
300 ;; limit how many times things get repeated. 300 (when cell
301 (if (and (numberp timer-max-repeats) 301 ;; Re-schedule if requested.
302 (< 0 (timer-until timer (current-time)))) 302 (if (timer--repeat-delay timer)
303 (let ((repeats (/ (timer-until timer (current-time)) 303 (if (timer--idle-delay timer)
304 (timer--repeat-delay timer)))) 304 (timer-activate-when-idle timer nil cell)
305 (if (> repeats timer-max-repeats) 305 (timer-inc-time timer (timer--repeat-delay timer) 0)
306 (timer-inc-time timer (* (timer--repeat-delay timer) 306 ;; If real time has jumped forward,
307 repeats))))) 307 ;; perhaps because Emacs was suspended for a long time,
308 ;; Place it back on the timer-list before running 308 ;; limit how many times things get repeated.
309 ;; timer--function, so it can cancel-timer itself. 309 (if (and (numberp timer-max-repeats)
310 (timer-activate timer t cell) 310 (< 0 (timer-until timer (current-time))))
311 (setq retrigger t))) 311 (let ((repeats (/ (timer-until timer (current-time))
312 ;; Run handler. 312 (timer--repeat-delay timer))))
313 (condition-case-unless-debug err 313 (if (> repeats timer-max-repeats)
314 ;; Timer functions should not change the current buffer. 314 (timer-inc-time timer (* (timer--repeat-delay timer)
315 ;; If they do, all kinds of nasty surprises can happen, 315 repeats)))))
316 ;; and it can be hellish to track down their source. 316 ;; Place it back on the timer-list before running
317 (save-current-buffer 317 ;; timer--function, so it can cancel-timer itself.
318 (apply (timer--function timer) (timer--args timer))) 318 (timer-activate timer t cell)
319 (error (message "Error running timer%s: %S" 319 (setq retrigger t)))
320 (if (symbolp (timer--function timer)) 320 ;; Run handler.
321 (format " `%s'" (timer--function timer)) "") 321 (condition-case-unless-debug err
322 err))) 322 ;; Timer functions should not change the current buffer.
323 (when (and retrigger 323 ;; If they do, all kinds of nasty surprises can happen,
324 ;; If the timer's been canceled, don't "retrigger" it 324 ;; and it can be hellish to track down their source.
325 ;; since it might still be in the copy of timer-list kept 325 (save-current-buffer
326 ;; by keyboard.c:timer_check (bug#14156). 326 (apply (timer--function timer) (timer--args timer)))
327 (memq timer timer-list)) 327 (error (message "Error running timer%s: %S"
328 (setf (timer--triggered timer) nil))))) 328 (if (symbolp (timer--function timer))
329 (format " `%s'" (timer--function timer)) "")
330 err)))
331 (when (and retrigger
332 ;; If the timer's been canceled, don't "retrigger" it
333 ;; since it might still be in the copy of timer-list kept
334 ;; by keyboard.c:timer_check (bug#14156).
335 (memq timer timer-list))
336 (setf (timer--triggered timer) nil))))))
329 337
330;; This function is incompatible with the one in levents.el. 338;; This function is incompatible with the one in levents.el.
331(defun timeout-event-p (event) 339(defun timeout-event-p (event)
diff --git a/lisp/frame.el b/lisp/frame.el
index f081df788ec..5e9b5351005 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1107,10 +1107,10 @@ number of lines and columns.
1107 1107
1108If FRAMES is nil, apply the font to the selected frame only. 1108If FRAMES is nil, apply the font to the selected frame only.
1109If FRAMES is non-nil, it should be a list of frames to act upon, 1109If FRAMES is non-nil, it should be a list of frames to act upon,
1110or t meaning all graphical frames. Also, if FRAME is non-nil, 1110or t meaning all existing graphical frames.
1111alter the user's Customization settings as though the 1111Also, if FRAMES is non-nil, alter the user's Customization settings
1112font-related attributes of the `default' face had been \"set in 1112as though the font-related attributes of the `default' face had been
1113this session\", so that the font is applied to future frames." 1113\"set in this session\", so that the font is applied to future frames."
1114 (interactive 1114 (interactive
1115 (let* ((completion-ignore-case t) 1115 (let* ((completion-ignore-case t)
1116 (font (completing-read "Font name: " 1116 (font (completing-read "Font name: "
@@ -1822,9 +1822,7 @@ terminals, cursor blinking is controlled by the terminal."
1822 :initialize 'custom-initialize-delay 1822 :initialize 'custom-initialize-delay
1823 :group 'cursor 1823 :group 'cursor
1824 :global t 1824 :global t
1825 (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) 1825 (blink-cursor-suspend)
1826 (setq blink-cursor-idle-timer nil)
1827 (blink-cursor-end)
1828 (remove-hook 'focus-in-hook #'blink-cursor-check) 1826 (remove-hook 'focus-in-hook #'blink-cursor-check)
1829 (remove-hook 'focus-out-hook #'blink-cursor-suspend) 1827 (remove-hook 'focus-out-hook #'blink-cursor-suspend)
1830 (when blink-cursor-mode 1828 (when blink-cursor-mode
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index 51c8c3c3d7e..d3b8a2cf6c5 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -715,7 +715,7 @@ string). It returns t if a new completion is found, nil otherwise."
715 715
716(defun he-line-search-regexp (pat strip-prompt) 716(defun he-line-search-regexp (pat strip-prompt)
717 (if strip-prompt 717 (if strip-prompt
718 (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\(" 718 (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\(?2:"
719 (regexp-quote pat) 719 (regexp-quote pat)
720 "[^\n]*[^ \t\n]\\)") 720 "[^\n]*[^ \t\n]\\)")
721 (concat "^\\(\\s-*\\)\\(" 721 (concat "^\\(\\s-*\\)\\("
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 436d8f611a8..f9cbc62b464 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -662,7 +662,7 @@ by \"Save Options\" in Custom buffers.")
662;; Function for setting/saving default font. 662;; Function for setting/saving default font.
663 663
664(defun menu-set-font () 664(defun menu-set-font ()
665 "Interactively select a font and make it the default." 665 "Interactively select a font and make it the default on all existing frames."
666 (interactive) 666 (interactive)
667 (set-frame-font (if (fboundp 'x-select-font) 667 (set-frame-font (if (fboundp 'x-select-font)
668 (x-select-font) 668 (x-select-font)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2f898fa1ba5..cfff1533e48 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -529,7 +529,7 @@ for use at QPOS."
529 (let* ((qpos pred) 529 (let* ((qpos pred)
530 (ustring (funcall unquote string)) 530 (ustring (funcall unquote string))
531 (uprefix (funcall unquote (substring string 0 qpos))) 531 (uprefix (funcall unquote (substring string 0 qpos)))
532 ;; FIXME: we really should pass `qpos' to `unuote' and have that 532 ;; FIXME: we really should pass `qpos' to `unquote' and have that
533 ;; function give us the corresponding `uqpos'. But for now we 533 ;; function give us the corresponding `uqpos'. But for now we
534 ;; presume (more or less) that `concat' and `unquote' commute. 534 ;; presume (more or less) that `concat' and `unquote' commute.
535 (uqpos (if (string-prefix-p uprefix ustring) 535 (uqpos (if (string-prefix-p uprefix ustring)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index ca94a343c1a..15f89291af9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -26,8 +26,6 @@
26;; This package provides various useful commands (including help 26;; This package provides various useful commands (including help
27;; system access) through the mouse. All this code assumes that mouse 27;; system access) through the mouse. All this code assumes that mouse
28;; interpretation has been abstracted into Emacs input events. 28;; interpretation has been abstracted into Emacs input events.
29;;
30;; The code is rather X-dependent.
31 29
32;;; Code: 30;;; Code:
33 31
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 4d146a33248..7f230a9d2ab 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -277,6 +277,8 @@ object is returned instead of a list containing this single Lisp object.
277 277
278 => \"i686\"" 278 => \"i686\""
279 279
280 (or (featurep 'dbusbind)
281 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
280 (or (memq bus '(:system :session)) (stringp bus) 282 (or (memq bus '(:system :session)) (stringp bus)
281 (signal 'wrong-type-argument (list 'keywordp bus))) 283 (signal 'wrong-type-argument (list 'keywordp bus)))
282 (or (stringp service) 284 (or (stringp service)
@@ -380,6 +382,8 @@ Example:
380 382
381 -| i686" 383 -| i686"
382 384
385 (or (featurep 'dbusbind)
386 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
383 (or (memq bus '(:system :session)) (stringp bus) 387 (or (memq bus '(:system :session)) (stringp bus)
384 (signal 'wrong-type-argument (list 'keywordp bus))) 388 (signal 'wrong-type-argument (list 'keywordp bus)))
385 (or (stringp service) 389 (or (stringp service)
@@ -428,6 +432,8 @@ Example:
428 :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\" 432 :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\"
429 \"FileModified\" \"/home/albinus/.emacs\")" 433 \"FileModified\" \"/home/albinus/.emacs\")"
430 434
435 (or (featurep 'dbusbind)
436 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
431 (or (memq bus '(:system :session)) (stringp bus) 437 (or (memq bus '(:system :session)) (stringp bus)
432 (signal 'wrong-type-argument (list 'keywordp bus))) 438 (signal 'wrong-type-argument (list 'keywordp bus)))
433 (or (null service) (stringp service) 439 (or (null service) (stringp service)
@@ -446,6 +452,8 @@ Example:
446 "Return for message SERIAL on the D-Bus BUS. 452 "Return for message SERIAL on the D-Bus BUS.
447This is an internal function, it shall not be used outside dbus.el." 453This is an internal function, it shall not be used outside dbus.el."
448 454
455 (or (featurep 'dbusbind)
456 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
449 (or (memq bus '(:system :session)) (stringp bus) 457 (or (memq bus '(:system :session)) (stringp bus)
450 (signal 'wrong-type-argument (list 'keywordp bus))) 458 (signal 'wrong-type-argument (list 'keywordp bus)))
451 (or (stringp service) 459 (or (stringp service)
@@ -460,6 +468,8 @@ This is an internal function, it shall not be used outside dbus.el."
460 "Return error message for message SERIAL on the D-Bus BUS. 468 "Return error message for message SERIAL on the D-Bus BUS.
461This is an internal function, it shall not be used outside dbus.el." 469This is an internal function, it shall not be used outside dbus.el."
462 470
471 (or (featurep 'dbusbind)
472 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
463 (or (memq bus '(:system :session)) (stringp bus) 473 (or (memq bus '(:system :session)) (stringp bus)
464 (signal 'wrong-type-argument (list 'keywordp bus))) 474 (signal 'wrong-type-argument (list 'keywordp bus)))
465 (or (stringp service) 475 (or (stringp service)
@@ -1763,6 +1773,8 @@ connection used in the same Emacs process, like the one established by
1763GTK+. It should be used with care for at least the `:system' and 1773GTK+. It should be used with care for at least the `:system' and
1764`:session' buses, because other Emacs Lisp packages might already use 1774`:session' buses, because other Emacs Lisp packages might already use
1765this connection to those buses." 1775this connection to those buses."
1776 (or (featurep 'dbusbind)
1777 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
1766 (dbus--init-bus bus private) 1778 (dbus--init-bus bus private)
1767 (dbus-register-signal 1779 (dbus-register-signal
1768 bus nil dbus-path-local dbus-interface-local 1780 bus nil dbus-path-local dbus-interface-local
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 900e1c812ae..15aa1329817 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4137,7 +4137,7 @@ Goes through the list `tramp-local-coding-commands' and
4137 tmpfile) 4137 tmpfile)
4138 (while (string-match (regexp-quote "-") name) 4138 (while (string-match (regexp-quote "-") name)
4139 (setq name (replace-match "_" nil t name))) 4139 (setq name (replace-match "_" nil t name)))
4140 (when (string-match "%t" value) 4140 (when (string-match "\\(^\\|[^%]\\)%t" value)
4141 (setq tmpfile 4141 (setq tmpfile
4142 (make-temp-name 4142 (make-temp-name
4143 (expand-file-name 4143 (expand-file-name
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index cd50bce2152..b3ce7aaac25 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -2630,8 +2630,9 @@ With a prefix argument, inserts the character directly."
2630(put 'entity-ref 'nxml-friendly-name "entity reference") 2630(put 'entity-ref 'nxml-friendly-name "entity reference")
2631(put 'char-ref 'nxml-friendly-name "character reference") 2631(put 'char-ref 'nxml-friendly-name "character reference")
2632 2632
2633;;;###autoload 2633;; Only do this in loaddefs, so that if someone defines a different
2634(defalias 'xml-mode 'nxml-mode) 2634;; alias in .emacs, loading this file afterwards does not clobber it.
2635;;;###autoload(defalias 'xml-mode 'nxml-mode)
2635 2636
2636(provide 'nxml-mode) 2637(provide 'nxml-mode)
2637 2638
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index 14f8dd65083..c47a3bd6fbe 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -99,7 +99,7 @@
99 (modify-syntax-entry ?\( "() " st) 99 (modify-syntax-entry ?\( "() " st)
100 (modify-syntax-entry ?\) ")( " st) 100 (modify-syntax-entry ?\) ")( " st)
101 ;; It's used for single-line comments as well as for #;(...) sexp-comments. 101 ;; It's used for single-line comments as well as for #;(...) sexp-comments.
102 (modify-syntax-entry ?\; "< 2 " st) 102 (modify-syntax-entry ?\; "<" st)
103 (modify-syntax-entry ?\" "\" " st) 103 (modify-syntax-entry ?\" "\" " st)
104 (modify-syntax-entry ?' "' " st) 104 (modify-syntax-entry ?' "' " st)
105 (modify-syntax-entry ?` "' " st) 105 (modify-syntax-entry ?` "' " st)
@@ -147,19 +147,15 @@
147 (setq-local lisp-indent-function 'scheme-indent-function) 147 (setq-local lisp-indent-function 'scheme-indent-function)
148 (setq mode-line-process '("" scheme-mode-line-process)) 148 (setq mode-line-process '("" scheme-mode-line-process))
149 (setq-local imenu-case-fold-search t) 149 (setq-local imenu-case-fold-search t)
150 (setq imenu-generic-expression scheme-imenu-generic-expression) 150 (setq-local imenu-generic-expression scheme-imenu-generic-expression)
151 (setq-local imenu-syntax-alist 151 (setq-local imenu-syntax-alist '(("+-*/.<>=?!$%_&~^:" . "w")))
152 '(("+-*/.<>=?!$%_&~^:" . "w"))) 152 (setq-local syntax-propertize-function #'scheme-syntax-propertize)
153 (setq font-lock-defaults 153 (setq font-lock-defaults
154 '((scheme-font-lock-keywords 154 '((scheme-font-lock-keywords
155 scheme-font-lock-keywords-1 scheme-font-lock-keywords-2) 155 scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
156 nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14")) 156 nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
157 beginning-of-defun 157 beginning-of-defun
158 (font-lock-mark-block-function . mark-defun) 158 (font-lock-mark-block-function . mark-defun)))
159 (font-lock-syntactic-face-function
160 . scheme-font-lock-syntactic-face-function)
161 (parse-sexp-lookup-properties . t)
162 (font-lock-extra-managed-props syntax-table)))
163 (setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt)) 159 (setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt))
164 160
165(defvar scheme-mode-line-process "") 161(defvar scheme-mode-line-process "")
@@ -354,28 +350,28 @@ See `run-hooks'."
354 (forward-comment (point-max)) 350 (forward-comment (point-max))
355 (if (eq (char-after) ?\() 2 0))) 351 (if (eq (char-after) ?\() 2 0)))
356 352
357(defun scheme-font-lock-syntactic-face-function (state) 353(defun scheme-syntax-propertize (beg end)
358 (when (and (null (nth 3 state)) 354 (goto-char beg)
359 (eq (char-after (nth 8 state)) ?#) 355 (scheme-syntax-propertize-sexp-comment (point) end)
360 (eq (char-after (1+ (nth 8 state))) ?\;)) 356 (funcall
361 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends. 357 (syntax-propertize-rules
362 (save-excursion 358 ("\\(#\\);" (1 (prog1 "< cn"
363 (let ((pos (point)) 359 (scheme-syntax-propertize-sexp-comment (point) end)))))
364 (end 360 (point) end))
365 (condition-case err 361
366 (let ((parse-sexp-lookup-properties nil)) 362(defun scheme-syntax-propertize-sexp-comment (_ end)
367 (goto-char (+ 2 (nth 8 state))) 363 (let ((state (syntax-ppss)))
368 ;; FIXME: this doesn't handle the case where the sexp 364 (when (eq 2 (nth 7 state))
369 ;; itself contains a #; comment. 365 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
370 (forward-sexp 1) 366 (condition-case nil
371 (point)) 367 (progn
372 (scan-error (nth 2 err))))) 368 (goto-char (+ 2 (nth 8 state)))
373 (when (< pos (- end 2)) 369 ;; FIXME: this doesn't handle the case where the sexp
374 (put-text-property pos (- end 2) 370 ;; itself contains a #; comment.
375 'syntax-table scheme-sexp-comment-syntax-table)) 371 (forward-sexp 1)
376 (put-text-property (- end 1) end 'syntax-table '(12))))) 372 (put-text-property (1- (point)) (point)
377 ;; Choose the face to use. 373 'syntax-table (string-to-syntax "> cn")))
378 (lisp-font-lock-syntactic-face-function state)) 374 (scan-error (goto-char end))))))
379 375
380;;;###autoload 376;;;###autoload
381(define-derived-mode dsssl-mode scheme-mode "DSSSL" 377(define-derived-mode dsssl-mode scheme-mode "DSSSL"
diff --git a/lisp/simple.el b/lisp/simple.el
index af8e47c2383..e5b0203866c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5069,7 +5069,15 @@ When the `track-eol' feature is doing its job, the value is
5069`most-positive-fixnum'.") 5069`most-positive-fixnum'.")
5070 5070
5071(defcustom line-move-ignore-invisible t 5071(defcustom line-move-ignore-invisible t
5072 "Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. 5072 "Non-nil means commands that move by lines ignore invisible newlines.
5073When this option is non-nil, \\[next-line], \\[previous-line], \\[move-end-of-line], and \\[move-beginning-of-line] behave
5074as if newlines that are invisible didn't exist, and count
5075only visible newlines. Thus, moving across across 2 newlines
5076one of which is invisible will be counted as a one-line move.
5077Also, a non-nil value causes invisible text to be ignored when
5078counting columns for the purposes of keeping point in the same
5079column by \\[next-line] and \\[previous-line].
5080
5073Outline mode sets this." 5081Outline mode sets this."
5074 :type 'boolean 5082 :type 'boolean
5075 :group 'editing-basics) 5083 :group 'editing-basics)
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 703b46eb113..6b064260f95 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -886,10 +886,9 @@ and CVS."
886 (minor-num (string-to-number (vc-rcs-minor-part rev)))) 886 (minor-num (string-to-number (vc-rcs-minor-part rev))))
887 (concat branch "." (number-to-string (1+ minor-num)))))) 887 (concat branch "." (number-to-string (1+ minor-num))))))
888 888
889;; Note that most GNU/Linux distributions seem to supply rcs2log in a 889;; You might think that this should be distributed with RCS, but
890;; standard bin directory. Eg both Red Hat and Debian include it in 890;; apparently not. CVS sometimes provides a version of it.
891;; their cvs packages. It's not obvious why Emacs still needs to 891;; http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00288.html
892;; provide it as well...
893(defvar vc-rcs-rcs2log-program 892(defvar vc-rcs-rcs2log-program
894 (let (exe) 893 (let (exe)
895 (cond ((file-executable-p 894 (cond ((file-executable-p
diff --git a/lisp/window.el b/lisp/window.el
index 60f13e65c4e..c5093ca51a5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1079,7 +1079,6 @@ WINDOW-OR-FRAME can be a frame or a window and defaults to the
1079selected frame. When WINDOW-OR-FRAME is a window, dump that 1079selected frame. When WINDOW-OR-FRAME is a window, dump that
1080window's frame. The buffer *window-frame-dump* is erased before 1080window's frame. The buffer *window-frame-dump* is erased before
1081dumping to it." 1081dumping to it."
1082 (interactive)
1083 (let* ((window 1082 (let* ((window
1084 (cond 1083 (cond
1085 ((or (not window-or-frame) 1084 ((or (not window-or-frame)
@@ -1102,7 +1101,9 @@ dumping to it."
1102 (frame-text-width frame) (frame-text-height frame) 1101 (frame-text-width frame) (frame-text-height frame)
1103 (frame-text-cols frame) (frame-text-lines frame)) 1102 (frame-text-cols frame) (frame-text-lines frame))
1104 (format "tool: %s scroll: %s fringe: %s border: %s right: %s bottom: %s\n\n" 1103 (format "tool: %s scroll: %s fringe: %s border: %s right: %s bottom: %s\n\n"
1105 (tool-bar-height frame t) 1104 (if (fboundp 'tool-bar-height)
1105 (tool-bar-height frame t)
1106 "0")
1106 (frame-scroll-bar-width frame) 1107 (frame-scroll-bar-width frame)
1107 (frame-fringe-width frame) 1108 (frame-fringe-width frame)
1108 (frame-border-width frame) 1109 (frame-border-width frame)