diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index a175edcc671..74bef264bf1 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -296,13 +296,9 @@ reflect the change." This function displays the message produced by formatting ARGS with FORMAT-STRING on the mode line when the current buffer is a minibuffer. Otherwise, it displays the message like `message' would." - (if (minibufferp) + (if (or (bound-and-true-p edebug-mode) (minibufferp)) (progn - (add-hook 'minibuffer-exit-hook - (lambda () (setq eldoc-mode-line-string nil - ;; https://debbugs.gnu.org/16920 - eldoc-last-message nil)) - nil t) + (add-hook 'post-command-hook #'eldoc-minibuffer--cleanup) (with-current-buffer (window-buffer (or (window-in-direction 'above (minibuffer-window)) @@ -321,6 +317,13 @@ Otherwise, it displays the message like `message' would." (force-mode-line-update))) (apply #'message format-string args))) +(defun eldoc-minibuffer--cleanup () + (unless (or (bound-and-true-p edebug-mode) (minibufferp)) + (setq eldoc-mode-line-string nil + ;; https://debbugs.gnu.org/16920 + eldoc-last-message nil) + (remove-hook 'post-command-hook #'eldoc-minibuffer--cleanup))) + (make-obsolete 'eldoc-message "use `eldoc-documentation-functions' instead." "eldoc-1.1.0") (defun eldoc-message (&optional string) (eldoc--message string)) @@ -388,7 +391,6 @@ Also store it in `eldoc-last-message' and return that value." (defun eldoc-display-message-no-interference-p () "Return nil if displaying a message would cause interference." (not (or executing-kbd-macro - (bound-and-true-p edebug-active) ;; The following configuration shows "Matches..." in the ;; echo area when point is after a closing bracket, which ;; conflicts with eldoc. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index f4cfffa2e8a..8d3fe010af4 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -6862,10 +6862,9 @@ are not included." (defun message-setup-1 (headers &optional yank-action actions return-action) (dolist (action actions) - (condition-case nil - ;; FIXME: Use functions rather than expressions! - (add-to-list 'message-send-actions - `(apply #',(car action) ',(cdr action))))) + ;; FIXME: Use functions rather than expressions! + (add-to-list 'message-send-actions + `(apply #',(car action) ',(cdr action)))) (setq message-return-action return-action) (setq message-reply-buffer (if (and (consp yank-action) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 47fdf3e7913..e0b591739ef 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -137,10 +137,11 @@ See `icomplete-delay-completions-threshold'." "Maximum number of initial chars to apply `icomplete-compute-delay'." :type 'integer) -(defvar icomplete-in-buffer nil +(defcustom icomplete-in-buffer nil "If non-nil, also use Icomplete when completing in non-mini buffers. This affects commands like `completion-in-region', but not commands -that use their own completions setup.") +that use their own completions setup." + :type 'boolean) (defcustom icomplete-minibuffer-setup-hook nil "Icomplete-specific customization of minibuffer setup. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 037a53421a8..81446c3c00b 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1651,7 +1651,7 @@ This function does not do any hidden buffer changes." ;; comment, but XEmacs doesn't. We depend on the Emacs ;; behavior (which also is symmetric). (if (and (eolp) (elt (parse-partial-sexp start (point)) 7)) - (condition-case nil (forward-char 1))) + (forward-char 1)) t)))) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index beccb8182a7..d2c4da794ac 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1850,93 +1850,92 @@ For example: File.open See `add-log-current-defun-function'." - (condition-case nil - (save-excursion - (let* ((indent (ruby--add-log-current-indent)) - mname mlist - (start (point)) - (make-definition-re - (lambda (re &optional method-name?) - (concat "^[ \t]*" re "[ \t]+" - "\\(" - ;; \\. and :: for class methods - "\\([A-Za-z_]" ruby-symbol-re "*[?!]?" - "\\|" - (if method-name? ruby-operator-re "\\.") - "\\|::" "\\)" - "+\\)"))) - (definition-re (funcall make-definition-re ruby-defun-beg-re t)) - (module-re (funcall make-definition-re "\\(class\\|module\\)"))) - ;; Get the current method definition (or class/module). - (when (catch 'found - (while (and (re-search-backward definition-re nil t) - (if (if (string-equal "def" (match-string 1)) - ;; We're inside a method. - (if (ruby-block-contains-point (1- start)) - t - ;; Try to match a method only once. - (setq definition-re module-re) - nil) - ;; Class/module. For performance, - ;; comparing indentation. - (or (not (numberp indent)) - (> indent (current-indentation)))) - (throw 'found t) - t)))) - (goto-char (match-beginning 1)) - (if (not (string-equal "def" (match-string 1))) - (setq mlist (list (match-string 2))) - (setq mname (match-string 2))) - (setq indent (current-column)) - (beginning-of-line)) - ;; Walk up the class/module nesting. - (while (and indent - (> indent 0) - (re-search-backward module-re nil t)) - (goto-char (match-beginning 1)) - (when (< (current-column) indent) - (setq mlist (cons (match-string 2) mlist)) - (setq indent (current-column)) - (beginning-of-line))) - ;; Process the method name. - (when mname - (let ((mn (split-string mname "\\.\\|::"))) - (if (cdr mn) - (progn - (unless (string-equal "self" (car mn)) ; def self.foo - ;; def C.foo - (let ((ml (nreverse mlist))) - ;; If the method name references one of the - ;; containing modules, drop the more nested ones. - (while ml - (if (string-equal (car ml) (car mn)) - (setq mlist (nreverse (cdr ml)) ml nil)) - (or (setq ml (cdr ml)) (nreverse mlist)))) - (if mlist - (setcdr (last mlist) (butlast mn)) - (setq mlist (butlast mn)))) - (setq mname (concat "." (car (last mn))))) - ;; See if the method is in singleton class context. - (let ((in-singleton-class - (when (re-search-forward ruby-singleton-class-re start t) - (goto-char (match-beginning 0)) - ;; FIXME: Optimize it out, too? - ;; This can be slow in a large file, but - ;; unlike class/module declaration - ;; indentations, method definitions can be - ;; intermixed with these, and may or may not - ;; be additionally indented after visibility - ;; keywords. - (ruby-block-contains-point start)))) - (setq mname (concat - (if in-singleton-class "." "#") - mname)))))) - ;; Generate the string. - (if (consp mlist) - (setq mlist (mapconcat (function identity) mlist "::"))) - (if mname - (if mlist (concat mlist mname) mname) - mlist))))) + (save-excursion + (let* ((indent (ruby--add-log-current-indent)) + mname mlist + (start (point)) + (make-definition-re + (lambda (re &optional method-name?) + (concat "^[ \t]*" re "[ \t]+" + "\\(" + ;; \\. and :: for class methods + "\\([A-Za-z_]" ruby-symbol-re "*[?!]?" + "\\|" + (if method-name? ruby-operator-re "\\.") + "\\|::" "\\)" + "+\\)"))) + (definition-re (funcall make-definition-re ruby-defun-beg-re t)) + (module-re (funcall make-definition-re "\\(class\\|module\\)"))) + ;; Get the current method definition (or class/module). + (when (catch 'found + (while (and (re-search-backward definition-re nil t) + (if (if (string-equal "def" (match-string 1)) + ;; We're inside a method. + (if (ruby-block-contains-point (1- start)) + t + ;; Try to match a method only once. + (setq definition-re module-re) + nil) + ;; Class/module. For performance, + ;; comparing indentation. + (or (not (numberp indent)) + (> indent (current-indentation)))) + (throw 'found t) + t)))) + (goto-char (match-beginning 1)) + (if (not (string-equal "def" (match-string 1))) + (setq mlist (list (match-string 2))) + (setq mname (match-string 2))) + (setq indent (current-column)) + (beginning-of-line)) + ;; Walk up the class/module nesting. + (while (and indent + (> indent 0) + (re-search-backward module-re nil t)) + (goto-char (match-beginning 1)) + (when (< (current-column) indent) + (setq mlist (cons (match-string 2) mlist)) + (setq indent (current-column)) + (beginning-of-line))) + ;; Process the method name. + (when mname + (let ((mn (split-string mname "\\.\\|::"))) + (if (cdr mn) + (progn + (unless (string-equal "self" (car mn)) ; def self.foo + ;; def C.foo + (let ((ml (nreverse mlist))) + ;; If the method name references one of the + ;; containing modules, drop the more nested ones. + (while ml + (if (string-equal (car ml) (car mn)) + (setq mlist (nreverse (cdr ml)) ml nil)) + (or (setq ml (cdr ml)) (nreverse mlist)))) + (if mlist + (setcdr (last mlist) (butlast mn)) + (setq mlist (butlast mn)))) + (setq mname (concat "." (car (last mn))))) + ;; See if the method is in singleton class context. + (let ((in-singleton-class + (when (re-search-forward ruby-singleton-class-re start t) + (goto-char (match-beginning 0)) + ;; FIXME: Optimize it out, too? + ;; This can be slow in a large file, but + ;; unlike class/module declaration + ;; indentations, method definitions can be + ;; intermixed with these, and may or may not + ;; be additionally indented after visibility + ;; keywords. + (ruby-block-contains-point start)))) + (setq mname (concat + (if in-singleton-class "." "#") + mname)))))) + ;; Generate the string. + (if (consp mlist) + (setq mlist (mapconcat (function identity) mlist "::"))) + (if mname + (if mlist (concat mlist mname) mname) + mlist)))) (defun ruby-block-contains-point (pt) (save-excursion