diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-12-07 19:21:57 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-12-07 19:21:57 +0200 |
commit | ce1d7b61f12dcc1b67535b68d9b0655b45fcadb6 (patch) | |
tree | 881d03f4f486933482cd2e3851184cd3b172ef1b /lisp/emacs-lisp | |
parent | 6630df25238c5a1efa2bc6a0fa7889782e8c91b5 (diff) | |
parent | fa6fa1a1773f255b5efbe52a743b017f4908a6cb (diff) | |
download | emacs-ce1d7b61f12dcc1b67535b68d9b0655b45fcadb6.tar.gz emacs-ce1d7b61f12dcc1b67535b68d9b0655b45fcadb6.tar.bz2 emacs-ce1d7b61f12dcc1b67535b68d9b0655b45fcadb6.zip |
Merge from trunk.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/authors.el | 1 | ||||
-rw-r--r-- | lisp/emacs-lisp/byte-run.el | 11 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 30 | ||||
-rw-r--r-- | lisp/emacs-lisp/debug.el | 84 | ||||
-rw-r--r-- | lisp/emacs-lisp/eldoc.el | 19 | ||||
-rw-r--r-- | lisp/emacs-lisp/helpers.el | 32 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp-mnt.el | 4 | ||||
-rw-r--r-- | lisp/emacs-lisp/package.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/regexp-opt.el | 4 |
9 files changed, 149 insertions, 38 deletions
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el index 92796ac4e99..abb34d80348 100644 --- a/lisp/emacs-lisp/authors.el +++ b/lisp/emacs-lisp/authors.el @@ -617,6 +617,7 @@ in the repository.") ("config.h.in" . "config.in") ("paths.h-dist" . "paths.h.in") ("patch1" . "sed1.inp") + ("enriched.doc" . "enriched.txt") ("GETTING.GNU.SOFTWARE" . "FTP") ("etc/MACHINES" . "MACHINES") ("ONEWS" . "NEWS.19") diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 7ec24cc2aad..6beef7165d1 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -112,10 +112,10 @@ to set this property.") ''edebug-form-spec (list 'quote spec))))) defun-declarations-alist) "List associating properties of macros to their macro expansion. -Each element of the list takes the form (PROP FUN) where FUN is -a function. For each (PROP . VALUES) in a macro's declaration, -the FUN corresponding to PROP is called with the function name -and the VALUES and should return the code to use to set this property.") +Each element of the list takes the form (PROP FUN) where FUN is a function. +For each (PROP . VALUES) in a macro's declaration, the FUN corresponding +to PROP is called with the macro name, the macro's arglist, and the VALUES +and should return the code to use to set this property.") (put 'defmacro 'doc-string-elt 3) (put 'defmacro 'lisp-indent-function 2) @@ -285,7 +285,6 @@ was first made obsolete, for example a date or a release number." (declare (advertised-calling-convention ;; New code should always provide the `when' argument. (obsolete-name current-name when) "23.1")) - (interactive "aMake function obsolete: \nxObsoletion replacement: ") (put obsolete-name 'byte-obsolete-info ;; The second entry used to hold the `byte-compile' handler, but ;; is not used any more nowadays. @@ -392,7 +391,7 @@ If you think you need this, you're probably making a mistake somewhere." "Like `progn', but evaluates the body at compile time if you're compiling. Thus, the result of the body appears to the compiler as a quoted constant. In interpreted code, this is entirely equivalent to `progn'." - (declare (debug t) (indent 0)) + (declare (debug (def-body)) (indent 0)) (list 'quote (eval (cons 'progn body) lexical-binding))) (defmacro eval-and-compile (&rest body) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e0d474bbb9f..4d91389a3e0 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -353,11 +353,11 @@ else the global value will be modified." (t (append byte-compile-warnings (list warning))))))) -(defvar byte-compile-interactive-only-functions - '(beginning-of-buffer end-of-buffer replace-string replace-regexp - insert-file insert-buffer insert-file-literally previous-line next-line - goto-line comint-run delete-backward-char) +(defvar byte-compile-interactive-only-functions nil "List of commands that are not meant to be called from Lisp.") +(make-obsolete-variable 'byte-compile-interactive-only-functions + "use the `interactive-only' symbol property instead" + "24.4") (defvar byte-compile-not-obsolete-vars nil "List of variables that shouldn't be reported as obsolete.") @@ -2929,13 +2929,23 @@ for symbols generated by the byte compiler itself." (byte-compile-variable-ref form)))) ((symbolp (car form)) (let* ((fn (car form)) - (handler (get fn 'byte-compile))) + (handler (get fn 'byte-compile)) + (interactive-only + (or (get fn 'interactive-only) + (memq fn byte-compile-interactive-only-functions)))) (when (macroexp--const-symbol-p fn) (byte-compile-warn "`%s' called as a function" fn)) - (and (byte-compile-warning-enabled-p 'interactive-only) - (memq fn byte-compile-interactive-only-functions) - (byte-compile-warn "`%s' used from Lisp code\n\ -That command is designed for interactive use only" fn)) + (when (and (byte-compile-warning-enabled-p 'interactive-only) + interactive-only) + (byte-compile-warn "`%s' is for interactive use only%s" + fn + (cond ((stringp interactive-only) + (format "; %s" interactive-only)) + ((and (symbolp 'interactive-only) + (not (eq interactive-only t))) + (format "; use `%s' instead." + interactive-only)) + (t ".")))) (if (and (fboundp (car form)) (eq (car-safe (symbol-function (car form))) 'macro)) (byte-compile-log-warning @@ -3598,7 +3608,7 @@ discarding." (byte-compile-constant (if (eq 'lambda (car-safe f)) (byte-compile-lambda f) f)))) - + (defun byte-compile-indent-to (form) (let ((len (length form))) (cond ((= len 2) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 6c7a0d2db1d..87d1d1eae64 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -204,7 +204,7 @@ first will be printed into the backtrace buffer." (window-resize debugger-window (- debugger-previous-window-height - (window-total-size debugger-window))) + (window-total-height debugger-window))) (error nil))) (setq debugger-previous-window debugger-window)) (debugger-mode) @@ -236,7 +236,7 @@ first will be printed into the backtrace buffer." (eq (window-buffer debugger-window) debugger-buffer)) ;; Record height of debugger window. (setq debugger-previous-window-height - (window-total-size debugger-window))) + (window-total-height debugger-window))) (if debugger-will-be-back ;; Restore previous window configuration (Bug#12623). (set-window-configuration window-configuration) @@ -494,9 +494,13 @@ removes itself from that hook." (forward-line 1) (while (progn (forward-char 2) - (if (= (following-char) ?\() - (forward-sexp 1) - (forward-sexp 2)) + (cond ((debugger--locals-visible-p) + (goto-char (next-single-char-property-change + (point) 'locals-visible))) + ((= (following-char) ?\() + (forward-sexp 1)) + (t + (forward-sexp 2))) (forward-line 1) (<= (point) opoint)) (if (looking-at " *;;;") @@ -541,6 +545,14 @@ Applies to the frame whose line point is on in the backtrace." (progn ,@body) (setq debugger-outer-match-data (match-data))))) +(defun debugger--backtrace-base () + "Return the function name that marks the top of the backtrace. +See `backtrace-frame'." + (cond ((eq 'debug--implement-debug-on-entry + (cadr (backtrace-frame 1 'debug))) + 'debug--implement-debug-on-entry) + (t 'debug))) + (defun debugger-eval-expression (exp &optional nframe) "Eval an expression, in an environment like that outside the debugger. The environment used is the one when entering the activation frame at point." @@ -549,15 +561,70 @@ The environment used is the one when entering the activation frame at point." (let ((nframe (or nframe (condition-case nil (1+ (debugger-frame-number 'skip-base)) (error 0)))) ;; If on first line. - (base (if (eq 'debug--implement-debug-on-entry - (cadr (backtrace-frame 1 'debug))) - 'debug--implement-debug-on-entry 'debug))) + (base (debugger--backtrace-base))) (debugger-env-macro (let ((val (backtrace-eval exp nframe base))) (prog1 (prin1 val t) (let ((str (eval-expression-print-format val))) (if str (princ str t)))))))) + +(defun debugger--locals-visible-p () + "Are the local variables of the current stack frame visible?" + (save-excursion + (move-to-column 2) + (get-text-property (point) 'locals-visible))) + +(defun debugger--insert-locals (locals) + "Insert the local variables LOCALS at point." + (cond ((null locals) + (insert "\n [no locals]")) + (t + (let ((print-escape-newlines t)) + (dolist (s+v locals) + (let ((symbol (car s+v)) + (value (cdr s+v))) + (insert "\n ") + (prin1 symbol (current-buffer)) + (insert " = ") + (prin1 value (current-buffer)))))))) + +(defun debugger--show-locals () + "For the frame at point, insert locals and add text properties." + (let* ((nframe (1+ (debugger-frame-number 'skip-base))) + (base (debugger--backtrace-base)) + (locals (backtrace--locals nframe base)) + (inhibit-read-only t)) + (save-excursion + (let ((start (progn + (move-to-column 2) + (point)))) + (end-of-line) + (debugger--insert-locals locals) + (add-text-properties start (point) '(locals-visible t)))))) + +(defun debugger--hide-locals () + "Delete local variables and remove the text property." + (let* ((col (current-column)) + (end (progn + (move-to-column 2) + (next-single-char-property-change (point) 'locals-visible))) + (start (previous-single-char-property-change end 'locals-visible)) + (inhibit-read-only t)) + (remove-text-properties start end '(locals-visible)) + (goto-char start) + (end-of-line) + (delete-region (point) end) + (move-to-column col))) + +(defun debugger-toggle-locals () + "Show or hide local variables of the current stack frame." + (interactive) + (cond ((debugger--locals-visible-p) + (debugger--hide-locals)) + (t + (debugger--show-locals)))) + (defvar debugger-mode-map (let ((map (make-keymap)) @@ -575,6 +642,7 @@ The environment used is the one when entering the activation frame at point." (define-key map "h" 'describe-mode) (define-key map "q" 'top-level) (define-key map "e" 'debugger-eval-expression) + (define-key map "v" 'debugger-toggle-locals) ;"v" is for "v"ariables. (define-key map " " 'next-line) (define-key map "R" 'debugger-record-expression) (define-key map "\C-m" 'debug-help-follow) diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 250f93800ec..8ec6b41efe7 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -216,6 +216,9 @@ expression point is on." Otherwise work like `message'." (if (minibufferp) (progn + (add-hook 'minibuffer-exit-hook + (lambda () (setq eldoc-mode-line-string nil)) + nil t) (with-current-buffer (window-buffer (or (window-in-direction 'above (minibuffer-window)) @@ -226,17 +229,11 @@ Otherwise work like `message'." (setq mode-line-format (list "" '(eldoc-mode-line-string (" " eldoc-mode-line-string " ")) - mode-line-format)))) - (add-hook 'minibuffer-exit-hook - (lambda () (setq eldoc-mode-line-string nil)) - nil t) - (cond - ((null format-string) - (setq eldoc-mode-line-string nil)) - ((stringp format-string) - (setq eldoc-mode-line-string - (apply 'format format-string args)))) - (force-mode-line-update)) + mode-line-format))) + (setq eldoc-mode-line-string + (when (stringp format-string) + (apply 'format format-string args))) + (force-mode-line-update))) (apply 'message format-string args))) (defun eldoc-message (&rest args) diff --git a/lisp/emacs-lisp/helpers.el b/lisp/emacs-lisp/helpers.el index 73c2ff1c15c..8049f4e1d1d 100644 --- a/lisp/emacs-lisp/helpers.el +++ b/lisp/emacs-lisp/helpers.el @@ -37,6 +37,38 @@ (maphash (lambda (_k v) (push v values)) hash-table) values)) +(defsubst string-empty-p (string) + "Check whether STRING is empty." + (string= string "")) + +(defsubst string-join (strings &optional separator) + "Join all STRINGS using SEPARATOR." + (mapconcat 'identity strings separator)) + +(defsubst string-reverse (str) + "Reverse the string STR." + (apply 'string (nreverse (string-to-list str)))) + +(defsubst string-trim-left (string) + "Remove leading whitespace from STRING." + (if (string-match "\\`[ \t\n\r]+" string) + (replace-match "" t t string) + string)) + +(defsubst string-trim-right (string) + "Remove trailing whitespace from STRING." + (if (string-match "[ \t\n\r]+\\'" string) + (replace-match "" t t string) + string)) + +(defsubst string-trim (string) + "Remove leading and trailing whitespace from STRING." + (string-trim-left (string-trim-right string))) + +(defsubst string-blank-p (string) + "Check whether STRING is either empty or only whitespace." + (string-empty-p (string-trim string))) + (provide 'helpers) ;;; helpers.el ends here diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index f2e691102d4..8e8b8747a29 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -461,8 +461,8 @@ each line." (let ((keywords (lm-keywords file))) (if keywords (if (string-match-p "," keywords) - (split-string keywords ",[ \t\n]*" t) - (split-string keywords "[ \t\n]+" t))))) + (split-string keywords ",[ \t\n]*" t "[ ]+") + (split-string keywords "[ \t\n]+" t "[ ]+"))))) (defvar finder-known-keywords) (defun lm-keywords-finder-p (&optional file) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e8768ea6ac9..853c83e2fa2 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1403,6 +1403,8 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages." 'action 'package-install-button-action))) (t (insert (capitalize status) "."))) (insert "\n") + (insert " " (propertize "Archive" 'font-lock-face 'bold) + ": " (or archive "n/a") "\n") (and version (insert " " (propertize "Version" 'font-lock-face 'bold) ": " diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index de9966c0af0..cb7828ddd95 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -285,7 +285,9 @@ CHARS should be a list of characters." ;; ;; Make sure a caret is not first and a dash is first or last. (if (and (string-equal charset "") (string-equal bracket "")) - (concat "[" dash caret "]") + (if (string-equal dash "") + "\\^" ; [^] is not a valid regexp + (concat "[" dash caret "]")) (concat "[" bracket charset caret dash "]")))) (provide 'regexp-opt) |