commit 6337f2434e3385d4d35240789cdcc9037be7bd01 (HEAD, refs/remotes/origin/master) Author: Dmitry Gutov Date: Tue May 5 05:17:14 2015 +0300 ; Update a comment diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 4b2a4ee..f11dff1 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -534,7 +534,7 @@ meantime are preserved." XREF-ALIST is of the form ((GROUP . (XREF ...)) ...). Where GROUP is a string for decoration purposes and XREF is an `xref--xref' object." - (require 'compile) ;; For the compilation-info face. + (require 'compile) ; For the compilation faces. (cl-loop for ((group . xrefs) . more1) on xref-alist for max-line-width = (cl-loop for xref in xrefs commit ca717aa0fd048d3529ad8f5cedb37e0b31169b96 Author: Dmitry Gutov Date: Tue May 5 05:05:02 2015 +0300 Buttonize the whole line, including the number at the beginning * lisp/progmodes/xref.el (xref--location-at-point): Revert the previous change. (xref--insert-xrefs): Buttonize the whole line, including the number at the beginning. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 657657c..4b2a4ee 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -439,10 +439,9 @@ Used for temporary buffers.") (xref-show-location-at-point)) (defun xref--location-at-point () - (let ((pos (next-single-char-property-change (line-beginning-position) - 'xref-location - nil (line-end-position)))) - (and pos (get-text-property pos 'xref-location)))) + (save-excursion + (back-to-indentation) + (get-text-property (point) 'xref-location))) (defvar-local xref--window nil "ACTION argument to call `display-buffer' with.") @@ -548,21 +547,21 @@ GROUP is a string for decoration purposes and XREF is an (xref--insert-propertized '(face compilation-info) group "\n") (cl-loop for (xref . more2) on xrefs do (with-slots (description location) xref - (let ((line (xref-location-line location))) - (if line - (xref--insert-propertized - '(face compilation-line-number) - (format line-format line)) - (insert " "))) - (xref--insert-propertized - (list 'xref-location location - ;; 'face 'font-lock-keyword-face - 'mouse-face 'highlight - 'keymap xref--button-map - 'help-echo - (concat "mouse-2: display in another window, " - "RET or mouse-1: follow reference")) - description)) + (let* ((line (xref-location-line location)) + (prefix + (if line + (propertize (format line-format line) + 'face 'compilation-line-number) + " "))) + (xref--insert-propertized + (list 'xref-location location + ;; 'face 'font-lock-keyword-face + 'mouse-face 'highlight + 'keymap xref--button-map + 'help-echo + (concat "mouse-2: display in another window, " + "RET or mouse-1: follow reference")) + prefix description))) (insert "\n")))) (defun xref--analyze (xrefs) commit 46c94cd599374556d65daffa173e7028df69bc1c Author: Dmitry Gutov Date: Tue May 5 04:54:01 2015 +0300 Make sure we're inside the let bindings * lisp/progmodes/elisp-mode.el (elisp-completion-at-point): Make sure we're inside the let bindings. * test/automated/elisp-mode-tests.el (elisp-completes-functions-after-let-bindings): New test. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 9b7bc21..4056151 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -544,13 +544,13 @@ It can be quoted, or be inside a quoted form." (< (point) beg))))) (list t obarray :predicate (lambda (sym) (get sym 'error-conditions)))) - ((or `let `let* - (and ?\( - (guard (save-excursion - (goto-char (1- beg)) - (up-list -1) - (forward-symbol -1) - (looking-at "\\_"))))) + ((and (or ?\( `let `let*) + (guard (save-excursion + (goto-char (1- beg)) + (when (eq parent ?\() + (up-list -1)) + (forward-symbol -1) + (looking-at "\\_")))) (list t obarray :predicate #'boundp :company-doc-buffer #'elisp--company-doc-buffer diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el index 26f903d..bfecfe7 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el @@ -84,7 +84,7 @@ (should (member "bar" comps)) (should (member "baz" comps))))) -(ert-deftest completest-variables-in-let-bindings () +(ert-deftest elisp-completest-variables-in-let-bindings () (dolist (text '("(let (ba" "(let* ((ba")) (with-temp-buffer (emacs-lisp-mode) @@ -93,5 +93,13 @@ (should (member "backup-inhibited" comps)) (should-not (member "backup-buffer" comps)))))) +(ert-deftest elisp-completes-functions-after-let-bindings () + (with-temp-buffer + (emacs-lisp-mode) + (insert "(let ((bar 1) (baz 2)) (ba") + (let ((comps (elisp--test-completions))) + (should (member "backup-buffer" comps)) + (should-not (member "backup-inhibited" comps))))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here commit 201f91e5ad9619d71e1dfed327f47cb6923edd16 Author: Glenn Morris Date: Mon May 4 20:46:47 2015 -0400 * lisp/cedet/semantic/grammar.el (eldoc-function-argstring) (eldoc-docstring-format-sym-doc, eldoc-last-data-store) (eldoc-get-fnsym-args-string, eldoc-get-var-docstring): Remove outdated declarations. diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 7a92a12..15ad987 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1659,12 +1659,6 @@ Select the buffer containing the tag's definition, and move point there." ) "Association of syntax elements, and the corresponding help.") -(declare-function eldoc-function-argstring "eldoc") -(declare-function eldoc-docstring-format-sym-doc "eldoc") -(declare-function eldoc-last-data-store "eldoc") -(declare-function eldoc-get-fnsym-args-string "eldoc") -(declare-function eldoc-get-var-docstring "eldoc") - (defvar semantic-grammar-eldoc-last-data (cons nil nil)) (defun semantic-grammar-eldoc-get-macro-docstring (macro expander) commit 067968210e5088536b14ac5830eb623a7619f35f Author: Glenn Morris Date: Mon May 4 20:38:16 2015 -0400 Replace instances of "(eval-when-compile (autoload ...))" * lisp/gnus/gnus-art.el (nneething-get-file-name): Declare rather than autoload. * lisp/gnus/gnus-async.el (gnus-html-prefetch-images): Remove pointless autoload. * lisp/gnus/gnus-sync.el (gnus-group-topic): Autoload at run-time. (gnus-topic-create-topic, gnus-topic-enter-dribble): Declare rather than autoload. * lisp/gnus/mm-archive.el (gnus-recursive-directory-files) (mailcap-extension-to-mime): Autoload at run-time. * lisp/gnus/mm-util.el (latin-unity-massage-name) (latin-unity-maybe-remap, latin-unity-representations-feasible-region) (latin-unity-representations-present-region): Declare rather than autoload. * lisp/gnus/mml-smime.el (epg-make-context) (epg-passphrase-callback-function): Autoload at run-time. (epg-context-set-signers, epg-context-result-for) (epg-new-signature-digest-algorithm) (epg-verify-result-to-string, epg-list-keys, epg-verify-string) (epg-sign-string, epg-encrypt-string) (epg-context-set-passphrase-callback, epg-sub-key-fingerprint) (epg-configuration, epg-expand-group, epa-select-keys): Declare rather than autoload. * lisp/gnus/nnir.el (nnimap-change-group, nnimap-make-thread-query): Autoload at run-time. (gnus-group-topic-name, nnimap-buffer, nnimap-command) (gnus-registry-get-id-key, gnus-registry-action): Declare rather than autoload. * lisp/gnus/nnmail.el (mail-send-and-exit): Autoload at run-time. * lisp/gnus/spam.el (spam-stat-buffer-change-to-non-spam) (spam-stat-buffer-change-to-spam, spam-stat-buffer-is-non-spam) (spam-stat-buffer-is-spam, spam-stat-load, spam-stat-save) (spam-stat-split-fancy): Remove pointless autoloads. * lisp/net/mairix.el: Load gnus-util when compiling. (gnus-group-read-ephemeral-group, gnus-summary-toggle-header) (message-field-value): Declare rather than autoload. (mairix-gnus-ephemeral-nndoc, mairix-gnus-fetch-field): Check gnus-alive-p is fbound. (vm-quit, vm-visit-folder, vm-select-folder-buffer) (vm-check-for-killed-summary, vm-error-if-folder-empty) (vm-get-header-contents, vm-select-marked-or-prefixed-messages): Declare rather than autoload. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 14f9adc..989a424 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -7027,8 +7027,7 @@ If given a prefix, show the hidden text instead." (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name)) (gnus-request-group gnus-newsgroup-name t))) -(eval-when-compile - (autoload 'nneething-get-file-name "nneething")) +(declare-function nneething-get-file-name "nneething" (id)) (defun gnus-request-article-this-buffer (article group) "Get an article and insert it into this buffer." diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el index b1b3af9..d4d3dba 100644 --- a/lisp/gnus/gnus-async.el +++ b/lisp/gnus/gnus-async.el @@ -226,9 +226,6 @@ that was fetched." `(lambda (arg) (gnus-async-article-callback arg ,group ,article ,mark ,summary ,next))) -(eval-when-compile - (autoload 'gnus-html-prefetch-images "gnus-html")) - (defun gnus-async-article-callback (arg group article mark summary next) "Function called when an async article is done being fetched." (save-excursion diff --git a/lisp/gnus/gnus-sync.el b/lisp/gnus/gnus-sync.el index 3c0025f..c9ccc3e 100644 --- a/lisp/gnus/gnus-sync.el +++ b/lisp/gnus/gnus-sync.el @@ -90,10 +90,7 @@ (require 'gnus-util) (defvar gnus-topic-alist) ;; gnus-group.el -(eval-when-compile - (autoload 'gnus-group-topic "gnus-topic") - (autoload 'gnus-topic-create-topic "gnus-topic" nil t) - (autoload 'gnus-topic-enter-dribble "gnus-topic")) +(autoload 'gnus-group-topic "gnus-topic") (defgroup gnus-sync nil "The Gnus synchronization facility." @@ -605,6 +602,10 @@ unwanted groups via the LeSync URL." loc name gnus-sync-lesync-name (or sources ""))) nil))) +(declare-function gnus-topic-create-topic "gnus-topic" + (topic parent &optional previous full-topic)) +(declare-function gnus-topic-enter-dribble "gnus-topic" ()) + (defun gnus-sync-lesync-install-group-entry (name) (let* ((master (assoc name gnus-newsrc-alist)) (old-topic-name (gnus-group-topic name)) diff --git a/lisp/gnus/mm-archive.el b/lisp/gnus/mm-archive.el index d88e159..9c86c4a 100644 --- a/lisp/gnus/mm-archive.el +++ b/lisp/gnus/mm-archive.el @@ -23,9 +23,8 @@ ;;; Code: (require 'mm-decode) -(eval-when-compile - (autoload 'gnus-recursive-directory-files "gnus-util") - (autoload 'mailcap-extension-to-mime "mailcap")) +(autoload 'gnus-recursive-directory-files "gnus-util") +(autoload 'mailcap-extension-to-mime "mailcap") (defvar mm-archive-decoders '(("application/ms-tnef" t "tnef" "-f" "-" "-C") diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 0b75901..ab9145f 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -1058,11 +1058,10 @@ This affects whether coding conversion should be attempted generally." (length (memq (coding-system-base b) priorities))) t)))) -(eval-when-compile - (autoload 'latin-unity-massage-name "latin-unity") - (autoload 'latin-unity-maybe-remap "latin-unity") - (autoload 'latin-unity-representations-feasible-region "latin-unity") - (autoload 'latin-unity-representations-present-region "latin-unity")) +(declare-function latin-unity-massage-name "ext:latin-unity") +(declare-function latin-unity-maybe-remap "ext:latin-unity") +(declare-function latin-unity-representations-feasible-region "ext:latin-unity") +(declare-function latin-unity-representations-present-region "ext:latin-unity") (defvar latin-unity-coding-systems) (defvar latin-unity-ucs-list) diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 6f49f12..3f0809e 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -317,24 +317,25 @@ Whether the passphrase is cached at all is controlled by (defvar inhibit-redisplay) (defvar password-cache-expiry) -(eval-when-compile - (autoload 'epg-make-context "epg") - (autoload 'epg-context-set-armor "epg") - (autoload 'epg-context-set-signers "epg") - (autoload 'epg-context-result-for "epg") - (autoload 'epg-new-signature-digest-algorithm "epg") - (autoload 'epg-verify-result-to-string "epg") - (autoload 'epg-list-keys "epg") - (autoload 'epg-decrypt-string "epg") - (autoload 'epg-verify-string "epg") - (autoload 'epg-sign-string "epg") - (autoload 'epg-encrypt-string "epg") - (autoload 'epg-passphrase-callback-function "epg") - (autoload 'epg-context-set-passphrase-callback "epg") - (autoload 'epg-sub-key-fingerprint "epg") - (autoload 'epg-configuration "epg-config") - (autoload 'epg-expand-group "epg-config") - (autoload 'epa-select-keys "epa")) +(autoload 'epg-make-context "epg") +(autoload 'epg-passphrase-callback-function "epg") +(declare-function epg-context-set-signers "epg" (context signers)) +(declare-function epg-context-result-for "epg" (context name)) +(declare-function epg-new-signature-digest-algorithm "epg" (cl-x) t) +(declare-function epg-verify-result-to-string "epg" (verify-result)) +(declare-function epg-list-keys "epg" (context &optional name mode)) +(declare-function epg-verify-string "epg" + (context signature &optional signed-text)) +(declare-function epg-sign-string "epg" (context plain &optional mode)) +(declare-function epg-encrypt-string "epg" + (context plain recipients &optional sign always-trust)) +(declare-function epg-context-set-passphrase-callback "epg" + (context passphrase-callback)) +(declare-function epg-sub-key-fingerprint "epg" (cl-x) t) +(declare-function epg-configuration "epg-config" ()) +(declare-function epg-expand-group "epg-config" (config group)) +(declare-function epa-select-keys "epa" + (context prompt &optional names secret)) (defvar mml-smime-epg-secret-key-id-list nil) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 08ca7c7..15ccc47 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -281,16 +281,6 @@ is `(valuefunc member)'." (require 'gnus-sum) -(eval-when-compile - (autoload 'nnimap-buffer "nnimap") - (autoload 'nnimap-command "nnimap") - (autoload 'nnimap-change-group "nnimap") - (autoload 'nnimap-make-thread-query "nnimap") - (autoload 'gnus-registry-action "gnus-registry") - (autoload 'gnus-registry-get-id-key "gnus-registry") - (autoload 'gnus-group-topic-name "gnus-topic")) - - (nnoo-declare nnir) (nnoo-define-basics nnir) @@ -586,6 +576,8 @@ Add an entry here when adding a new search engine.") ;; Gnus glue. +(declare-function gnus-group-topic-name "gnus-topic" ()) + (defun gnus-group-make-nnir-group (nnir-extra-parms &optional specs) "Create an nnir group. Prompt for a search query and determine the groups to search as follows: if called from the *Server* @@ -948,6 +940,10 @@ ready to be added to the list of search results." ;;; Search Engine Interfaces: +(autoload 'nnimap-change-group "nnimap") +(declare-function nnimap-buffer "nnimap" ()) +(declare-function nnimap-command "nnimap" (&rest args)) + ;; imap interface (defun nnir-run-imap (query srv &optional groups) "Run a search against an IMAP back-end server. @@ -1774,6 +1770,9 @@ environment unless `not-global' is non-nil." (let ((backend (car (gnus-server-to-method server)))) (nnoo-current-server-p (or backend 'nnir) server))) +(autoload 'nnimap-make-thread-query "nnimap") +(declare-function gnus-registry-get-id-key "gnus-registry" (id key)) + (defun nnir-search-thread (header) "Make an nnir group based on the thread containing the article header. The current server will be searched. If the registry is @@ -1841,6 +1840,10 @@ article came from is also searched." (forward-line))))) groups)) +;; Behind gnus-registry-enabled test. +(declare-function gnus-registry-action "gnus-registry" + (action data-header from &optional to method)) + (defun nnir-registry-action (action data-header from &optional to method) "Call `gnus-registry-action' with the original article group." (gnus-registry-action diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index 5c54810..71bc916 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -36,8 +36,7 @@ (autoload 'gnus-add-buffer "gnus") (autoload 'gnus-kill-buffer "gnus") -(eval-when-compile - (autoload 'mail-send-and-exit "sendmail" nil t)) +(autoload 'mail-send-and-exit "sendmail" nil t) (defgroup nnmail nil "Reading mail with Gnus." diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 500f341..02ec695 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -2232,15 +2232,6 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." ;;{{{ spam-stat -(eval-when-compile - (autoload 'spam-stat-buffer-change-to-non-spam "spam-stat") - (autoload 'spam-stat-buffer-change-to-spam "spam-stat") - (autoload 'spam-stat-buffer-is-non-spam "spam-stat") - (autoload 'spam-stat-buffer-is-spam "spam-stat") - (autoload 'spam-stat-load "spam-stat") - (autoload 'spam-stat-save "spam-stat") - (autoload 'spam-stat-split-fancy "spam-stat")) - (require 'spam-stat) (defun spam-check-stat () diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el index c1b1079..087ae43 100644 --- a/lisp/net/mairix.el +++ b/lisp/net/mairix.el @@ -265,18 +265,22 @@ Currently there are 'threads and 'flags.") (mail-fetch-field field))))) ;;; Gnus -(eval-when-compile - (defvar gnus-article-buffer) - (autoload 'gnus-summary-toggle-header "gnus-sum") - (autoload 'gnus-buffer-exists-p "gnus-util") - (autoload 'message-field-value "message") - (autoload 'gnus-group-read-ephemeral-group "gnus-group") - (autoload 'gnus-alive-p "gnus-util")) + +;; For gnus-buffer-exists-p, although it seems that could be replaced by: +;; (and buffer (get-buffer buffer)) +(eval-when-compile (require 'gnus-util)) +(defvar gnus-article-buffer) +(declare-function gnus-group-read-ephemeral-group "gnus-group" + (group method &optional activate quit-config + request-only select-articles parameters number)) +(declare-function gnus-summary-toggle-header "gnus-sum" (&optional arg)) +(declare-function message-field-value "message" (header &optional not-all)) ;; Display function: (defun mairix-gnus-ephemeral-nndoc (folder) "Create ephemeral nndoc group for reading mbox file FOLDER in Gnus." - (unless (gnus-alive-p) + (unless (and (fboundp 'gnus-alive-p) + (gnus-alive-p)) (error "Gnus is not running")) (gnus-group-read-ephemeral-group ;; add randomness to group string to prevent Gnus from using a @@ -289,26 +293,29 @@ Currently there are 'threads and 'flags.") ;; Fetching mail header field: (defun mairix-gnus-fetch-field (field) "Get mail header FIELD for current message using Gnus." - (unless (gnus-alive-p) + (unless (and (fboundp 'gnus-alive-p) + (gnus-alive-p)) (error "Gnus is not running")) (unless (gnus-buffer-exists-p gnus-article-buffer) (error "No article buffer available")) (with-current-buffer gnus-article-buffer + ;; gnus-art requires gnus-sum and message. (gnus-summary-toggle-header 1) (message-field-value field))) ;;; VM ;;; written by Ulrich Mueller -(eval-when-compile - (autoload 'vm-quit "vm-folder") - (autoload 'vm-visit-folder "vm") - (autoload 'vm-select-folder-buffer "vm-macro") - (autoload 'vm-check-for-killed-summary "vm-misc") - (autoload 'vm-get-header-contents "vm-summary") - (autoload 'vm-check-for-killed-summary "vm-misc") - (autoload 'vm-error-if-folder-empty "vm-misc") - (autoload 'vm-select-marked-or-prefixed-messages "vm-folder")) +(declare-function vm-quit "ext:vm-folder" (&optional no-change)) +(declare-function vm-visit-folder "ext:vm-startup" + (folder &optional read-only)) +(declare-function vm-select-folder-buffer "ext:vm-macro" ()) ; defsubst +(declare-function vm-check-for-killed-summary "ext:vm-misc" ()) +(declare-function vm-error-if-folder-empty "ext:vm-misc" ()) +(declare-function vm-get-header-contents "ext:vm-summary" + (message header-name-regexp &optional clump-sep)) +(declare-function vm-select-marked-or-prefixed-messages "ext:vm-folder" + (prefix)) ;; Display function (defun mairix-vm-display (folder) commit d3d59fb4739eb4eb189014af87e3d812f3faf7cd Author: Glenn Morris Date: Mon May 4 20:34:09 2015 -0400 * lisp/gnus/mm-view.el (epg-decrypt-string): Autoload. diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index a3d6e74..edc2d39 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -629,6 +629,8 @@ If MODE is not set, try to find mode automatically." (replace-match "\n")) t) +(autoload 'epg-decrypt-string "epg") + (defun mm-view-pkcs7-decrypt (handle &optional from) (insert-buffer-substring (mm-handle-buffer handle)) (goto-char (point-min)) commit 0e383b93dfd7f4450f4a6c809472a314633d0583 Author: Glenn Morris Date: Mon May 4 20:33:01 2015 -0400 * lisp/gnus/mml-smime.el (epg-key-sub-key-list) (epg-sub-key-capability, epg-sub-key-validity): Fix declarations. diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 58d3b46..6f49f12 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -359,9 +359,9 @@ Whether the passphrase is cached at all is controlled by (cons key-id mml-smime-epg-secret-key-id-list)) (copy-sequence passphrase))))) -(declare-function epg-key-sub-key-list "ext:epg" (key)) -(declare-function epg-sub-key-capability "ext:epg" (sub-key)) -(declare-function epg-sub-key-validity "ext:epg" (sub-key)) +(declare-function epg-key-sub-key-list "epg" (key) t) +(declare-function epg-sub-key-capability "epg" (sub-key) t) +(declare-function epg-sub-key-validity "epg" (sub-key) t) (defun mml-smime-epg-find-usable-key (keys usage) (catch 'found commit 4003ebce4ae9b6f00aa71fd1b14853a2a902f4f5 Author: Glenn Morris Date: Mon May 4 20:22:52 2015 -0400 * lisp/progmodes/elisp-mode.el (xref-collect-references): Declare. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 9a37722..9b7bc21 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -581,6 +581,7 @@ It can be quoted, or be inside a quoted form." (declare-function xref-make-elisp-location "xref" (symbol type file)) (declare-function xref-make-bogus-location "xref" (message)) (declare-function xref-make "xref" (description location)) +(declare-function xref-collect-references "xref" (name dir)) (defun elisp-xref-find (action id) (require 'find-func) commit a6b6ab22d54fea02bd93d906b15cc82d7a11744c Author: Glenn Morris Date: Mon May 4 20:22:15 2015 -0400 * lisp/emacs-lisp/debug.el (help-xref-interned): Update declaration. diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index ce5c786..9d32ba2 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -731,7 +731,8 @@ Complete list of commands: (buffer-substring (line-beginning-position 0) (line-end-position 0))))) -(declare-function help-xref-interned "help-mode" (symbol)) +(declare-function help-xref-interned "help-mode" + (symbol &optional buffer frame)) (defun debug-help-follow (&optional pos) "Follow cross-reference at POS, defaulting to point. commit 7ccf25770a600034881b19f6923882b0e06609b6 Author: Glenn Morris Date: Mon May 4 20:21:47 2015 -0400 * lisp/allout.el (epg-user-id-string, epg-key-user-id-list): * lisp/emacs-lisp/package.el (epg-signature-status): Fix declarations. diff --git a/lisp/allout.el b/lisp/allout.el index 689bed5..2cdac99 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -6051,8 +6051,8 @@ See `allout-toggle-current-subtree-encryption' for more details." (declare-function epg-decrypt-string "epg" (context cipher)) (declare-function epg-encrypt-string "epg" (context plain recipients &optional sign always-trust)) -(declare-function epg-user-id-string "epg" (user-id)) -(declare-function epg-key-user-id-list "epg" (key)) +(declare-function epg-user-id-string "epg" (user-id) t) +(declare-function epg-key-user-id-list "epg" (key) t) ;;;_ > allout-encrypt-string (text decrypt allout-buffer keymode-cue ;;; &optional rejected) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ca185ac..7968ecd 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1079,7 +1079,7 @@ The return result is a `package-desc'." (declare-function epg-verify-string "epg" (context signature &optional signed-text)) (declare-function epg-context-result-for "epg" (context name)) -(declare-function epg-signature-status "epg" (signature)) +(declare-function epg-signature-status "epg" (signature) t) (declare-function epg-signature-to-string "epg" (signature)) (defun package--display-verify-error (context sig-file) commit b409dd36574ef13b87b82915828e9ffa400de04a Author: Glenn Morris Date: Mon May 4 20:20:40 2015 -0400 * lisp/play/gametree.el (gametree-show-children-and-entry) (gametree-apply-layout, gametree-mouse-show-subtree) (gametree-mouse-hide-subtree): Replace obsolete outline aliases. diff --git a/lisp/play/gametree.el b/lisp/play/gametree.el index ef55015..2c68c40 100644 --- a/lisp/play/gametree.el +++ b/lisp/play/gametree.el @@ -248,8 +248,8 @@ This value is simply the outline heading level of the current line." ;;;; outline layout (defsubst gametree-show-children-and-entry () - (show-children) - (show-entry)) + (outline-show-children) + (outline-show-entry)) (defun gametree-entry-shown-p () (save-excursion @@ -307,7 +307,7 @@ This value is simply the outline heading level of the current line." (if (not first-time) (outline-next-visible-heading 1)) (setq first-time nil) - (hide-subtree) + (outline-hide-subtree) (if (nth 0 layout) (funcall (nth 0 layout))) (if (not (and (nth 1 layout) (listp (nth 1 layout)))) @@ -393,7 +393,7 @@ depth AT-DEPTH or smaller is found." (outline-up-heading 1))) (beginning-of-line 1) (let ((parent-depth (gametree-current-branch-depth))) - (show-entry) + (outline-show-entry) (condition-case nil (outline-next-visible-heading 1) (error @@ -601,11 +601,11 @@ shogi, etc.) players, it is a slightly modified version of Outline mode. (defun gametree-mouse-show-subtree (event) (interactive "e") (mouse-set-point event) - (show-subtree)) + (outline-show-subtree)) (defun gametree-mouse-hide-subtree (event) (interactive "e") (mouse-set-point event) - (hide-subtree)) + (outline-hide-subtree)) (define-key gametree-mode-map [M-down-mouse-2 M-mouse-2] 'gametree-mouse-break-line-here) (define-key gametree-mode-map [S-down-mouse-1 S-mouse-1] commit b2f3c8071b79b6e0dff73d5fbc1dcaab0d8f2fbe Author: Glenn Morris Date: Mon May 4 20:17:35 2015 -0400 * lisp/emacs-lisp/check-declare.el (check-declare-verify): Handle cl-defgeneric, cl-defmethod. diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index a7045ad8..7269b83 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -157,6 +157,7 @@ is a string giving details of the error." (setq re (format (if cflag "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\"" "^[ \t]*(\\(fset[ \t]+'\\|\ +cl-def\\(?:generic\\|method\\)\\|\ def\\(?:un\\|subst\\|foo\\|method\\|class\\|\ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\\|\ \\(?:ine-obsolete-function-\\)?alias[ \t]+'\\|\ @@ -200,8 +201,8 @@ ine-overloadable-function\\)\\)\ type) 'obsolete) ;; Can't easily check arguments in these cases. - ((string-match "\\`\\(def\\(alias\\|\ -method\\|class\\)\\|fset\\)\\>" type) + ((string-match "\\`\\(def\\(alias\\|class\\)\\|\ +fset\\|\\(?:cl-\\)?defmethod\\)\\>" type) t) ((looking-at "\\((\\|nil\\)") (byte-compile-arglist-signature commit f773a4dd216e408257a358ca7c0c3f9b49baa7a0 Author: Dmitry Gutov Date: Tue May 5 02:58:02 2015 +0300 Highlight both type and symbol name * lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions): Highlight both type and symbol name. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 18da076..9a37722 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -625,7 +625,10 @@ It can be quoted, or be inside a quoted form." (defun elisp--xref-find-definitions (symbol) (save-excursion - (let (lst) + (let ((fmt "(%s %s)") + lst) + (put-text-property 1 3 'face 'font-lock-keyword-face fmt) + (put-text-property 4 6 'face 'font-lock-function-name-face fmt) (dolist (type '(feature defface defvar defun)) (let ((loc (condition-case err @@ -634,7 +637,7 @@ It can be quoted, or be inside a quoted form." (xref-make-bogus-location (error-message-string err)))))) (when loc (push - (xref-make (format "(%s %s)" type symbol) + (xref-make (format fmt type symbol) loc) lst)))) lst))) commit 9fa69f6b14a3f13217ddbafbc120d5f8fafaca50 Author: Dmitry Gutov Date: Tue May 5 02:44:20 2015 +0300 Insert, highlight and align line numbers in xref output * lisp/progmodes/etags.el (xref-location-line): Specialize for xref-etags-location. * lisp/progmodes/xref.el (xref-location-line): New generic method. (xref-file-location): Add reader for the line slot. (xref--location-at-point): Skip to the `xref-location' property. (xref--collect-reference): Drop the line number from description. (xref--insert-xrefs): Insert, highlight and align line numbers. diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 4e923aa..6acafdb 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2143,6 +2143,10 @@ for \\[find-tag] (which see)." (etags-goto-tag-location tag-info) (point-marker))))) +(cl-defmethod xref-location-line ((l xref-etags-location)) + (with-slots (tag-info) l + (nth 1 tag-info))) + (provide 'etags) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index ae0fbb8..657657c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -73,13 +73,17 @@ "Return a string used to group a set of locations. This is typically the filename.") +(cl-defgeneric xref-location-line (_location) + "Return the line number corresponding to the location." + nil) + ;;;; Commonly needed location classes are defined here: ;; FIXME: might be useful to have an optional "hint" i.e. a string to ;; search for in case the line number is sightly out of date. (defclass xref-file-location (xref-location) ((file :type string :initarg :file) - (line :type fixnum :initarg :line) + (line :type fixnum :initarg :line :reader xref-location-line) (column :type fixnum :initarg :column)) :documentation "A file location is a file/line/column triple. Line numbers start from 1 and columns from 0.") @@ -435,9 +439,10 @@ Used for temporary buffers.") (xref-show-location-at-point)) (defun xref--location-at-point () - (save-excursion - (back-to-indentation) - (get-text-property (point) 'xref-location))) + (let ((pos (next-single-char-property-change (line-beginning-position) + 'xref-location + nil (line-end-position)))) + (and pos (get-text-property pos 'xref-location)))) (defvar-local xref--window nil "ACTION argument to call `display-buffer' with.") @@ -531,11 +536,24 @@ XREF-ALIST is of the form ((GROUP . (XREF ...)) ...). Where GROUP is a string for decoration purposes and XREF is an `xref--xref' object." (require 'compile) ;; For the compilation-info face. - (cl-loop for ((group . xrefs) . more1) on xref-alist do + (cl-loop for ((group . xrefs) . more1) on xref-alist + for max-line-width = + (cl-loop for xref in xrefs + maximize (let ((line (xref-location-line + (oref xref :location)))) + (length (and line (format "%d" line))))) + for line-format = (and max-line-width + (format "%%%dd: " max-line-width)) + do (xref--insert-propertized '(face compilation-info) group "\n") (cl-loop for (xref . more2) on xrefs do - (insert " ") (with-slots (description location) xref + (let ((line (xref-location-line location))) + (if line + (xref--insert-propertized + '(face compilation-line-number) + (format line-format line)) + (insert " "))) (xref--insert-propertized (list 'xref-location location ;; 'face 'font-lock-keyword-face @@ -729,12 +747,9 @@ tools are used, and when." (regexp-quote name)) (line-end-position) t) (goto-char (match-beginning 0)) - (xref-make (format - "%d: %s" - line - (buffer-substring - (line-beginning-position) - (line-end-position))) + (xref-make (buffer-substring + (line-beginning-position) + (line-end-position)) (xref-make-file-location file line (current-column)))))))) commit 1ddb81a686a1e2cd6898cbd8b65878a74579ca71 Author: Daniel Colascione Date: Mon May 4 15:40:55 2015 -0700 Fix previous commit diff --git a/lisp/simple.el b/lisp/simple.el index 9f42f00..47c9cd3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4873,7 +4873,7 @@ store it in a Lisp variable. Example: (defun save-mark-and-excursion--save () (cons (let ((mark (mark-marker))) - (and mark (marker-position mark) (copy-marker mark))) + (and (marker-position mark) (copy-marker mark))) mark-active)) (defun save-mark-and-excursion--restore (saved-mark-info) @@ -4883,17 +4883,18 @@ store it in a Lisp variable. Example: (saved-mark-active (cdr saved-mark-info))) ;; Mark marker (if (null saved-mark) - (set-marker (mark-marker nil)) + (set-marker (mark-marker) nil) (setf nmark (marker-position saved-mark)) (set-marker (mark-marker) nmark) (set-marker saved-mark nil)) ;; Mark active (let ((cur-mark-active mark-active)) - (setf mark-active saved-mark-active) + (setq mark-active saved-mark-active) ;; If mark is active now, and either was not active or was at a ;; different place, run the activate hook. (if saved-mark-active - (unless (eq omark nmark) + (when (or (not cur-mark-active) + (not (eq omark nmark))) (run-hooks 'activate-mark-hook)) ;; If mark has ceased to be active, run deactivate hook. (when cur-mark-active commit 943c45f68b7b954f311ec3c1c35ed21830223333 Author: Dmitry Gutov Date: Mon May 4 23:16:12 2015 +0300 Don't pulse the indentation, or the newline * lisp/cedet/pulse.el (pulse-lighten-highlight) (pulse-reset-face): Fall back to the inherited background attribute in FACE. (pulse-momentary-highlight-region): Add autoload cookie. * lisp/progmodes/xref.el (xref--maybe-pulse): Don't highlight the indentation, or the newline, if the line's non-empty (http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00118.html). diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el index 59fd518..07882ef 100644 --- a/lisp/cedet/pulse.el +++ b/lisp/cedet/pulse.el @@ -133,7 +133,8 @@ Return t if there is more drift to do, nil if completed." (let* ((frame (color-values (face-background 'default))) (start (color-values (face-background (get 'pulse-highlight-face - :startface)))) + :startface) + nil t))) (frac (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations) (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations) (/ (- (nth 2 frame) (nth 2 start)) pulse-iterations))) @@ -154,7 +155,7 @@ Return t if there is more drift to do, nil if completed." "Reset the pulse highlighting FACE." (set-face-background 'pulse-highlight-face (if face - (face-background face) + (face-background face nil t) (face-background 'pulse-highlight-start-face) )) (put 'pulse-highlight-face :startface (or face @@ -238,6 +239,7 @@ Optional argument FACE specifies the face to do the highlighting." (point)))) (pulse-momentary-highlight-region start end face)))) +;;;###autoload (defun pulse-momentary-highlight-region (start end &optional face) "Highlight between START and END, unhighlighting before next command. Optional argument FACE specifies the face to do the highlighting." diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index a73085f..ae0fbb8 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -313,7 +313,15 @@ or when the command has been called with the prefix argument." (defun xref--maybe-pulse () (when xref-pulse-on-jump - (pulse-momentary-highlight-one-line (point)))) + (let (beg end) + (save-excursion + (back-to-indentation) + (if (eolp) + (setq beg (line-beginning-position) + end (1+ (point))) + (setq beg (point) + end (line-end-position)))) + (pulse-momentary-highlight-region beg end 'next-error)))) ;; etags.el needs this (defun xref-clear-marker-stack () commit 255a011f0ecf004b31c59945b10154b10fac3af1 Author: Daniel Colascione Date: Mon May 4 11:46:12 2015 -0700 Add `save-mark-and-excursion', which has the old `save-excursion' behavior * doc/lispref/positions.texi (Excursions): Document `save-mark-and-excursion'. * lisp/font-lock.el (font-lock-fontify-block): Use `save-mark-and-excursion' instead of `save-excursion', restoring Emacs 24 behavior. * lisp/simple.el (save-mark-and-excursion--save) (save-mark-and-excursion--restore): New functions. (save-mark-and-excursion): New user macro. * src/editfns.c (Fsave_excursion): Mention `save-mark-and-excursion' in `save-excursion' documentation. diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index fc47f1c..e7c79d5 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -888,6 +888,14 @@ type @code{nil}. @xref{Marker Insertion Types}. Therefore, when the saved point value is restored, it normally comes before the inserted text. +@defmac save-mark-and-excursion body@dots{} +@cindex mark excursion +@cindex point excursion +This macro is like @code{save-excursion}, but also saves and restores +the mark location and @code{mark-active}. This macro does what +@code{save-excursion} did before Emacs 25.1. +@end defmac + @node Narrowing @section Narrowing @cindex narrowing diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 96b290e..b145513 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1350,7 +1350,7 @@ delimit the region to fontify." deactivate-mark) ;; Make sure we have the right `font-lock-keywords' etc. (if (not font-lock-mode) (font-lock-set-defaults)) - (save-excursion + (save-mark-and-excursion (save-match-data (condition-case error-data (if (or arg (not font-lock-mark-block-function)) diff --git a/lisp/simple.el b/lisp/simple.el index 31efe38..9f42f00 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4870,6 +4870,44 @@ store it in a Lisp variable. Example: (setq mark-active nil) (set-marker (mark-marker) nil))) +(defun save-mark-and-excursion--save () + (cons + (let ((mark (mark-marker))) + (and mark (marker-position mark) (copy-marker mark))) + mark-active)) + +(defun save-mark-and-excursion--restore (saved-mark-info) + (let ((saved-mark (car saved-mark-info)) + (omark (marker-position (mark-marker))) + (nmark nil) + (saved-mark-active (cdr saved-mark-info))) + ;; Mark marker + (if (null saved-mark) + (set-marker (mark-marker nil)) + (setf nmark (marker-position saved-mark)) + (set-marker (mark-marker) nmark) + (set-marker saved-mark nil)) + ;; Mark active + (let ((cur-mark-active mark-active)) + (setf mark-active saved-mark-active) + ;; If mark is active now, and either was not active or was at a + ;; different place, run the activate hook. + (if saved-mark-active + (unless (eq omark nmark) + (run-hooks 'activate-mark-hook)) + ;; If mark has ceased to be active, run deactivate hook. + (when cur-mark-active + (run-hooks 'deactivate-mark-hook)))))) + +(defmacro save-mark-and-excursion (&rest body) + "Like `save-excursion', but also save and restore the mark state. +This macro does what `save-excursion' did before Emacs 25.1." + (let ((saved-marker-sym (make-symbol "saved-marker"))) + `(let ((,saved-marker-sym (save-mark-and-excursion--save))) + (unwind-protect + (save-excursion ,@body) + (save-mark-and-excursion--restore ,saved-marker-sym))))) + (defcustom use-empty-active-region nil "Whether \"region-aware\" commands should act on empty regions. If nil, region-aware commands treat empty regions as inactive. diff --git a/src/editfns.c b/src/editfns.c index dead48c..1686fbf 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -908,6 +908,10 @@ even in case of abnormal exit (throw or error). If you only want to save the current buffer but not point, then just use `save-current-buffer', or even `with-current-buffer'. +Before Emacs 25.1, `save-excursion' used to save the mark state. +To save the marker state as well as the point and buffer, use +`save-mark-and-excursion'. + usage: (save-excursion &rest BODY) */) (Lisp_Object args) { commit fe4e258b17feb529ac364daee67a5f0441f851f4 Author: Dmitry Gutov Date: Mon May 4 18:50:44 2015 +0300 Classify lone symbol inside let varlist as variable * lisp/progmodes/elisp-mode.el (elisp-completion-at-point): Classify lone symbol inside let varlist as variable. * test/automated/elisp-mode-tests.el (completest-variables-in-let-bindings): New test. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 7c9a2d7..18da076 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -544,12 +544,13 @@ It can be quoted, or be inside a quoted form." (< (point) beg))))) (list t obarray :predicate (lambda (sym) (get sym 'error-conditions)))) - ((and ?\( - (guard (save-excursion - (goto-char (1- beg)) - (up-list -1) - (forward-symbol -1) - (looking-at "\\_")))) + ((or `let `let* + (and ?\( + (guard (save-excursion + (goto-char (1- beg)) + (up-list -1) + (forward-symbol -1) + (looking-at "\\_"))))) (list t obarray :predicate #'boundp :company-doc-buffer #'elisp--company-doc-buffer diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el index a4148e9..26f903d 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el @@ -84,5 +84,14 @@ (should (member "bar" comps)) (should (member "baz" comps))))) +(ert-deftest completest-variables-in-let-bindings () + (dolist (text '("(let (ba" "(let* ((ba")) + (with-temp-buffer + (emacs-lisp-mode) + (insert text) + (let ((comps (elisp--test-completions))) + (should (member "backup-inhibited" comps)) + (should-not (member "backup-buffer" comps)))))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here commit 14c1d2106cc770581d16a695734eb56e7b9662f2 Author: Dmitry Gutov Date: Mon May 4 18:09:33 2015 +0300 Add xref-pulse-on-jump * lisp/cedet/pulse.el (pulse-momentary-highlight-one-line): Add autoload cookie. * lisp/progmodes/xref.el (xref-pulse-on-jump): New option. (xref--maybe-pulse): New function. (xref-pop-marker-stack, xref--pop-to-location) (xref--display-position): Use it. (xref--location-at-point): Use back-to-indentation. diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el index 89d44c2..59fd518 100644 --- a/lisp/cedet/pulse.el +++ b/lisp/cedet/pulse.el @@ -224,6 +224,7 @@ Optional argument FACE specifies the face to do the highlighting." ;; Remove this hook. (remove-hook 'pre-command-hook 'pulse-momentary-unhighlight)) +;;;###autoload (defun pulse-momentary-highlight-one-line (point &optional face) "Highlight the line around POINT, unhighlighting before next command. Optional argument FACE specifies the face to do the highlighting." diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index b972bf2..a73085f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -285,6 +285,11 @@ or when the command has been called with the prefix argument." (const :tag "auto" nil)) :version "25.1") +(defcustom xref-pulse-on-jump t + "When non-nil, momentarily highlight jump locations." + :type 'boolean + :version "25.1") + (defvar xref--marker-ring (make-ring xref-marker-ring-length) "Ring of markers to implement the marker stack.") @@ -303,7 +308,12 @@ or when the command has been called with the prefix argument." (switch-to-buffer (or (marker-buffer marker) (error "The marked buffer has been deleted"))) (goto-char (marker-position marker)) - (set-marker marker nil nil)))) + (set-marker marker nil nil) + (xref--maybe-pulse)))) + +(defun xref--maybe-pulse () + (when xref-pulse-on-jump + (pulse-momentary-highlight-one-line (point)))) ;; etags.el needs this (defun xref-clear-marker-stack () @@ -338,7 +348,8 @@ WINDOW controls how the buffer is displayed: (cl-ecase window ((nil) (switch-to-buffer (current-buffer))) (window (pop-to-buffer (current-buffer) t)) - (frame (let ((pop-up-frames t)) (pop-to-buffer (current-buffer) t))))) + (frame (let ((pop-up-frames t)) (pop-to-buffer (current-buffer) t)))) + (xref--maybe-pulse)) ;;; XREF buffer (part of the UI) @@ -374,6 +385,7 @@ Used for temporary buffers.") (with-selected-window (display-buffer (current-buffer) other-window) (goto-char pos) (recenter recenter-arg) + (xref--maybe-pulse) (let ((buf (current-buffer)) (win (selected-window))) (with-current-buffer xref-buf @@ -415,7 +427,9 @@ Used for temporary buffers.") (xref-show-location-at-point)) (defun xref--location-at-point () - (get-text-property (point) 'xref-location)) + (save-excursion + (back-to-indentation) + (get-text-property (point) 'xref-location))) (defvar-local xref--window nil "ACTION argument to call `display-buffer' with.") @@ -423,7 +437,6 @@ Used for temporary buffers.") (defun xref-goto-xref () "Jump to the xref on the current line and bury the xref buffer." (interactive) - (back-to-indentation) (let ((loc (or (xref--location-at-point) (user-error "No reference at point"))) (window xref--window)) commit 9d4eaff316fffc00fecb2dc1b655bc0df6953144 Author: Stefan Monnier Date: Mon May 4 11:32:39 2015 -0400 * lisp/org/org-{macs,list}.el: Fix lexical warnings * lisp/org/org-list.el (org-list-struct): Remove unused var `ind'. (org-list-get-next-item, org-list-get-prev-item) (org-list-get-children): Mark unused arg `struct'. (org-list-use-alpha-bul-p): Remove unused var `bul'. (org-toggle-checkbox): Mark unused var. (org-update-checkbox-count): Remove unused var `box-num'. (org-adapt-indentation): Declare. (org-list-parse-list): Declare var instead of adding a dummy duplicate. (org-list-send-list): Remove unused var `txt'. (org-list-to-latex, org-list-to-texinfo): Mark unused arg `params'. (org-list-to-subtree): Add prefix to dyn-bind var, and declare them. * lisp/org/org-macs.el: Use `declare'. (org-with-limited-levels): Declare dyn-bound vars. diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index c8db77b..73f24ce 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -431,7 +431,7 @@ group 4: description tag") (context (org-list-context)) (lim-up (car context)) (drawers-re (concat "^[ \t]*:\\(" - (mapconcat 'regexp-quote org-drawers "\\|") + (mapconcat #'regexp-quote org-drawers "\\|") "\\):[ \t]*$")) (inlinetask-re (and (featurep 'org-inlinetask) (org-inlinetask-outline-regexp))) @@ -550,7 +550,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'." ;; Can't use org-drawers-regexp as this function might ;; be called in buffers not in Org mode. (beg-re (concat "^[ \t]*:\\(" - (mapconcat 'regexp-quote org-drawers "\\|") + (mapconcat #'regexp-quote org-drawers "\\|") "\\):[ \t]*$"))) (when (save-excursion (and (not (looking-at beg-re)) @@ -636,12 +636,12 @@ Assume point is at an item." (text-min-ind 10000) (item-re (org-item-re)) (drawers-re (concat "^[ \t]*:\\(" - (mapconcat 'regexp-quote org-drawers "\\|") + (mapconcat #'regexp-quote org-drawers "\\|") "\\):[ \t]*$")) (inlinetask-re (and (featurep 'org-inlinetask) (org-inlinetask-outline-regexp))) (beg-cell (cons (point) (org-get-indentation))) - ind itm-lst itm-lst-2 end-lst end-lst-2 struct + itm-lst itm-lst-2 end-lst end-lst-2 struct (assoc-at-point (function ;; Return association at point. @@ -926,13 +926,13 @@ Value returned is the position of the first child of ITEM." (< ind (org-list-get-ind child-maybe struct))) child-maybe))) -(defun org-list-get-next-item (item struct prevs) +(defun org-list-get-next-item (item _struct prevs) "Return next item in same sub-list as ITEM, or nil. STRUCT is the list structure. PREVS is the alist of previous items, as returned by `org-list-prevs-alist'." (car (rassq item prevs))) -(defun org-list-get-prev-item (item struct prevs) +(defun org-list-get-prev-item (item _struct prevs) "Return previous item in same sub-list as ITEM, or nil. STRUCT is the list structure. PREVS is the alist of previous items, as returned by `org-list-prevs-alist'." @@ -964,7 +964,7 @@ items, as returned by `org-list-prevs-alist'." (push next-item after-item)) (append before-item (list item) (nreverse after-item)))) -(defun org-list-get-children (item struct parents) +(defun org-list-get-children (item _struct parents) "List all children of ITEM, or nil. STRUCT is the list structure. PARENTS is the alist of parents, as returned by `org-list-parents-alist'." @@ -982,7 +982,7 @@ STRUCT is the list structure." (defun org-list-get-bottom-point (struct) "Return point at bottom of list. STRUCT is the list structure." - (apply 'max + (apply #'max (mapcar (lambda (e) (org-list-get-item-end (car e) struct)) struct))) (defun org-list-get-list-begin (item struct prevs) @@ -1630,8 +1630,7 @@ as returned by `org-list-prevs-alist'." ;; Pretend that bullets are uppercase and check if alphabet ;; is sufficient, taking counters into account. (while item - (let ((bul (org-list-get-bullet item struct)) - (count (org-list-get-counter item struct))) + (let ((count (org-list-get-counter item struct))) ;; Virtually determine current bullet (if (and count (string-match "[a-zA-Z]" count)) ;; Counters are not case-sensitive. @@ -1728,7 +1727,7 @@ This function modifies STRUCT." (replace-match "1" nil nil bullet)) ;; Not an ordered list: keep bullet. (t bullet))))))))) - (mapc fix-bul (mapcar 'car struct)))) + (mapc fix-bul (mapcar #'car struct)))) (defun org-list-struct-fix-ind (struct parents &optional bullet-size) "Verify and correct indentation in STRUCT. @@ -1756,7 +1755,7 @@ This function modifies STRUCT." org-list-indent-offset)) ;; If no parent, indent like top-point. (org-list-set-ind item struct top-ind)))))) - (mapc new-ind (mapcar 'car (cdr struct))))) + (mapc new-ind (mapcar #'car (cdr struct))))) (defun org-list-struct-fix-box (struct parents prevs &optional ordered) "Verify and correct checkboxes in STRUCT. @@ -1771,7 +1770,7 @@ break this rule, the function will return the blocking item. In all others cases, the return value will be nil. This function modifies STRUCT." - (let ((all-items (mapcar 'car struct)) + (let ((all-items (mapcar #'car struct)) (set-parent-box (function (lambda (item) @@ -1942,8 +1941,8 @@ Initial position of cursor is restored after the changes." ;; same amount of indentation. Each slice follow the pattern ;; (END BEG DELTA MAX-IND-OR-NIL). Slices are returned in ;; reverse order. - (setq all-ends (sort (append (mapcar 'car itm-shift) - (org-uniquify (mapcar 'car end-list))) + (setq all-ends (sort (append (mapcar #'car itm-shift) + (org-uniquify (mapcar #'car end-list))) '<)) (while (cdr all-ends) (let* ((up (pop all-ends)) @@ -2327,7 +2326,7 @@ in subtree, ignoring drawers." lim-up lim-down (drawer-re (concat "^[ \t]*:\\(" - (mapconcat 'regexp-quote org-drawers "\\|") + (mapconcat #'regexp-quote org-drawers "\\|") "\\):[ \t]*$")) (keyword-re (concat "^[ \t]*\\<\\(" org-scheduled-string "\\|" org-deadline-string @@ -2335,7 +2334,7 @@ in subtree, ignoring drawers." "\\|" org-clock-string "\\)" " *[[<]\\([^]>]+\\)[]>]")) (orderedp (org-entry-get nil "ORDERED")) - (bounds + (_bounds ;; In a region, start at first item in region. (cond ((org-region-active-p) @@ -2391,7 +2390,7 @@ in subtree, ignoring drawers." (bottom (copy-marker (org-list-get-bottom-point struct))) (items-to-toggle (org-remove-if (lambda (e) (or (< e lim-up) (> e lim-down))) - (mapcar 'car struct)))) + (mapcar #'car struct)))) (mapc (lambda (e) (org-list-set-checkbox e struct ;; If there is no box at item, leave as-is @@ -2473,7 +2472,7 @@ With optional prefix argument ALL, do this for the whole buffer." (items (cond ((and recursivep item) (org-list-get-subtree item s)) - (recursivep (mapcar 'car s)) + (recursivep (mapcar #'car s)) (item (org-list-get-children item s par)) (t (org-list-get-all-items (org-list-get-top-point s) s pre)))) @@ -2486,7 +2485,7 @@ With optional prefix argument ALL, do this for the whole buffer." structs) (cons c-on c-all))))) (backup-end 1) - cookies-list structs-bak box-num) + cookies-list structs-bak) (goto-char (car bounds)) ;; 1. Build an alist for each cookie found within BOUNDS. The ;; key will be position at beginning of cookie and values @@ -2749,6 +2748,7 @@ If a region is active, all items inside will be moved." (t (error "Not at an item"))))) (defvar org-tab-ind-state) +(defvar org-adapt-indentation) (defun org-cycle-item-indentation () "Cycle levels of indentation of an empty item. The first run indents the item, if applicable. Subsequent runs @@ -2940,13 +2940,13 @@ will be parsed as: \(3 \"last item\"\)\) Point is left at list end." + (defvar parse-item) ;FIXME: Or use `cl-labels' or `letrec'. (let* ((struct (org-list-struct)) (prevs (org-list-prevs-alist struct)) (parents (org-list-parents-alist struct)) (top (org-list-get-top-point struct)) (bottom (org-list-get-bottom-point struct)) out - parse-item ; for byte-compiler (get-text (function ;; Return text between BEG and END, trimmed, with @@ -3072,7 +3072,7 @@ for this list." (re-search-forward (org-item-beginning-re) bottom-point t) (match-beginning 0))) (plain-list (buffer-substring-no-properties top-point bottom-point)) - beg txt) + beg) (unless (fboundp transform) (error "No such transformation function %s" transform)) (let ((txt (funcall transform plain-list))) @@ -3082,7 +3082,8 @@ for this list." (unless (re-search-forward (concat "BEGIN RECEIVE ORGLST +" name - "\\([ \t]\\|$\\)") nil t) + "\\([ \t]\\|$\\)") + nil t) (error "Don't know where to insert translated list")) (goto-char (match-beginning 0)) (beginning-of-line 2) @@ -3230,7 +3231,7 @@ items." items (or (eval isep) "")))))))) (concat (funcall export-sublist list 0) "\n"))) -(defun org-list-to-latex (list &optional params) +(defun org-list-to-latex (list &optional _params) "Convert LIST into a LaTeX list. LIST is as string representing the list to transform, as Org syntax. Return converted list as a string." @@ -3244,7 +3245,7 @@ syntax. Return converted list as a string." (require 'ox-html) (org-export-string-as list 'html t)) -(defun org-list-to-texinfo (list &optional params) +(defun org-list-to-texinfo (list &optional _params) "Convert LIST into a Texinfo list. LIST is as string representing the list to transform, as Org syntax. Return converted list as a string." @@ -3255,14 +3256,15 @@ syntax. Return converted list as a string." "Convert LIST into an Org subtree. LIST is as returned by `org-list-parse-list'. PARAMS is a property list with overruling parameters for `org-list-to-generic'." + (defvar get-stars) (defvar org--blankp) (let* ((rule (cdr (assq 'heading org-blank-before-new-entry))) (level (org-reduced-level (or (org-current-level) 0))) - (blankp (or (eq rule t) + (org--blankp (or (eq rule t) (and (eq rule 'auto) (save-excursion (outline-previous-heading) (org-previous-line-empty-p))))) - (get-stars + (get-stars ;FIXME: Can't rename without renaming it in org.el as well! (function ;; Return the string for the heading, depending on depth D ;; of current sub-list. @@ -3277,12 +3279,12 @@ with overruling parameters for `org-list-to-generic'." list (org-combine-plists '(:splice t - :dtstart " " :dtend " " - :istart (funcall get-stars depth) - :icount (funcall get-stars depth) - :isep (if blankp "\n\n" "\n") - :csep (if blankp "\n\n" "\n") - :cbon "DONE" :cboff "TODO" :cbtrans "TODO") + :dtstart " " :dtend " " + :istart (funcall get-stars depth) + :icount (funcall get-stars depth) + :isep (if org--blankp "\n\n" "\n") + :csep (if org--blankp "\n\n" "\n") + :cbon "DONE" :cboff "TODO" :cbtrans "TODO") params)))) (provide 'org-list) diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 23c3017..db09909 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -33,7 +33,7 @@ (eval-and-compile (unless (fboundp 'declare-function) - (defmacro declare-function (fn file &optional arglist fileonly) + (defmacro declare-function (fn file &optional _arglist _fileonly) `(autoload ',fn ,file))) (if (>= emacs-major-version 23) @@ -48,13 +48,14 @@ (declare-function org-string-match-p "org-compat" (&rest args)) (defmacro org-with-gensyms (symbols &rest body) + (declare (debug (sexp body)) (indent 1)) `(let ,(mapcar (lambda (s) - `(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols) + `(,s (make-symbol (concat "--" (symbol-name ',s))))) + symbols) ,@body)) -(def-edebug-spec org-with-gensyms (sexp body)) -(put 'org-with-gensyms 'lisp-indent-function 1) (defmacro org-called-interactively-p (&optional kind) + (declare (debug (&optional ("quote" symbolp)))) ;Why not just `t'? (if (featurep 'xemacs) `(interactive-p) (if (or (> emacs-major-version 23) @@ -63,12 +64,11 @@ ;; defined with no argument in <=23.1 `(with-no-warnings (called-interactively-p ,kind)) `(interactive-p)))) -(def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp))) (defmacro org-bound-and-true-p (var) "Return the value of symbol VAR if it is bound, else nil." + (declare (debug (symbolp))) `(and (boundp (quote ,var)) ,var)) -(def-edebug-spec org-bound-and-true-p (symbolp)) (defun org-string-nw-p (s) "Is S a string with a non-white character?" @@ -97,10 +97,11 @@ Otherwise return nil." (defmacro org-re (s) "Replace posix classes in regular expression." + (declare (debug (form))) (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s)) -(def-edebug-spec org-re (form)) (defmacro org-preserve-lc (&rest body) + (declare (debug (body))) (org-with-gensyms (line col) `(let ((,line (org-current-line)) (,col (current-column))) @@ -108,12 +109,12 @@ Otherwise return nil." (progn ,@body) (org-goto-line ,line) (org-move-to-column ,col))))) -(def-edebug-spec org-preserve-lc (body)) ;; Use `org-with-silent-modifications' to ignore cosmetic changes and ;; `org-unmodified' to ignore real text modifications (defmacro org-unmodified (&rest body) "Run BODY while preserving the buffer's `buffer-modified-p' state." + (declare (debug (body))) (org-with-gensyms (was-modified) `(let ((,was-modified (buffer-modified-p))) (unwind-protect @@ -121,9 +122,9 @@ Otherwise return nil." (inhibit-modification-hooks t)) ,@body) (set-buffer-modified-p ,was-modified))))) -(def-edebug-spec org-unmodified (body)) (defmacro org-without-partial-completion (&rest body) + (declare (debug (body))) `(if (and (boundp 'partial-completion-mode) partial-completion-mode (fboundp 'partial-completion-mode)) @@ -133,7 +134,6 @@ Otherwise return nil." ,@body) (partial-completion-mode 1)) ,@body)) -(def-edebug-spec org-without-partial-completion (body)) ;; FIXME: Slated for removal. Current Org mode does not support Emacs < 22 (defmacro org-maybe-intangible (props) @@ -150,6 +150,7 @@ We use a macro so that the test can happen at compilation time." (defmacro org-with-point-at (pom &rest body) "Move to buffer and point of point-or-marker POM for the duration of BODY." + (declare (debug (form body)) (indent 1)) (org-with-gensyms (mpom) `(let ((,mpom ,pom)) (save-excursion @@ -157,15 +158,14 @@ We use a macro so that the test can happen at compilation time." (org-with-wide-buffer (goto-char (or ,mpom (point))) ,@body))))) -(def-edebug-spec org-with-point-at (form body)) -(put 'org-with-point-at 'lisp-indent-function 1) (defmacro org-no-warnings (&rest body) + (declare (debug (body))) (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body)) -(def-edebug-spec org-no-warnings (body)) (defmacro org-with-remote-undo (buffer &rest body) "Execute BODY while recording undo information in two buffers." + (declare (debug (form body)) (indent 1)) (org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2) `(let ((,cline (org-current-line)) (,cmd this-command) @@ -187,13 +187,11 @@ We use a macro so that the test can happen at compilation time." ;; remember which buffer to undo (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2) org-agenda-undo-list)))))) -(def-edebug-spec org-with-remote-undo (form body)) -(put 'org-with-remote-undo 'lisp-indent-function 1) (defmacro org-no-read-only (&rest body) "Inhibit read-only for BODY." + (declare (debug (body))) `(let ((inhibit-read-only t)) ,@body)) -(def-edebug-spec org-no-read-only (body)) (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t rear-nonsticky t mouse-map t fontified t @@ -313,7 +311,7 @@ This means that the buffer may change while running BODY, but it also means that the buffer should stay alive during the operation, because otherwise all these markers will point nowhere." - (declare (indent 1)) + (declare (debug (form body)) (indent 1)) (org-with-gensyms (data rtn) `(let ((,data (org-outline-overlay-data ,use-markers)) ,rtn) @@ -327,24 +325,28 @@ point nowhere." (and (markerp (cdr c)) (move-marker (cdr c) nil))) ,data))) ,rtn))) -(def-edebug-spec org-save-outline-visibility (form body)) (defmacro org-with-wide-buffer (&rest body) "Execute body while temporarily widening the buffer." + (declare (debug (body))) `(save-excursion (save-restriction (widen) ,@body))) -(def-edebug-spec org-with-wide-buffer (body)) (defmacro org-with-limited-levels (&rest body) "Execute BODY with limited number of outline levels." - `(let* ((org-called-with-limited-levels t) - (org-outline-regexp (org-get-limited-outline-regexp)) - (outline-regexp org-outline-regexp) - (org-outline-regexp-bol (concat "^" org-outline-regexp))) - ,@body)) -(def-edebug-spec org-with-limited-levels (body)) + (declare (debug (body))) + `(progn + (defvar org-called-with-limited-levels) + (defvar org-outline-regexp) + (defvar outline-regexp) + (defvar org-outline-regexp-bol) + (let* ((org-called-with-limited-levels t) + (org-outline-regexp (org-get-limited-outline-regexp)) + (outline-regexp org-outline-regexp) + (org-outline-regexp-bol (concat "^" org-outline-regexp))) + ,@body))) (defvar org-outline-regexp) ; defined in org.el (defvar org-odd-levels-only) ; defined in org.el @@ -365,9 +367,8 @@ The number of levels is controlled by `org-inlinetask-min-level'" (format-time-string string (seconds-to-time seconds)))) (defmacro org-eval-in-environment (environment form) + (declare (debug (form form)) (indent 1)) `(eval (list 'let ,environment ',form))) -(def-edebug-spec org-eval-in-environment (form form)) -(put 'org-eval-in-environment 'lisp-indent-function 1) (defun org-make-parameter-alist (flat) "Return alist based on FLAT. commit 8c392682fc9938b2ee02cc2741bf6f680281b0c7 Author: Eli Zaretskii Date: Mon May 4 17:46:30 2015 +0300 Fix minor issues with CEDET on MS-Windows * lisp/cedet/semantic/symref/idutils.el (semantic-symref-parse-tool-output-one-line): Fix the search regexp to match MS-Windows file names with drive letters. (Bug#19468) * lisp/cedet/semantic/symref/grep.el (semantic-symref-grep-use-template): Remove "--color=always" from Grep switches on MS-Windows. (semantic-symref-grep-shell): Use shell-file-name as the default value, so this works not only on Posix platforms. (semantic-symref-perform-search): Use shell-quote-argument instead of literal '..' for portable quoting of Grep command-line argument. Use shell-command-switch instead of a literal "-c". * lisp/cedet/semantic/bovine/gcc.el (semantic-gcc-get-include-paths): Use file-name-absolute-p to test for an absolute file name in a portable way. diff --git a/lisp/cedet/semantic/bovine/gcc.el b/lisp/cedet/semantic/bovine/gcc.el index 19d1491..b186e7b 100644 --- a/lisp/cedet/semantic/bovine/gcc.el +++ b/lisp/cedet/semantic/bovine/gcc.el @@ -86,13 +86,11 @@ to give to the program." (let ((chars (append line nil))) (when (= 32 (nth 0 chars)) (let ((path (substring line 1))) - (when (file-accessible-directory-p path) - (when (if (memq system-type '(windows-nt)) - (/= ?/ (nth 1 chars)) - (= ?/ (nth 1 chars))) - (add-to-list 'inc-path - (expand-file-name (substring line 1)) - t))))))))) + (when (and (file-accessible-directory-p path) + (file-name-absolute-p path)) + (add-to-list 'inc-path + (expand-file-name path) + t)))))))) inc-path)) diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 981dab8..d57b50f 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -105,17 +105,26 @@ GREPPATTERN is the pattern used by grep." ;; We have grep-compute-defaults. Let's use it. (grep-compute-defaults) (let* ((grep-expand-keywords semantic-symref-grep-expand-keywords) - (cmd (grep-expand-template grep-find-template - greppattern - filepattern - rootdir))) + (cmd (grep-expand-template + (if (memq system-type '(windows-nt ms-dos)) + ;; grep-find uses '--color=always' on MS-Windows + ;; because it wants the colorized output, to show + ;; it to the user. By contrast, here we don't show + ;; the output, and the SGR escapes get in the way + ;; of parsing the output. + (replace-regexp-in-string "--color=always" "" + grep-find-template t t) + grep-find-template) + greppattern + filepattern + rootdir))) ;; For some reason, my default has no in it. (when (string-match "find \\(\\.\\)" cmd) (setq cmd (replace-match rootdir t t cmd 1))) ;;(message "New command: %s" cmd) cmd)) -(defcustom semantic-symref-grep-shell "sh" +(defcustom semantic-symref-grep-shell shell-file-name "The shell command to use for executing find/grep. This shell should support pipe redirect syntax." :group 'semantic @@ -140,7 +149,8 @@ This shell should support pipe redirect syntax." (greppat (cond ((eq (oref tool :searchtype) 'regexp) (oref tool searchfor)) (t - (concat "'\\<" (oref tool searchfor) "\\>'")))) + (shell-quote-argument + (concat "\\<" (oref tool searchfor) "\\>"))))) ;; Misc (b (get-buffer-create "*Semantic SymRef*")) (ans nil) @@ -158,10 +168,12 @@ This shell should support pipe redirect syntax." (let ((cmd (concat "find " default-directory " -type f " filepattern " -print0 " "| xargs -0 grep -H " grepflags "-e " greppat))) ;;(message "Old command: %s" cmd) - (call-process semantic-symref-grep-shell nil b nil "-c" cmd) + (call-process semantic-symref-grep-shell nil b nil + shell-command-switch cmd) ) (let ((cmd (semantic-symref-grep-use-template rootdir filepattern grepflags greppat))) - (call-process semantic-symref-grep-shell nil b nil "-c" cmd)) + (call-process semantic-symref-grep-shell nil b nil + shell-command-switch cmd)) )) (setq ans (semantic-symref-parse-tool-output tool b)) ;; Return the answer diff --git a/lisp/cedet/semantic/symref/idutils.el b/lisp/cedet/semantic/symref/idutils.el index c22a6a3..655b000 100644 --- a/lisp/cedet/semantic/symref/idutils.el +++ b/lisp/cedet/semantic/symref/idutils.el @@ -60,7 +60,7 @@ Moves cursor to end of the match." (when (re-search-forward "^\\([^ ]+\\) " nil t) (match-string 1))) (t - (when (re-search-forward "^\\([^ :]+\\):+\\([0-9]+\\):" nil t) + (when (re-search-forward "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):" nil t) (cons (string-to-number (match-string 2)) (expand-file-name (match-string 1) default-directory)) )))) commit 5d3940a3b9144efbc4db4a7b76a3331cebc64165 Author: Artur Malabarba Date: Mon May 4 14:09:29 2015 +0100 * lisp/emacs-lisp/package.el: Remove `package--silence' variable (package-import-keyring, package-refresh-contents) (package-compute-transaction, package--save-selected-packages) (package-install-from-archive, package-delete) (package-menu--perform-transaction): Use `inhibit-message' instead. (package--compile): Set `warning-minimum-level' to :error. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index c2c0f34..ca185ac 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -888,14 +888,12 @@ untar into a directory named DIR; otherwise, signal an error." (defvar generated-autoload-file) (defvar version-control) -(defvar package--silence nil) - (defun package-generate-autoloads (name pkg-dir) (let* ((auto-name (format "%s-autoloads.el" name)) ;;(ignore-name (concat name "-pkg.el")) (generated-autoload-file (expand-file-name auto-name pkg-dir)) ;; Silence `autoload-generate-file-autoloads'. - (noninteractive package--silence) + (noninteractive inhibit-message) (backup-inhibited t) (version-control 'never)) (package-autoload-ensure-default-file generated-autoload-file) @@ -915,10 +913,13 @@ untar into a directory named DIR; otherwise, signal an error." ) ;;;; Compilation +(defvar warning-minimum-level) (defun package--compile (pkg-desc) "Byte-compile installed package PKG-DESC." - (package-activate-1 pkg-desc) - (byte-recompile-directory (package-desc-dir pkg-desc) 0 t)) + (let ((warning-minimum-level :error) + (save-silently inhibit-message)) + (package-activate-1 pkg-desc) + (byte-recompile-directory (package-desc-dir pkg-desc) 0 t))) ;;;; Inferring package from current buffer (defun package-read-from-string (str) @@ -1377,13 +1378,6 @@ it to the file." (declare-function epg-configuration "epg-config" ()) (declare-function epg-import-keys-from-file "epg" (context keys)) -(defun package--message (format &rest args) - "Like `message', except sometimes don't print to minibuffer. -If the variable `package--silence' is non-nil, the message is not -displayed on the echo area." - (let ((inhibit-message package--silence)) - (apply #'message format args))) - ;;;###autoload (defun package-import-keyring (&optional file) "Import keys from FILE." @@ -1394,9 +1388,9 @@ displayed on the echo area." (with-file-modes 448 (make-directory homedir t)) (setf (epg-context-home-directory context) homedir) - (package--message "Importing %s..." (file-name-nondirectory file)) + (message "Importing %s..." (file-name-nondirectory file)) (epg-import-keys-from-file context file) - (package--message "Importing %s...done" (file-name-nondirectory file)))) + (message "Importing %s...done" (file-name-nondirectory file)))) (defvar package--post-download-archives-hook nil "Hook run after the archive contents are downloaded. @@ -1488,14 +1482,14 @@ downloads in the background." (make-directory package-user-dir t)) (let ((default-keyring (expand-file-name "package-keyring.gpg" data-directory)) - (package--silence async)) + (inhibit-message async)) (when (and package-check-signature (file-exists-p default-keyring)) (condition-case-unless-debug error (progn (epg-check-configuration (epg-configuration)) (package-import-keyring default-keyring)) - (error (message "Cannot import default keyring: %S" (cdr error))))) - (package--download-and-read-archives async))) + (error (message "Cannot import default keyring: %S" (cdr error)))))) + (package--download-and-read-archives async)) ;;; Dependency Management @@ -1537,7 +1531,7 @@ SEEN is used internally to detect infinite recursion." ;; we re-add it (along with its dependencies) at an earlier place ;; below (bug#16994). (if (memq already seen) ;Avoid inf-loop on dependency cycles. - (package--message "Dependency cycle going through %S" + (message "Dependency cycle going through %S" (package-desc-full-name already)) (setq packages (delq already packages)) (setq already nil)) @@ -1603,7 +1597,7 @@ Used to populate `package-selected-packages'." (defun package--save-selected-packages (value) "Set and save `package-selected-packages' to VALUE." - (let ((save-silently package--silence)) + (let ((save-silently inhibit-message)) (customize-save-variable 'package-selected-packages (setq package-selected-packages value)))) @@ -1724,7 +1718,8 @@ operation is done." package-unsigned-archives)) ;; If we don't care about the signature, unpack and we're ;; done. - (progn (let ((save-silently async)) + (progn (let ((save-silently async) + (inhibit-message async)) (package-unpack pkg-desc)) (funcall callback)) ;; If we care, check it and *then* write the file. @@ -1740,7 +1735,8 @@ operation is done." (package-desc-name pkg-desc))) ;; Signature checked, unpack now. (with-temp-buffer (insert content) - (let ((save-silently async)) + (let ((save-silently async) + (inhibit-message async)) (package-unpack pkg-desc))) ;; Here the package has been installed successfully, mark it as ;; signed if appropriate. @@ -1886,7 +1882,8 @@ to install it but still mark it as selected." (package-desc-reqs pkg))) (package-compute-transaction () (list (list pkg)))))) (package-download-transaction transaction async callback) - (package--message "`%s' is already installed" (package-desc-full-name pkg)))) + (message "`%s' is already installed" (package-desc-full-name pkg)) + (funcall callback))) (defun package-strip-rcs-id (str) "Strip RCS version ID from the version string STR. @@ -2028,7 +2025,7 @@ If NOSAVE is non-nil, the package is not removed from (delete pkg-desc pkgs) (unless (cdr pkgs) (setq package-alist (delq pkgs package-alist)))) - (package--message "Package `%s' deleted." (package-desc-full-name pkg-desc)))))) + (message "Package `%s' deleted." (package-desc-full-name pkg-desc)))))) ;;;###autoload (defun package-reinstall (pkg) @@ -2908,19 +2905,19 @@ asynchronously." (package-install pkg dont-mark async (lambda () (package-menu--perform-transaction rest delete-list async)))) - ;; Once there are no more packages to install, proceed to - ;; deletion. - (let ((package--silence async)) + (let ((inhibit-message async)) + ;; Once there are no more packages to install, proceed to + ;; deletion. (dolist (elt (package--sort-by-dependence delete-list)) (condition-case-unless-debug err (package-delete elt) - (error (message (cadr err))))) - (when package-selected-packages - (when-let ((removable (package--removable-packages))) - (package--message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)" - (length removable) - (mapconcat #'symbol-name removable ", "))))) + (error (message (cadr err)))))) (message "Transaction done") + (when package-selected-packages + (when-let ((removable (package--removable-packages))) + (message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)" + (length removable) + (mapconcat #'symbol-name removable ", ")))) (package-menu--post-refresh))) (defun package-menu-execute (&optional noquery)