summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2017-10-06 09:50:54 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2017-10-06 09:50:54 -0400
commit11f9cb522fed9aa6552f6315340ca7352661a1e8 (patch)
tree39facc48471c67b321c045e47d70ef030adbea44 /lisp/emacs-lisp
parent92045f4546b9708dc9f69954799d211c1f56ff1e (diff)
parent9655937da4a339300c624addd97674c038a01bc9 (diff)
downloademacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.tar.gz
emacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.tar.bz2
emacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.zip
Merge emacs-26
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el22
-rw-r--r--lisp/emacs-lisp/checkdoc.el19
-rw-r--r--lisp/emacs-lisp/cl-print.el2
-rw-r--r--lisp/emacs-lisp/generator.el3
-rw-r--r--lisp/emacs-lisp/tabulated-list.el11
5 files changed, 46 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 1b42961f1a4..590db570c56 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1183,7 +1183,29 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(compilation-forget-errors)
pt))))
+(defvar byte-compile-log-warning-function
+ #'byte-compile--log-warning-for-byte-compile
+ "Function called when encountering a warning or error.
+Called with arguments (STRING POSITION FILL LEVEL). STRING is a
+message describing the problem. POSITION is a buffer position
+where the problem was detected. FILL is a prefix as in
+`warning-fill-prefix'. LEVEL is the level of the
+problem (`:warning' or `:error'). POSITION, FILL and LEVEL may be
+nil.")
+
(defun byte-compile-log-warning (string &optional fill level)
+ "Log a byte-compilation warning.
+STRING, FILL and LEVEL are as described in
+`byte-compile-log-warning-function', which see."
+ (funcall byte-compile-log-warning-function
+ string byte-compile-last-position
+ fill
+ level))
+
+(defun byte-compile--log-warning-for-byte-compile (string &optional
+ _position
+ fill
+ level)
"Log a message STRING in `byte-compile-log-buffer'.
Also log the current function and file if not already done. If
FILL is non-nil, set `warning-fill-prefix' to four spaces. LEVEL
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 7997ba6014c..72f82f26f6f 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1147,14 +1147,27 @@ Prefix argument is the same as for `checkdoc-defun'"
;; features and behaviors, so we need some ways of specifying
;; them, and making them easier to use in the wacked-out interfaces
;; people are requesting
-(defun checkdoc-create-error (text start end &optional unfixable)
- "Used to create the return error text returned from all engines.
+(defvar checkdoc-create-error-function #'checkdoc--create-error-for-checkdoc
+ "Function called when Checkdoc encounters an error.
+Should accept as arguments (TEXT START END &optional UNFIXABLE).
+
TEXT is the descriptive text of the error. START and END define the region
it is sensible to highlight when describing the problem.
Optional argument UNFIXABLE means that the error has no auto-fix available.
A list of the form (TEXT START END UNFIXABLE) is returned if we are not
-generating a buffered list of errors."
+generating a buffered list of errors.")
+
+(defun checkdoc-create-error (text start end &optional unfixable)
+ "Used to create the return error text returned from all engines.
+TEXT, START, END and UNFIXABLE conform to
+`checkdoc-create-error-function', which see."
+ (funcall checkdoc-create-error-function text start end unfixable))
+
+(defun checkdoc--create-error-for-checkdoc (text start end &optional unfixable)
+ "Create an error for Checkdoc.
+TEXT, START, END and UNFIXABLE conform to
+`checkdoc-create-error-function', which see."
(if checkdoc-generate-compile-warnings-flag
(progn (checkdoc-error start text)
nil)
diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 87c03280f77..4fc178c29aa 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -268,7 +268,7 @@ into a button whose action shows the function's disassembly.")
Output is further controlled by the variables
`cl-print-readably', `cl-print-compiled', along with output
variables for the standard printing functions. See Info
-node `(elisp)Output Variables'. "
+node `(elisp)Output Variables'."
(cond
(cl-print-readably (prin1 object stream))
((not print-circle) (cl-print-object object stream))
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el
index f3597cc387d..3e9885900cf 100644
--- a/lisp/emacs-lisp/generator.el
+++ b/lisp/emacs-lisp/generator.el
@@ -142,8 +142,7 @@ the CPS state machinery.
`(let ((,dynamic-var ,static-var))
(unwind-protect ; Update the static shadow after evaluation is done
,form
- (setf ,static-var ,dynamic-var))
- ,form)))
+ (setf ,static-var ,dynamic-var)))))
(defmacro cps--with-dynamic-binding (dynamic-var static-var &rest body)
"Evaluate BODY such that generated atomic evaluations run with
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index e940588db7b..d1d7c0a8042 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -329,6 +329,8 @@ Check the current row, the previous one and the next row."
(string-width (if (stringp nt) nt (car nt)))))
tabulated-list--near-rows)))
+(defvar tabulated-list-entry-lnum-width nil)
+
(defun tabulated-list-print (&optional remember-pos update)
"Populate the current Tabulated List mode buffer.
This sorts the `tabulated-list-entries' list if sorting is
@@ -371,6 +373,7 @@ changing `tabulated-list-sort-key'."
(unless tabulated-list-use-header-line
(tabulated-list-print-fake-header)))
;; Finally, print the resulting list.
+ (setq tabulated-list-entry-lnum-width (tabulated-list-line-number-width))
(while entries
(let* ((elt (car entries))
(tabulated-list--near-rows
@@ -383,7 +386,7 @@ changing `tabulated-list-sort-key'."
(equal entry-id id)
(setq entry-id nil
saved-pt (point)))
- ;; If the buffer this empty, simply print each elt.
+ ;; If the buffer is empty, simply print each elt.
(if (or (not update) (eobp))
(apply tabulated-list-printer elt)
(while (let ((local-id (tabulated-list-get-id)))
@@ -424,12 +427,10 @@ of column descriptors."
(let ((beg (point))
(x (max tabulated-list-padding 0))
(ncols (length tabulated-list-format))
- (lnum-width (tabulated-list-line-number-width))
(inhibit-read-only t))
- (if display-line-numbers
- (setq x (+ x lnum-width)))
+ (setq x (+ x tabulated-list-entry-lnum-width))
(if (> tabulated-list-padding 0)
- (insert (make-string (- x lnum-width) ?\s)))
+ (insert (make-string (- x tabulated-list-entry-lnum-width) ?\s)))
(let ((tabulated-list--near-rows ; Bind it if not bound yet (Bug#25506).
(or (bound-and-true-p tabulated-list--near-rows)
(list (or (tabulated-list-get-entry (point-at-bol 0))