commit 9b5d3846bb5f6dade16676c0fe9362df956ad634 (HEAD, refs/remotes/origin/master) Author: Tassilo Horn Date: Wed Apr 22 09:24:54 2015 +0200 Fix reftex-citation bug * reftex-cite.el (reftex-extract-bib-entries): Fix `wrong-type-argument stringp nil' error that occurs when AUCTeX integration is enabled and there are no citations in the document so far. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index fa09efb..b22e8b1 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -197,7 +197,7 @@ Return list with entries." "[" default "]: ") (if reftex-mode (if (fboundp 'LaTeX-bibitem-list) - (LaTeX-bibitem-list) + (or (LaTeX-bibitem-list) '("")) (cdr (assoc 'bibview-cache (symbol-value reftex-docstruct-symbol)))) nil) @@ -228,11 +228,11 @@ Return list with entries." (message "No such BibTeX file %s (ignored)" buffer) (message "Scanning bibliography database %s" buffer1) (unless (verify-visited-file-modtime buffer1) - (when (y-or-n-p - (format "File %s changed on disk. Reread from disk? " - (file-name-nondirectory - (buffer-file-name buffer1)))) - (with-current-buffer buffer1 (revert-buffer t t))))) + (when (y-or-n-p + (format "File %s changed on disk. Reread from disk? " + (file-name-nondirectory + (buffer-file-name buffer1)))) + (with-current-buffer buffer1 (revert-buffer t t))))) (set-buffer buffer1) (reftex-with-special-syntax-for-bib commit dbd65c779aa648bcc5c6fdc31f0be44cce4ea8ce Author: Dmitry Gutov Date: Wed Apr 22 04:45:43 2015 +0300 Add or reset based on the presence of MERGE_HEAD * lisp/vc/vc-git.el (vc-git-find-file-hook): Add `vc-git-resolve-when-done' to `after-save-hook' in either case. (vc-git-conflicted-files): Add a TODO. (vc-git-resolve-when-done): Depending on the presence of MERGE_HEAD, either update the resolved file in the index, or remove it from there. (Bug#20292) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index bec36fd..c8b696a 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -771,6 +771,9 @@ This prompts for a branch to merge from." (vc-git--run-command-string directory "status" "--porcelain" "--")) (lines (when status (split-string status "\n" 'omit-nulls))) files) + ;; TODO: Look into reimplementing `vc-git-state', as well as + ;; `vc-git-dir-status-files', based on this output, thus making the + ;; extra process call in `vc-git-find-file-hook' unnecessary. (dolist (line lines files) (when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> \\(.+\\)\\)?" line) @@ -786,32 +789,30 @@ This prompts for a branch to merge from." (save-excursion (goto-char (point-min)) (unless (re-search-forward "^<<<<<<< " nil t) - (vc-git-command nil 0 buffer-file-name "add") + (if (file-exists-p (expand-file-name ".git/MERGE_HEAD" + (vc-git-root buffer-file-name))) + ;; Doing a merge. + (vc-git-command nil 0 buffer-file-name "add") + ;; Doing something else. Likely applying a stash (bug#20292). + (vc-git-command nil 0 buffer-file-name "reset")) ;; Remove the hook so that it is not called multiple times. (remove-hook 'after-save-hook 'vc-git-resolve-when-done t)))) (defun vc-git-find-file-hook () "Activate `smerge-mode' if there is a conflict." - (let (stashed) - (when (and buffer-file-name - ;; FIXME - ;; 1) the net result is to call git twice per file. - ;; 2) v-g-c-f is documented to take a directory. - ;; http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01126.html - ;; XXX: Should we first look for the markers, and only - ;; call this function when see some? - (vc-git-conflicted-files buffer-file-name) - (save-excursion - (goto-char (point-min)) - (when (re-search-forward "^>>>>>>> " nil 'noerror) - (setq stashed (looking-at "Stashed changes")) - t))) - (vc-file-setprop buffer-file-name 'vc-state 'conflict) - (smerge-start-session) - (unless stashed - ;; Stashes are tricky (bug#20292). - (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)) - (message "There are unresolved conflicts in this file")))) + (when (and buffer-file-name + ;; FIXME + ;; 1) the net result is to call git twice per file. + ;; 2) v-g-c-f is documented to take a directory. + ;; http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01126.html + (vc-git-conflicted-files buffer-file-name) + (save-excursion + (goto-char (point-min)) + (re-search-forward "^<<<<<<< " nil 'noerror))) + (vc-file-setprop buffer-file-name 'vc-state 'conflict) + (smerge-start-session) + (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local) + (message "There are unresolved conflicts in this file"))) ;;; HISTORY FUNCTIONS commit 3f2c8b82649b670bdccfdc2235b3fb0b63a90d4c Author: Glenn Morris Date: Tue Apr 21 21:30:54 2015 -0400 * lisp/custom.el (custom-declare-group): No need to purecopy custom-current-group-alist members following recent change to set it to nil before dumping. diff --git a/lisp/custom.el b/lisp/custom.el index e5fe0eb..ea5ab7a 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -449,8 +449,7 @@ information." ;; Record the group on the `current' list. (let ((elt (assoc load-file-name custom-current-group-alist))) (if elt (setcdr elt symbol) - (push (cons (purecopy load-file-name) symbol) - custom-current-group-alist))) + (push (cons load-file-name symbol) custom-current-group-alist))) (run-hooks 'custom-define-hook) symbol) commit b50f9bc9643cc53c583d010ce2c8c41e2d4d8d01 Author: Glenn Morris Date: Tue Apr 21 17:57:24 2015 -0400 * build-aux/gitlog-to-emacslog: Get footer from ChangeLog.2. Fixes: debbugs:20399 diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog index a523d86..2b82115 100755 --- a/build-aux/gitlog-to-emacslog +++ b/build-aux/gitlog-to-emacslog @@ -65,7 +65,7 @@ if test -s "${distprefix}ChangeLog.tmp"; then s/\(Copyright[ (C)]*\)[0-9]*-[0-9]*/\1'"$year_range"'/ p } - ' >"${distprefix}ChangeLog.tmp" || exit + ' >"${distprefix}ChangeLog.tmp" || exit fi # Install the generated ChangeLog. commit 937b22fe461922329b9ae13a6148c29ff8263f2a Author: Glenn Morris Date: Tue Apr 21 17:56:29 2015 -0400 ; ChangeLog fix Reposition local-variables to where most ChangeLogs seem to keep them. Also helps gitlog-to-emacslog. diff --git a/ChangeLog.2 b/ChangeLog.2 index 90ef58c..a0bfa97 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -1222,6 +1222,10 @@ See ChangeLog.1 for earlier changes. +;; Local Variables: +;; coding: utf-8 +;; End: + Copyright (C) 2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -1238,7 +1242,3 @@ See ChangeLog.1 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . - -;; Local Variables: -;; coding: utf-8 -;; End: commit 4364839ea65448f7159b7b110c472769fc761fe4 Author: Daniel Colascione Date: Tue Apr 21 12:26:44 2015 -0700 Unbreak no-op buffer save message * lisp/files.el (save-buffer): Pass interactive flag to `basic-save-buffer` (basic-save-buffer): Accept called-interactively as an argument instead of directly invoking called-interactively-p, which will always yield nil in that context. diff --git a/lisp/files.el b/lisp/files.el index 152f155..fd7293b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4659,7 +4659,7 @@ See the subroutine `basic-save-buffer' for more information." (not noninteractive) (not save-silently)) (message "Saving file %s..." (buffer-file-name))) - (basic-save-buffer) + (basic-save-buffer (called-interactively-p 'any)) (and modp (memq arg '(4 64)) (setq buffer-backed-up nil)))) (defun delete-auto-save-file-if-necessary (&optional force) @@ -4701,7 +4701,7 @@ in such cases.") (make-variable-buffer-local 'save-buffer-coding-system) (put 'save-buffer-coding-system 'permanent-local t) -(defun basic-save-buffer () +(defun basic-save-buffer (&optional called-interactively) "Save the current buffer in its visited file, if it has been modified. The hooks `write-contents-functions' and `write-file-functions' get a chance to do the job of saving; if they do not, then the buffer is saved in @@ -4800,7 +4800,7 @@ Before and after saving the buffer, this function runs (vc-after-save) (run-hooks 'after-save-hook)) (or noninteractive - (not (called-interactively-p 'any)) + (not called-interactively) (files--message "(No changes need to be saved)"))))) ;; This does the "real job" of writing a buffer into its visited file commit 79fa7d7b75fa71d4332675ca28608b484731e09a Author: Alan Mackenzie Date: Tue Apr 21 14:02:10 2015 +0000 CC Mode: Do nothing in before/after-change-functions for text property changes Fixes bug#20266. lisp/progmodes/cc-mode.el (c-basic-common-init): Make yank-handled-properties buffer local, and remove 'category from it. (c-called-from-text-property-change-p): New function. (c-before-change): Don't do anything if a call of the new function returns non-nil. (c-after-change): Don't do much if a call of the new function returns non-nil. (c-extend-after-change-region): Put changes to text property 'fontified inside c-save-buffer-state. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 1f58ba1..3c1aec4 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -511,6 +511,14 @@ that requires a literal mode spec at compile time." (set (make-local-variable 'comment-line-break-function) 'c-indent-new-comment-line) + ;; Prevent time-wasting activity on C-y. + (when (boundp 'yank-handled-properties) + (make-local-variable 'yank-handled-properties) + (let ((yank-cat-handler (assq 'category yank-handled-properties))) + (when yank-cat-handler + (setq yank-handled-properties (remq yank-cat-handler + yank-handled-properties))))) + ;; For the benefit of adaptive file, which otherwise mis-fills. (setq fill-paragraph-handle-comment nil) @@ -839,6 +847,18 @@ Note that the style variables are always made local to the buffer." (defvar c-old-EOM 0) (make-variable-buffer-local 'c-old-EOM) +(defun c-called-from-text-property-change-p () + ;; Is the primitive which invoked `before-change-functions' or + ;; `after-change-functions' one which merely changes text properties? This + ;; function must be called directly from a member of one of the above hooks. + ;; + ;; In the following call, frame 0 is `backtrace-frame', frame 1 is + ;; `c-called-from-text-property-change-p', frame 2 is + ;; `c-before/after-change', frame 3 is the primitive invoking the change + ;; hook. + (memq (cadr (backtrace-frame 3)) + '(put-text-property remove-list-of-text-properties))) + (defun c-extend-region-for-CPP (beg end) ;; Set c-old-BOM or c-old-EOM respectively to BEG, END, each extended to the ;; beginning/end of any preprocessor construct they may be in. @@ -1009,8 +1029,9 @@ Note that the style variables are always made local to the buffer." ;; it/them from the cache. Don't worry about being inside a string ;; or a comment - "wrongly" removing a symbol from `c-found-types' ;; isn't critical. - (unless c-just-done-before-change ; Guard against a spurious second - ; invocation of before-change-functions. + (unless (or (c-called-from-text-property-change-p) + c-just-done-before-change) ; guard against a spurious second + ; invocation of before-change-functions. (setq c-just-done-before-change t) (setq c-maybe-stale-found-type nil) (save-restriction @@ -1105,51 +1126,53 @@ Note that the style variables are always made local to the buffer." ;; This calls the language variable c-before-font-lock-functions, if non nil. ;; This typically sets `syntax-table' properties. - (setq c-just-done-before-change nil) - (c-save-buffer-state (case-fold-search open-paren-in-column-0-is-defun-start) - ;; When `combine-after-change-calls' is used we might get calls - ;; with regions outside the current narrowing. This has been - ;; observed in Emacs 20.7. - (save-restriction - (save-match-data ; c-recognize-<>-arglists changes match-data - (widen) - - (when (> end (point-max)) - ;; Some emacsen might return positions past the end. This has been - ;; observed in Emacs 20.7 when rereading a buffer changed on disk - ;; (haven't been able to minimize it, but Emacs 21.3 appears to - ;; work). - (setq end (point-max)) - (when (> beg end) - (setq beg end))) - - ;; C-y is capable of spuriously converting category properties - ;; c--as-paren-syntax and c-cpp-delimiter into hard syntax-table - ;; properties. Remove these when it happens. - (when (eval-when-compile (memq 'category-properties c-emacs-features)) - (c-clear-char-property-with-value beg end 'syntax-table - c-<-as-paren-syntax) - (c-clear-char-property-with-value beg end 'syntax-table - c->-as-paren-syntax) - (c-clear-char-property-with-value beg end 'syntax-table nil)) - - (c-trim-found-types beg end old-len) ; maybe we don't need all of these. - (c-invalidate-sws-region-after beg end) - ;; (c-invalidate-state-cache beg) ; moved to `c-before-change'. - (c-invalidate-find-decl-cache beg) - - (when c-recognize-<>-arglists - (c-after-change-check-<>-operators beg end)) - - ;; (c-new-BEG c-new-END) will be the region to fontify. It may become - ;; larger than (beg end). - (setq c-new-BEG beg - c-new-END end) - (setq c-in-after-change-fontification t) - (save-excursion - (mapc (lambda (fn) - (funcall fn beg end old-len)) - c-before-font-lock-functions)))))) + ;; (c-new-BEG c-new-END) will be the region to fontify. It may become + ;; larger than (beg end). + (setq c-new-BEG beg c-new-END end) + + (unless (c-called-from-text-property-change-p) + (setq c-just-done-before-change nil) + (c-save-buffer-state (case-fold-search open-paren-in-column-0-is-defun-start) + ;; When `combine-after-change-calls' is used we might get calls + ;; with regions outside the current narrowing. This has been + ;; observed in Emacs 20.7. + (save-restriction + (save-match-data ; c-recognize-<>-arglists changes match-data + (widen) + + (when (> end (point-max)) + ;; Some emacsen might return positions past the end. This has been + ;; observed in Emacs 20.7 when rereading a buffer changed on disk + ;; (haven't been able to minimize it, but Emacs 21.3 appears to + ;; work). + (setq end (point-max)) + (when (> beg end) + (setq beg end))) + + ;; C-y is capable of spuriously converting category properties + ;; c--as-paren-syntax and c-cpp-delimiter into hard syntax-table + ;; properties. Remove these when it happens. + (when (eval-when-compile (memq 'category-properties c-emacs-features)) + (c-save-buffer-state () + (c-clear-char-property-with-value beg end 'syntax-table + c-<-as-paren-syntax) + (c-clear-char-property-with-value beg end 'syntax-table + c->-as-paren-syntax) + (c-clear-char-property-with-value beg end 'syntax-table nil))) + + (c-trim-found-types beg end old-len) ; maybe we don't need all of these. + (c-invalidate-sws-region-after beg end) + ;; (c-invalidate-state-cache beg) ; moved to `c-before-change'. + (c-invalidate-find-decl-cache beg) + + (when c-recognize-<>-arglists + (c-after-change-check-<>-operators beg end)) + + (setq c-in-after-change-fontification t) + (save-excursion + (mapc (lambda (fn) + (funcall fn beg end old-len)) + c-before-font-lock-functions))))))) (defun c-fl-decl-start (pos) ;; If the beginning of the line containing POS is in the middle of a "local" @@ -1322,7 +1345,7 @@ This function is called from `c-common-init', once per mode initialization." (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) ;; Emacs 22 and later. -(defun c-extend-after-change-region (_beg _end _old-len) +(defun c-extend-after-change-region (beg end _old-len) "Extend the region to be fontified, if necessary." ;; Note: the parameter OLD-LEN is ignored here. This somewhat indirect ;; implementation exists because it is minimally different from the @@ -1336,10 +1359,11 @@ This function is called from `c-common-init', once per mode initialization." (when (eq font-lock-support-mode 'jit-lock-mode) (save-restriction (widen) - (if (< c-new-BEG beg) - (put-text-property c-new-BEG beg 'fontified nil)) - (if (> c-new-END end) - (put-text-property end c-new-END 'fontified nil)))) + (c-save-buffer-state () ; Protect the undo-list from put-text-property. + (if (< c-new-BEG beg) + (put-text-property c-new-BEG beg 'fontified nil)) + (if (> c-new-END end) + (put-text-property end c-new-END 'fontified nil))))) (cons c-new-BEG c-new-END)) ;; Emacs < 22 and XEmacs commit b01cf822c5ac044bb550231c811a062d3a8cbeec Author: Glenn Morris Date: Tue Apr 21 06:18:09 2015 -0400 ; Auto-commit of loaddefs files. diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 9572539..0b7e9e0 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -2932,7 +2932,7 @@ When LEVEL is non-nil, increase section numbers on that level. ;;;*** -;;;### (autoloads nil "reftex-ref" "reftex-ref.el" "64cd7a4eaec426177a8fb3689139d935") +;;;### (autoloads nil "reftex-ref" "reftex-ref.el" "2689a4cea701a9d284e0967c313da989") ;;; Generated autoloads from reftex-ref.el (autoload 'reftex-label-location "reftex-ref" "\