From 5da5370cc7d0839051caf134ef4e077d649002ae Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 21 Jul 2014 02:18:01 -0400 Subject: [PATCH 01/17] NEWS copyedit --- etc/NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index b1524151cc8..654160c4a7a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -673,7 +673,7 @@ along with the non-SMIE indentation code. ** Python mode *** Out of the box support for CPython, iPython and readline based shells. -**** `python-shell-completion-module-string-code` is no longer used. +**** `python-shell-completion-module-string-code' is no longer used. *** Automatic shell prompt detection. New user options: **** `python-shell-interpreter-interactive-arg'. From ad4c5263f5d597ff181d85ecef01b4af29c16cda Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 21 Jul 2014 07:41:19 -0700 Subject: [PATCH 02/17] Spelling fixes. --- lisp/ChangeLog | 8 ++++---- lisp/progmodes/python.el | 2 +- test/automated/python-tests.el | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c6e7543c29..7c19f7fb665 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -59,9 +59,9 @@ (python-shell-prompt-detect) (python-shell-prompt-validate-regexps): New functions. (python-shell-prompt-set-calculated-regexps): New function. - (inferior-python-mode): Use it. Also honor overriden + (inferior-python-mode): Use it. Also honor overridden python-shell-interpreter and python-shell-interpreter-args. - (python-shell-make-comint): Honor overriden + (python-shell-make-comint): Honor overridden python-shell-interpreter and python-shell-interpreter-args. (python-shell-get-or-create-process): Make it testable by allowing to call run-python non-interactively. @@ -1042,9 +1042,9 @@ * faces.el (face-spec-recalc): Apply X resources only after the defface spec has been applied. Thus, X resources are no longer - overriden by the defface spec which also fixes issues on win32 where + overridden by the defface spec which also fixes issues on win32 where the toolbar coloring was wrong because it is set through X resources - and was (wrongfully) overriden. (Bug#16694) + and was (wrongfully) overridden. (Bug#16694) 2014-04-28 Stefan Monnier diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 86970b8a0c7..b104518d5f7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2215,7 +2215,7 @@ killed." interpreter nil args)) (python-shell--parent-buffer (current-buffer)) (process (get-buffer-process buffer)) - ;; As the user may have overriden default values for + ;; As the user may have overridden default values for ;; these vars on `run-python', let-binding them allows ;; to have the new right values in all setup code ;; that's is done in `inferior-python-mode', which is diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index 81f4567091e..e1eaeea2c38 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el @@ -1807,7 +1807,7 @@ Using `python-shell-interpreter' and (kill-buffer shell-buffer)))) (ert-deftest python-shell-make-comint-3 () - "Check comint creation with overriden python interpreter and args. + "Check comint creation with overridden python interpreter and args. The command passed to `python-shell-make-comint' as argument must locally override global values set in `python-shell-interpreter' and `python-shell-interpreter-args' in the new shell buffer." From 37a21453db134292b99291226d541df838e7d711 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Tue, 22 Jul 2014 23:32:04 +0200 Subject: [PATCH 03/17] * calendar/todo-mode.el (todo-set-top-priorities): Fix overwriting of file-wide setting when changing category-wide setting. --- lisp/ChangeLog | 5 +++++ lisp/calendar/todo-mode.el | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7c19f7fb665..02189365b4f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-22 Stephen Berman + + * calendar/todo-mode.el (todo-set-top-priorities): Fix overwriting + of file-wide setting when changing category-wide setting. + 2014-07-21 Glenn Morris * progmodes/hideif.el (hide-ifdef-mode-submap): diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index d8bca81ed9b..e5f486a2056 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -4283,24 +4283,25 @@ set the user customizable option `todo-top-priorities-overrides'." (frule (assoc-string file rules)) (crules (nth 2 frule)) (crule (assoc-string cat crules)) - (cur (or (and arg (cdr crule)) - (nth 1 frule) - todo-top-priorities)) + (fcur (or (nth 1 frule) + todo-top-priorities)) + (ccur (or (and arg (cdr crule)) + fcur)) (prompt (if arg (concat "Number of top priorities in this category" " (currently %d): ") (concat "Default number of top priorities per category" " in this file (currently %d): "))) (new -1)) (while (< new 0) - (let ((cur0 cur)) - (setq new (read-number (format prompt cur0)) + (let ((cur (if arg ccur fcur))) + (setq new (read-number (format prompt cur)) prompt "Enter a non-negative number: " - cur0 nil))) + cur nil))) (let ((nrule (if arg (append (delete crule crules) (list (cons cat new))) (append (list file new) (list crules))))) (setq rules (cons (if arg - (list file cur nrule) + (list file fcur nrule) nrule) (delete frule rules))) (customize-save-variable 'todo-top-priorities-overrides rules) From 25aa0da588f2afb629e6b42612ccc8925da41a46 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 25 Jul 2014 04:24:00 -0400 Subject: [PATCH 04/17] prolog.el: Fix for missing `switch-to-prolog' Ref: http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00228.html * lisp/progmodes/prolog.el (prolog-mode-keybindings-edit): Replace missing `switch-to-prolog' with `run-prolog'. (switch-to-prolog): Define as (obsolete) alias, as in 23.4. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/prolog.el | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 02189365b4f..ed9801b4101 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-07-25 Glenn Morris + + * progmodes/prolog.el (prolog-mode-keybindings-edit): + Replace missing `switch-to-prolog' with `run-prolog'. + (switch-to-prolog): Define as (obsolete) alias, as in 23.4. + 2014-07-22 Stephen Berman * calendar/todo-mode.el (todo-set-top-priorities): Fix overwriting diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index bcac59a3ade..07d88b3f0fb 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -1079,7 +1079,7 @@ VERSION is of the format (Major . Minor)" ;; Inherited from the old prolog.el. (define-key map "\e\C-x" 'prolog-consult-region) (define-key map "\C-c\C-l" 'prolog-consult-file) - (define-key map "\C-c\C-z" 'switch-to-prolog)) + (define-key map "\C-c\C-z" 'run-prolog)) (defun prolog-mode-keybindings-inferior (_map) "Define keybindings for inferior Prolog mode in MAP." @@ -1240,6 +1240,8 @@ To find out what version of Prolog mode you are running, enter ((string-match "\\`[rf] *[0-9]*\\'" str) nil) ;r(edo) or f(ail) (t t))) +;; This statement was missing in Emacs 24.1, 24.2, 24.3. +(define-obsolete-function-alias 'switch-to-prolog 'run-prolog "24.1") ;;;###autoload (defun run-prolog (arg) "Run an inferior Prolog process, input and output via buffer *prolog*. From 59bb37859d1a64518fca9bfe80c57eba862f905f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 25 Jul 2014 05:24:53 -0400 Subject: [PATCH 05/17] More toggle-read-only doc tweaks * lisp/files.el (toggle-read-only): Re-add basic doc-string. * lisp/vc/vc-hooks.el (vc-toggle-read-only): Tweak obsolescence mesage. --- lisp/ChangeLog | 3 +++ lisp/files.el | 1 + lisp/vc/vc-hooks.el | 11 +++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed9801b4101..c2bdbdebab6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-07-25 Glenn Morris + * files.el (toggle-read-only): Re-add basic doc-string. + * vc/vc-hooks.el (vc-toggle-read-only): Tweak obsolescence mesage. + * progmodes/prolog.el (prolog-mode-keybindings-edit): Replace missing `switch-to-prolog' with `run-prolog'. (switch-to-prolog): Define as (obsolete) alias, as in 23.4. diff --git a/lisp/files.el b/lisp/files.el index a5cee47ee8a..6c3b8f4fa4d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5012,6 +5012,7 @@ prints a message in the minibuffer. Instead, use `set-buffer-modified-p'." (set-buffer-modified-p arg)) (defun toggle-read-only (&optional arg interactive) + "Change whether this buffer is read-only." (declare (obsolete read-only-mode "24.3")) (interactive (list current-prefix-arg t)) (if interactive diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 1cd297ae43a..8151e43a9f1 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -628,8 +628,15 @@ this function." (throw 'found trial)))) templates)))) -(define-obsolete-function-alias - 'vc-toggle-read-only 'toggle-read-only "24.1") + +;; toggle-read-only is obsolete since 24.3, but since vc-t-r-o was made +;; obsolete earlier, it is ok for the latter to be an alias to the former, +;; since the latter will be removed first. We can't just make it +;; an alias for read-only-mode, since that is not 100% the same. +(defalias 'vc-toggle-read-only 'toggle-read-only) +(make-obsolete 'vc-toggle-read-only + "use `read-only-mode' instead (or `toggle-read-only' in older version of Emacs)." + "24.1") (defun vc-default-make-version-backups-p (_backend _file) "Return non-nil if unmodified versions should be backed up locally. From c509a535a86acc8efc13df4d379ec09ef3659287 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 25 Jul 2014 06:05:10 -0400 Subject: [PATCH 06/17] vc-hooks.el: Fix doc typo in previous --- lisp/vc/vc-hooks.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 8151e43a9f1..fb10edca06d 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -635,7 +635,7 @@ this function." ;; an alias for read-only-mode, since that is not 100% the same. (defalias 'vc-toggle-read-only 'toggle-read-only) (make-obsolete 'vc-toggle-read-only - "use `read-only-mode' instead (or `toggle-read-only' in older version of Emacs)." + "use `read-only-mode' instead (or `toggle-read-only' in older versions of Emacs)." "24.1") (defun vc-default-make-version-backups-p (_backend _file) From 6dd006a86d401a494efd48a31c5fe6e511e42b52 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Fri, 25 Jul 2014 18:01:05 +0200 Subject: [PATCH 07/17] Fix code and doc involving marked items. * todo-mode.texi (Marked Items): Correct omission of item deletion from commands applying to both todo and done items. * calendar/todo-mode.el: Fix handling of marked items and make minor code improvements. (todo-edit-item): If there are marked items, ensure user can only invoke editing commands that work with marked items. (todo-edit-item--text): When there are marked items, make it a noop if invoked with point not on an item; otherwise, ensure it applies only to item at point. (todo-item-undone): If there are marked not-done items, return point to its original position before signaling user error. (todo--user-error-if-marked-done-item): New function. (todo-edit-item--header, todo-edit-item--diary-inclusion) (todo-item-done): Use it. --- doc/misc/ChangeLog | 5 + doc/misc/todo-mode.texi | 9 +- lisp/ChangeLog | 15 ++ lisp/calendar/todo-mode.el | 293 ++++++++++++++++++++----------------- 4 files changed, 182 insertions(+), 140 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 84dea26ca32..0ad35d3803a 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2014-07-25 Stephen Berman + + * todo-mode.texi (Marked Items): Correct omission of item deletion + from commands applying to both todo and done items. + 2014-07-04 Stephen Berman * todo-mode.texi (Levels of Organization): Comment out statement diff --git a/doc/misc/todo-mode.texi b/doc/misc/todo-mode.texi index 092137268f7..9b0ec6e85a3 100644 --- a/doc/misc/todo-mode.texi +++ b/doc/misc/todo-mode.texi @@ -1323,10 +1323,11 @@ If you use @kbd{m}, @kbd{d}, @kbd{A d} or @kbd{u} on multiple noncontiguous marked items, the relocated items retain their relative order but are now listed consecutively en bloc. -You can mark both todo and done items, but note that only @kbd{m} can apply -to both; other commands only affect either marked todo or marked done -items, so if both types of items are marked, invoking these commands -has no effect and informs you of your erroneous attempt. +You can mark both todo and done items, but note that only @kbd{m} and +@kbd{k} can apply to both; other commands only affect either marked +todo or marked done items, so if both types of items are marked, +invoking these commands has no effect and informs you of your +erroneous attempt. @node Todo Categories Mode, Searching for Items, Marked Items, Top @chapter Todo Categories Mode diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c2bdbdebab6..7869bee211c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2014-07-25 Stephen Berman + + * calendar/todo-mode.el: Fix handling of marked items and make + minor code improvements. + (todo-edit-item): If there are marked items, ensure user can only + invoke editing commands that work with marked items. + (todo-edit-item--text): When there are marked items, make it a + noop if invoked with point not on an item; otherwise, ensure it + applies only to item at point. + (todo-item-undone): If there are marked not-done items, return + point to its original position before signaling user error. + (todo--user-error-if-marked-done-item): New function. + (todo-edit-item--header, todo-edit-item--diary-inclusion) + (todo-item-done): Use it. + 2014-07-25 Glenn Morris * files.el (toggle-read-only): Re-add basic doc-string. diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index e5f486a2056..60f798792d1 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -2068,85 +2068,101 @@ the item at point." (defun todo-edit-item (&optional arg) "Choose an editing operation for the current item and carry it out." (interactive "P") - (cond ((todo-done-item-p) - (todo-edit-item--next-key todo-edit-done-item--param-key-alist)) - ((todo-item-string) - (todo-edit-item--next-key todo-edit-item--param-key-alist arg)))) + (let ((marked (assoc (todo-current-category) todo-categories-with-marks))) + (cond ((and (todo-done-item-p) (not marked)) + (todo-edit-item--next-key todo-edit-done-item--param-key-alist)) + ((or marked (todo-item-string)) + (todo-edit-item--next-key todo-edit-item--param-key-alist arg))))) (defun todo-edit-item--text (&optional arg) "Function providing the text editing facilities of `todo-edit-item'." - (let* ((opoint (point)) - (start (todo-item-start)) - (end (save-excursion (todo-item-end))) - (item-beg (progn - (re-search-forward - (concat todo-date-string-start todo-date-pattern - "\\( " diary-time-regexp "\\)?" - (regexp-quote todo-nondiary-end) "?") - (line-end-position) t) - (1+ (- (point) start)))) - (include-header (eq arg 'include-header)) - (comment-edit (eq arg 'comment-edit)) - (comment-delete (eq arg 'comment-delete)) - (header-string (substring (todo-item-string) 0 item-beg)) - (item (if (or include-header comment-edit comment-delete) - (todo-item-string) - (substring (todo-item-string) item-beg))) - (multiline (> (length (split-string item "\n")) 1)) - (comment (save-excursion - (todo-item-start) - (re-search-forward - (concat " \\[" (regexp-quote todo-comment-string) - ": \\([^]]+\\)\\]") end t))) - (prompt (if comment "Edit comment: " "Enter a comment: ")) - (buffer-read-only nil)) - (cond - ((or comment-edit comment-delete) - (save-excursion - (todo-item-start) - (if (re-search-forward (concat " \\[" (regexp-quote todo-comment-string) - ": \\([^]]+\\)\\]") end t) - (if comment-delete - (when (todo-y-or-n-p "Delete comment? ") - (delete-region (match-beginning 0) (match-end 0))) - (replace-match (read-string prompt (cons (match-string 1) 1)) - nil nil nil 1)) - (if comment-delete - (user-error "There is no comment to delete") - (insert " [" todo-comment-string ": " - (prog1 (read-string prompt) - ;; If user moved point during editing, - ;; make sure it moves back. - (goto-char opoint) - (todo-item-end)) - "]"))))) - ((or multiline (eq arg 'multiline)) - (let ((buf todo-edit-buffer)) - (set-window-buffer (selected-window) - (set-buffer (make-indirect-buffer (buffer-name) buf))) - (narrow-to-region (todo-item-start) (todo-item-end)) - (todo-edit-mode) - (message "%s" (substitute-command-keys - (concat "Type \\[todo-edit-quit] " - "to return to Todo mode.\n"))))) - (t - (let ((new (concat (if include-header "" header-string) - (read-string "Edit: " (if include-header - (cons item item-beg) - (cons item 0)))))) - (when include-header - (while (not (string-match (concat todo-date-string-start - todo-date-pattern) new)) - (setq new (read-from-minibuffer - "Item must start with a date: " new)))) - ;; Ensure lines following hard newlines are indented. - (setq new (replace-regexp-in-string "\\(\n\\)[^[:blank:]]" - "\n\t" new nil nil 1)) - ;; If user moved point during editing, make sure it moves back. - (goto-char opoint) - (todo-remove-item) - (todo-insert-with-overlays new) - (move-to-column item-beg)))))) + (let ((full-item (todo-item-string))) + ;; If there are marked items and user invokes a text-editing + ;; commands with point not on an item, todo-item-start is nil and + ;; 1+ signals an error, so just make this a noop. + (when full-item + (let* ((opoint (point)) + (start (todo-item-start)) + (end (save-excursion (todo-item-end))) + (item-beg (progn + (re-search-forward + (concat todo-date-string-start todo-date-pattern + "\\( " diary-time-regexp "\\)?" + (regexp-quote todo-nondiary-end) "?") + (line-end-position) t) + (1+ (- (point) start)))) + (include-header (eq arg 'include-header)) + (comment-edit (eq arg 'comment-edit)) + (comment-delete (eq arg 'comment-delete)) + (header-string (substring full-item 0 item-beg)) + (item (if (or include-header comment-edit comment-delete) + full-item + (substring full-item item-beg))) + (multiline (or (eq arg 'multiline) + (> (length (split-string item "\n")) 1))) + (comment (save-excursion + (todo-item-start) + (re-search-forward + (concat " \\[" (regexp-quote todo-comment-string) + ": \\([^]]+\\)\\]") end t))) + (prompt (if comment "Edit comment: " "Enter a comment: ")) + (buffer-read-only nil)) + ;; When there are marked items, user can invoke todo-edit-item + ;; even if point is not on an item, but text editing only + ;; applies to the item at point. + (when (or (and (todo-done-item-p) + (or comment-edit comment-delete)) + (and (not (todo-done-item-p)) + (or (not arg) include-header multiline))) + (cond + ((or comment-edit comment-delete) + (save-excursion + (todo-item-start) + (if (re-search-forward (concat " \\[" + (regexp-quote todo-comment-string) + ": \\([^]]+\\)\\]") end t) + (if comment-delete + (when (todo-y-or-n-p "Delete comment? ") + (delete-region (match-beginning 0) (match-end 0))) + (replace-match (read-string prompt (cons (match-string 1) 1)) + nil nil nil 1)) + (if comment-delete + (user-error "There is no comment to delete") + (insert " [" todo-comment-string ": " + (prog1 (read-string prompt) + ;; If user moved point during editing, + ;; make sure it moves back. + (goto-char opoint) + (todo-item-end)) + "]"))))) + (multiline + (let ((buf todo-edit-buffer)) + (set-window-buffer (selected-window) + (set-buffer (make-indirect-buffer + (buffer-name) buf))) + (narrow-to-region (todo-item-start) (todo-item-end)) + (todo-edit-mode) + (message "%s" (substitute-command-keys + (concat "Type \\[todo-edit-quit] " + "to return to Todo mode.\n"))))) + (t + (let ((new (concat (if include-header "" header-string) + (read-string "Edit: " (if include-header + (cons item item-beg) + (cons item 0)))))) + (when include-header + (while (not (string-match (concat todo-date-string-start + todo-date-pattern) new)) + (setq new (read-from-minibuffer + "Item must start with a date: " new)))) + ;; Ensure lines following hard newlines are indented. + (setq new (replace-regexp-in-string "\\(\n\\)[^[:blank:]]" + "\n\t" new nil nil 1)) + ;; If user moved point during editing, make sure it moves back. + (goto-char opoint) + (todo-remove-item) + (todo-insert-with-overlays new) + (move-to-column item-beg))))))))) (defun todo-edit-quit () "Return from Todo Edit mode to Todo mode. @@ -2201,16 +2217,16 @@ made in the number or names of categories." (defun todo-edit-item--header (what &optional inc) "Function providing header editing facilities of `todo-edit-item'." - (let* ((cat (todo-current-category)) - (marked (assoc cat todo-categories-with-marks)) - (first t) - (todo-date-from-calendar t) - ;; INC must be an integer, but users could pass it via - ;; `todo-edit-item' as e.g. `-' or `C-u'. - (inc (prefix-numeric-value inc)) - (buffer-read-only nil) - ndate ntime year monthname month day - dayname) ; Needed by calendar-date-display-form. + (let ((marked (assoc (todo-current-category) todo-categories-with-marks)) + (first t) + (todo-date-from-calendar t) + ;; INC must be an integer, but users could pass it via + ;; `todo-edit-item' as e.g. `-' or `C-u'. + (inc (prefix-numeric-value inc)) + (buffer-read-only nil) + ndate ntime year monthname month day + dayname) ; Needed by calendar-date-display-form. + (when marked (todo--user-error-if-marked-done-item)) (save-excursion (or (and marked (goto-char (point-min))) (todo-item-start)) (catch 'end @@ -2372,47 +2388,45 @@ made in the number or names of categories." (defun todo-edit-item--diary-inclusion (&optional nonmarking) "Function providing diary marking facilities of `todo-edit-item'." (let ((buffer-read-only) - (marked (assoc (todo-current-category) - todo-categories-with-marks))) + (marked (assoc (todo-current-category) todo-categories-with-marks))) + (when marked (todo--user-error-if-marked-done-item)) (catch 'stop (save-excursion (when marked (goto-char (point-min))) (while (not (eobp)) - (if (todo-done-item-p) - (throw 'stop (message "Done items cannot be edited")) - (unless (and marked (not (todo-marked-item-p))) - (let* ((beg (todo-item-start)) - (lim (save-excursion (todo-item-end))) - (end (save-excursion - (or (todo-time-string-matcher lim) - (todo-date-string-matcher lim))))) - (if nonmarking - (if (looking-at (regexp-quote diary-nonmarking-symbol)) - (replace-match "") - (when (looking-at (regexp-quote todo-nondiary-start)) - (save-excursion - (replace-match "") - (search-forward todo-nondiary-end (1+ end) t) - (replace-match "") - (todo-update-count 'diary 1))) - (insert diary-nonmarking-symbol)) - (if (looking-at (regexp-quote todo-nondiary-start)) - (progn + (unless (and marked (not (todo-marked-item-p))) + (let* ((beg (todo-item-start)) + (lim (save-excursion (todo-item-end))) + (end (save-excursion + (or (todo-time-string-matcher lim) + (todo-date-string-matcher lim))))) + (if nonmarking + (if (looking-at (regexp-quote diary-nonmarking-symbol)) + (replace-match "") + (when (looking-at (regexp-quote todo-nondiary-start)) + (save-excursion (replace-match "") (search-forward todo-nondiary-end (1+ end) t) (replace-match "") - (todo-update-count 'diary 1)) - (when end - (when (looking-at (regexp-quote diary-nonmarking-symbol)) - (replace-match "") - (setq end (1- end))) ; Since we deleted nonmarking symbol. - (insert todo-nondiary-start) - (goto-char (1+ end)) - (insert todo-nondiary-end) - (todo-update-count 'diary -1)))))) - (unless marked (throw 'stop nil)) - (todo-forward-item))))) - (todo-update-categories-sexp))) + (todo-update-count 'diary 1))) + (insert diary-nonmarking-symbol)) + (if (looking-at (regexp-quote todo-nondiary-start)) + (progn + (replace-match "") + (search-forward todo-nondiary-end (1+ end) t) + (replace-match "") + (todo-update-count 'diary 1)) + (when end + (when (looking-at (regexp-quote diary-nonmarking-symbol)) + (replace-match "") + (setq end (1- end))) ; Since we deleted nonmarking symbol. + (insert todo-nondiary-start) + (goto-char (1+ end)) + (insert todo-nondiary-end) + (todo-update-count 'diary -1)))))) + (unless marked (throw 'stop nil)) + (todo-forward-item))))) + (todo-update-categories-sexp)) (defun todo-edit-category-diary-inclusion (arg) "Make all items in this category diary items. @@ -2783,21 +2797,7 @@ visible." (interactive "P") (let* ((cat (todo-current-category)) (marked (assoc cat todo-categories-with-marks))) - (when marked - (save-excursion - (save-restriction - (goto-char (point-max)) - (todo-backward-item) - (unless (todo-done-item-p) - (widen) - (unless (re-search-forward - (concat "^" (regexp-quote todo-category-beg)) nil t) - (goto-char (point-max))) - (forward-line -1)) - (while (todo-done-item-p) - (when (todo-marked-item-p) - (user-error "This command does not apply to done items")) - (todo-backward-item))))) + (when marked (todo--user-error-if-marked-done-item)) (unless (and (not marked) (or (todo-done-item-p) ;; Point is between todo and done items. @@ -2885,7 +2885,9 @@ comments without asking." (while (not (eobp)) (when (or (not marked) (and marked (todo-marked-item-p))) (if (not (todo-done-item-p)) - (user-error "Only done items can be undone") + (progn + (goto-char opoint) + (user-error "Only done items can be undone")) (todo-item-start) (unless marked (setq ov (make-overlay (save-excursion (todo-item-start)) @@ -5222,6 +5224,25 @@ Overrides `diary-goto-entry'." (progn (goto-char (point-min)) (looking-at todo-done-string-start))))) +(defun todo--user-error-if-marked-done-item () + "Signal user error on marked done items. +Helper funtion for editing commands that only apply to (possibly +marked) not done todo items." + (save-excursion + (save-restriction + (goto-char (point-max)) + (todo-backward-item) + (unless (todo-done-item-p) + (widen) + (unless (re-search-forward + (concat "^" (regexp-quote todo-category-beg)) nil t) + (goto-char (point-max))) + (forward-line -1)) + (while (todo-done-item-p) + (when (todo-marked-item-p) + (user-error "This command does not apply to done items")) + (todo-backward-item))))) + (defun todo-reset-done-separator (sep) "Replace existing overlays of done items separator string SEP." (save-excursion From e72e6612763d178bc283e8c8ec72325b85aa2384 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Fri, 25 Jul 2014 23:53:52 +0200 Subject: [PATCH 08/17] * calendar/todo-mode.el (todo-edit-item--next-key): If next key is not a character, ignore it instead of raising an error. --- lisp/ChangeLog | 5 +++++ lisp/calendar/todo-mode.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7869bee211c..b1c21261017 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-25 Stephen Berman + + * calendar/todo-mode.el (todo-edit-item--next-key): If next key is + not a character, ignore it instead of raising an error. + 2014-07-25 Stephen Berman * calendar/todo-mode.el: Fix handling of marked items and make diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 60f798792d1..6a857a10fda 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -5551,8 +5551,8 @@ already entered and those still available." '(add/edit delete)) " comment")))) params " ")) - (this-key (char-to-string - (read-key (concat todo-edit-item--prompt p->k)))) + (this-key (let ((key (read-key (concat todo-edit-item--prompt p->k)))) + (and (characterp key) (char-to-string key)))) (this-param (car (rassoc this-key params)))) (pcase this-param (`edit (todo-edit-item--text)) From c734f28e4345a96ab5c4f09e2821e5178ebb0cd0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 26 Jul 2014 16:40:53 +0300 Subject: [PATCH 09/17] Fix bug #18113 with ambiguous wording in etc/DEBUG. etc/DEBUG: Improve wording. --- etc/DEBUG | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/etc/DEBUG b/etc/DEBUG index c1b04eaf7f2..096bdbc48c9 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -7,9 +7,9 @@ See the end of the file for license conditions. [People who debug Emacs on Windows using Microsoft debuggers should read the Windows-specific section near the end of this document.] -** When you debug Emacs with GDB, you should start it in the directory -where the executable was made (the 'src' directory in the Emacs source -tree). That directory has a .gdbinit file that defines various +** When you debug Emacs with GDB, you should start GDB in the directory +where the Emacs executable was made (the 'src' directory in the Emacs +source tree). That directory has a .gdbinit file that defines various "user-defined" commands for debugging Emacs. (These commands are described below under "Examining Lisp object values" and "Debugging Emacs Redisplay problems".) @@ -21,7 +21,9 @@ you will see a warning when GDB starts, like this: warning: File ".../src/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load". There are several ways to overcome that difficulty, they are all -described in the node "Auto-loading safe path" in the GDB user manual. +described in the node "Auto-loading safe path" in the GDB user +manual. If nothing else helps, type "source /path/to/.gdbinit RET" at +the GDB prompt, to unconditionally load the GDB init file. ** When you are trying to analyze failed assertions or backtraces, it is essential to compile Emacs with flags suitable for debugging. From 85bc77b27048dd3d38deedd9f1466523f70237b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Sat, 26 Jul 2014 22:36:48 -0300 Subject: [PATCH 10/17] * lisp/progmodes/python.el (inferior-python-mode): Doc fix. --- lisp/ChangeLog | 4 ++++ lisp/progmodes/python.el | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b1c21261017..b6b49758418 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-07-27 Fabián Ezequiel Gallina + + * progmodes/python.el (inferior-python-mode): Doc fix. + 2014-07-25 Stephen Berman * calendar/todo-mode.el (todo-edit-item--next-key): If next key is diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b104518d5f7..60121ac6b41 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2124,7 +2124,6 @@ interpreter is run. Variables `python-shell-enable-font-lock', `python-shell-completion-setup-code', `python-shell-completion-string-code', -`python-shell-completion-module-string-code', `python-eldoc-setup-code', `python-eldoc-string-code', `python-ffap-setup-code' and `python-ffap-string-code' can customize this mode for different Python interpreters. From fa080fa7053956d20f0f25ed243760062fa83b22 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 27 Jul 2014 09:32:56 +0300 Subject: [PATCH 11/17] src/dispnew.c (allocate_matrices_for_frame_redisplay): Fix typo in a comment. --- src/dispnew.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispnew.c b/src/dispnew.c index 2d137b4abbd..7be4e0b4615 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1639,7 +1639,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, /* Actually change matrices, if allowed. Do not consider CHANGED_LEAF_MATRIX computed above here because the pool - may have been changed which we don't now here. We trust + may have been changed which we don't know here. We trust that we only will be called with DIM_ONLY_P when necessary. */ if (!dim_only_p) From fb2e15326d6757e98e4bc2c61a292bb37f852e90 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 27 Jul 2014 13:38:59 +0200 Subject: [PATCH 12/17] Fixes: debbugs:18117 * textmodes/tex-mode.el (tex-font-lock-verb): Doc fix. --- lisp/ChangeLog | 5 +++++ lisp/textmodes/tex-mode.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b6b49758418..5307a6a496f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-27 Andreas Schwab + + * textmodes/tex-mode.el (tex-font-lock-verb): Doc fix. + (Bug#18117) + 2014-07-27 Fabián Ezequiel Gallina * progmodes/python.el (inferior-python-mode): Doc fix. diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index dce99607074..18843bcd15a 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -808,7 +808,7 @@ Not smaller than the value set by `tex-suscript-height-minimum'." (defvar tex-verbatim-face 'tex-verbatim) (defun tex-font-lock-verb (start delim) - "Place syntax table properties on the \verb construct. + "Place syntax table properties on the \\verb construct. START is the position of the \\ and DELIM is the delimiter char." ;; Do nothing if the \verb construct is itself inside a comment or ;; verbatim env. From 5c2b88050db7f9f05a71938795088f4d5b250f28 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 27 Jul 2014 15:04:29 +0300 Subject: [PATCH 13/17] src/window.c (window_resize_check, window_resize_apply): Fix typos in comments. --- src/window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window.c b/src/window.c index 5e9dd0ec718..5c4e2f97a3b 100644 --- a/src/window.c +++ b/src/window.c @@ -3864,7 +3864,7 @@ window_resize_check (struct window *w, bool horflag) } -/* Set w->pixel_height (w->pixel_height if HORIZONTAL is non-zero) to +/* Set w->pixel_height (w->pixel_width if HORFLAG is non-zero) to w->new_pixel for window W and recursively all child windows of W. Also calculate and assign the new vertical (horizontal) pixel start positions of each of these windows. @@ -3957,7 +3957,7 @@ window_resize_apply (struct window *w, bool horflag) } -/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to +/* Set w->total_lines (w->total_cols if HORFLAG is non-zero) to w->new_total for window W and recursively all child windows of W. Also calculate and assign the new vertical (horizontal) start positions of each of these windows. */ From bc7f1625f6a06f153feb4253684a41ae2d96fb36 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 27 Jul 2014 16:01:07 +0300 Subject: [PATCH 14/17] Fix bugs #16674 and #18112 with resizing TTY frames after switching terminals. lisp/window.el (window--pixel-to-total): Use FRAME's root window, not that of the selected frame. --- lisp/ChangeLog | 5 +++++ lisp/window.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5307a6a496f..fe7dec98983 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-27 Eli Zaretskii + + * window.el (window--pixel-to-total): Use FRAME's root window, not + that of the selected frame. (Bug#18112, Bug#16674) + 2014-07-27 Andreas Schwab * textmodes/tex-mode.el (tex-font-lock-verb): Doc fix. diff --git a/lisp/window.el b/lisp/window.el index 28dd6a8ab26..c771f01707e 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2230,7 +2230,7 @@ Optional argument HORIZONTAL non-nil means assign new total window widths from pixel widths." (setq frame (window-normalize-frame frame)) (let* ((char-size (frame-char-size frame horizontal)) - (root (frame-root-window)) + (root (frame-root-window frame)) (root-size (window-size root horizontal t)) ;; We have to care about the minibuffer window only if it ;; appears together with the root window on this frame. From 29c3b7163526ad66fd3a9e4201797b2fca4c87be Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 28 Jul 2014 10:10:17 +0300 Subject: [PATCH 15/17] Fix GDB xwindow command. src/.gdbinit (xwindow): The members total_cols, total_lines, left_col, and top_line are C integers (and has been so for the last 1.5 years). --- src/.gdbinit | 10 +--------- src/ChangeLog | 6 ++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index 715744bc18e..a74fe3db7a1 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -820,15 +820,7 @@ define xwindow xgetptr $ print (struct window *) $ptr set $window = (struct window *) $ptr - xgetint $window->total_cols - set $width=$int - xgetint $window->total_lines - set $height=$int - xgetint $window->left_col - set $left=$int - xgetint $window->top_line - set $top=$int - printf "%dx%d+%d+%d\n", $width, $height, $left, $top + printf "%dx%d+%d+%d\n", $window->total_cols, $window->total_lines, $window->left_col, $window->top_line end document xwindow Print $ as a window pointer, assuming it is an Emacs Lisp window value. diff --git a/src/ChangeLog b/src/ChangeLog index f39526f4f4b..64fb82b78a3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-07-28 Eli Zaretskii + + * .gdbinit (xwindow): The members total_cols, total_lines, + left_col, and top_line are C integers (and has been so for the + last 1.5 years). + 2014-07-20 Jan Djärv * nsterm.m (applicationDidFinishLaunching:): Call From 6ea6889ab9fe4fa5069a0b28c1a612059fa3b74f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 28 Jul 2014 10:18:46 +0300 Subject: [PATCH 16/17] src/ChangeLog: Fix a typo. --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 64fb82b78a3..619efb479e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2410,7 +2410,7 @@ Avoid undefined behavior with huge regexp interval counts. * regex.c (GET_INTERVAL_COUNT): Rename from 'GET_UNSIGNED_NUMBER', since it's now specialized to interval counts. All uses changed. - Do not assume wrapraound on signed integer overflow. + Do not assume wraparound on signed integer overflow. (regex_compile): Simplify based on the above changes. 2013-12-12 Eli Zaretskii From 1c6c2e3c70ff2f666a1e3f29b8852d375c8392cd Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Mon, 28 Jul 2014 11:32:25 +0200 Subject: [PATCH 17/17] Merge commit 2014-07-28T09:07:56Z!tsdh@gnu.org from trunk. --- lisp/ChangeLog | 5 +++++ lisp/doc-view.el | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fe7dec98983..f68ee42680d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-28 Stephen Berman + + * doc-view.el (doc-view-open-text): Don't require that the + document is saved in a file (e.g., email attachment). + 2014-07-27 Eli Zaretskii * window.el (window--pixel-to-total): Use FRAME's root window, not diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 09d5925b3e2..7d5f1e771d5 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1402,11 +1402,12 @@ For now these keys are useful: (interactive) (if doc-view--current-converter-processes (message "DocView: please wait till conversion finished.") - (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))) + (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir))) + (bname (or buffer-file-name (buffer-name)))) (if (file-readable-p txt) (let ((name (concat "Text contents of " - (file-name-nondirectory buffer-file-name))) - (dir (file-name-directory buffer-file-name))) + (file-name-nondirectory bname))) + (dir (or (file-name-directory bname) default-directory))) (with-current-buffer (find-file txt) (rename-buffer name) (setq default-directory dir)))