diff options
-rw-r--r-- | doc/lispref/frames.texi | 1 | ||||
-rw-r--r-- | doc/lispref/functions.texi | 11 | ||||
-rw-r--r-- | doc/lispref/symbols.texi | 10 | ||||
-rw-r--r-- | etc/NEWS | 2 | ||||
-rw-r--r-- | lisp/files.el | 23 | ||||
-rw-r--r-- | lisp/progmodes/peg.el | 15 | ||||
-rw-r--r-- | src/data.c | 6 | ||||
-rw-r--r-- | test/lisp/proced-tests.el | 60 | ||||
-rw-r--r-- | test/lisp/progmodes/peg-tests.el | 14 |
9 files changed, 98 insertions, 44 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index edeba3288fc..1b463eb51e5 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -4757,6 +4757,7 @@ to encoding or decoding by any coding system. @node Yanking Media @section Yanking Media +@cindex yank media from window-system selections Data saved within window system selections is not restricted to plain text. It is possible for selection data to encompass images or diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index db2c4197144..bf80a21ee9f 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1510,10 +1510,7 @@ indirect-function}. @kindex void-function This returns the object in the function cell of @var{symbol}. It does not check that the returned object is a legitimate function. - -If the function cell is void, the return value is @code{nil}. It is -impossible to distinguish between a function cell that is void and one -set to @code{nil}. +If the function is void, the return value is @code{nil}. @example @group @@ -1533,9 +1530,9 @@ set to @code{nil}. @end defun @cindex void function cell - If you have never given a symbol any function definition, we say -that that symbol's function cell is @dfn{void}. In other words, the -function cell does not have any Lisp object in it. If you try to call + If you have never given a symbol any function definition, its function +cell contains the default value @code{nil} and we say +that that function is @dfn{void}. If you try to call the symbol as a function, Emacs signals a @code{void-function} error. Unlike with void variables (@pxref{Void Variables}), a symbol's diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index c76bf3d3820..c3dc08df2df 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -100,11 +100,11 @@ the contents of a symbol's function cell, use the function property list. To get a symbol's property list, use the function @code{symbol-plist}. @xref{Symbol Properties}. - The function cell or the value cell may be @dfn{void}, which means -that the cell does not reference any object. (This is not the same -thing as holding the symbol @code{void}, nor the same as holding the -symbol @code{nil}.) Examining a function or value cell that is void -results in an error, such as @samp{Symbol's value as variable is void}. + The value cell may be @dfn{void}, which means that the cell does not +reference any object. (This is not the same thing as holding the symbol +@code{void}, nor the same as holding the symbol @code{nil}.) Examining +a value cell that is void results in an error, such as @samp{Symbol's +value as variable is void}. Because each symbol has separate value and function cells, variables names and function names do not conflict. For example, the symbol @@ -33,7 +33,7 @@ incorrectly in rare cases. --- ** New configuration option '--disable-gc-mark-trace'. -This disables the GC mark trace buffer for about 5 % better garbage +This disables the GC mark trace buffer for about 5% better garbage collection performance. Doing so may make it more difficult for Emacs developers to help finding GC-related bugs that you run into, which is why the mark trace buffer is enabled by default. diff --git a/lisp/files.el b/lisp/files.el index 9c105dbe1a5..54f2397ee37 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1276,10 +1276,27 @@ NOERROR is equal to `reload'), or otherwise emit a warning." ;; file, so we're done. (when (eq lh load-history) ;; If `require' did nothing, we need to make sure that was warranted. - (let ((fn (locate-file (or filename (symbol-name feature)) - load-path (get-load-suffixes)))) + (let* ((fn (locate-file (or filename (symbol-name feature)) + load-path (get-load-suffixes) nil + )) ;; load-prefer-newer + ;; We used to look for `fn' in `load-history' with `assoc' + ;; which works in most cases, but in some cases (e.g. when + ;; `load-prefer-newer' is set) `locate-file' can return a + ;; different file than the file that `require' would load, + ;; so the file won't be found in `load-history' even though + ;; we did load "it". (bug#74040) + ;; So use a "permissive" search which doesn't pay attention to + ;; differences between file extensions. + (prefix (if (string-match + (concat (regexp-opt (get-load-suffixes)) "\\'") fn) + (concat (substring fn 0 (match-beginning 0)) ".") + fn)) + (lh load-history)) + (while (and lh (let ((file (car-safe (car lh)))) + (not (and file (string-prefix-p prefix file))))) + (setq lh (cdr lh))) (cond - ((assoc fn load-history) nil) ;We loaded the right file. + (lh nil) ;We loaded the right file. ((eq noerror 'reload) (load fn nil 'nomessage)) ((and fn (memq feature features)) (let ((oldfile (symbol-file feature 'provide))) diff --git a/lisp/progmodes/peg.el b/lisp/progmodes/peg.el index 96334162195..0b069e95563 100644 --- a/lisp/progmodes/peg.el +++ b/lisp/progmodes/peg.el @@ -412,6 +412,7 @@ sequencing `and' operator of PEG grammars." (full-rname (format "%s %s" name rname))) (push `(define-peg-rule ,full-rname . ,(cdr rule)) defs) (push `(,(peg--rule-id rname) #',(peg--rule-id full-rname)) aliases))) + (require 'cl-lib) `(cl-flet ,aliases ,@defs (eval-and-compile (put ',name 'peg--rules ',aliases))))) @@ -432,7 +433,8 @@ rulesets defined previously with `define-peg-ruleset'." (progn (push rule rulesets) nil) (cons (car rule) (peg-normalize `(and . ,(cdr rule)))))) rules))) - (ctx (assq :peg-rules macroexpand-all-environment))) + (ctx (assq :peg-rules macroexpand-all-environment)) + (body (macroexpand-all `(cl-labels ,(mapcar (lambda (rule) @@ -444,6 +446,15 @@ rulesets defined previously with `define-peg-ruleset'." ,@body) `((:peg-rules ,@(append rules (cdr ctx))) ,@macroexpand-all-environment)))) + (if (null rulesets) + body + `(cl-flet ,(mapcan (lambda (ruleset) + (let ((aliases (get ruleset 'peg--rules))) + (unless aliases + (message "Unknown PEG ruleset: %S" ruleset)) + (copy-sequence aliases))) + rulesets) + ,body)))) ;;;;; Old entry points @@ -645,7 +656,7 @@ rulesets defined previously with `define-peg-ruleset'." (code (peg-translate-exp exp))) (cond ((null msg) code) - (t (macroexp-warn-and-return msg code))))) + (t (macroexp-warn-and-return msg code 'peg nil exp))))) ;; This is the main translation function. (defun peg-translate-exp (exp) diff --git a/src/data.c b/src/data.c index 73dd2f5d4ed..66cf34c1e60 100644 --- a/src/data.c +++ b/src/data.c @@ -756,7 +756,7 @@ global value outside of any lexical scope. */) breaking backward compatibility, as some users of fboundp may expect t in particular, rather than any true value. */ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, - doc: /* Return t if SYMBOL's function definition is neither void nor nil. */) + doc: /* Return t if SYMBOL's function definition is not nil. */) (Lisp_Object symbol) { CHECK_SYMBOL (symbol); @@ -785,7 +785,7 @@ DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, doc: /* Make SYMBOL's function definition be nil. Return SYMBOL. -If a function definition is nil or void, trying to call a function by +If a function definition is nil, trying to call a function by that name will cause a `void-function' error. For more details, see Info node `(elisp) Function Cells'. @@ -800,7 +800,7 @@ See also `makunbound'. */) } DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, - doc: /* Return SYMBOL's function definition, or nil if that is void or nil. */) + doc: /* Return SYMBOL's function definition. */) (Lisp_Object symbol) { CHECK_SYMBOL (symbol); diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el index 6f16a241146..9036c15271c 100644 --- a/test/lisp/proced-tests.el +++ b/test/lisp/proced-tests.el @@ -43,18 +43,31 @@ (defun proced--move-to-column (attribute) "Move to the column under ATTRIBUTE in the current proced buffer." - (move-to-column (string-match attribute proced-header-line))) - -(defun proced--assert-process-valid-pid-refinement (pid) - "Fail unless the process at point could be present after a refinement using PID." - (proced--move-to-column "PID") - (let ((pid-equal (string= pid (word-at-point)))) - (should - (or pid-equal - ;; Guard against the unlikely event a platform doesn't support PPID - (when (string-match "PPID" proced-header-line) - (proced--move-to-column "PPID") - (string= pid (word-at-point))))))) + (move-to-column (string-match attribute proced-header-line)) + ;; Sometimes the column entry does not fill the whole column. + (while (= (char-after (point)) ?\s) (forward-char))) + +(defun proced--assert-process-valid-cpu-refinement (cpu) + "Fail unless the process at point could be present after a refinement using CPU." + (proced--move-to-column "%CPU") + (>= (thing-at-point 'number) cpu)) + +(defun proced--assert-process-valid-cpu-refinement-explainer (cpu) + "Explain the result of `proced--assert-process-valid-cpu-refinement'. + +CPU is as in `proced--assert-process-valid-cpu-refinement'." + `(unexpected-refinement + (header-line + ,(substring-no-properties + (string-replace "%%" "%" (cadr (proced-header-line))))) + (process ,(thing-at-point 'line t)) + (refined-value ,cpu) + (process-value + ,(save-excursion + (proced--move-to-column "%CPU") (thing-at-point 'number))))) + +(put #'proced--assert-process-valid-cpu-refinement 'ert-explainer + #'proced--assert-process-valid-cpu-refinement-explainer) (ert-deftest proced-format-test () (dolist (format '(short medium long verbose)) @@ -85,26 +98,24 @@ (proced--assert-emacs-pid-in-buffer)))) (ert-deftest proced-refine-test () - ;;(skip-unless (memq system-type '(gnu/linux gnu/kfreebsd darwin))) (proced--within-buffer 'verbose 'user - ;; When refining on PID for process A, a process is kept if and only - ;; if its PID is the same as process A, or its parent process is - ;; process A. - (proced--move-to-column "PID") - (let ((pid (word-at-point))) + ;; When refining on %CPU for process A, a process is kept if and only + ;; if its %CPU is greater than or equal to that of process A. + (proced--move-to-column "%CPU") + (let ((cpu (thing-at-point 'number))) (proced-refine) (while (not (eobp)) - (proced--assert-process-valid-pid-refinement pid) + (should (proced--assert-process-valid-cpu-refinement cpu)) (forward-line))))) (ert-deftest proced-refine-with-update-test () (proced--within-buffer 'verbose 'user - (proced--move-to-column "PID") - (let ((pid (word-at-point))) + (proced--move-to-column "%CPU") + (let ((cpu (thing-at-point 'number))) (proced-refine) ;; Don't use (proced-update t) since this will reset `proced-process-alist' ;; and it's possible the process refined on would have exited by that @@ -112,10 +123,13 @@ ;; processes again, causing the test to fail. (proced-update) (while (not (eobp)) - (proced--assert-process-valid-pid-refinement pid) + (should (proced--assert-process-valid-cpu-refinement cpu)) (forward-line))))) (ert-deftest proced-update-preserves-pid-at-point-test () + ;; FIXME: Occasionally the cursor inexplicably changes to the first line which + ;; causes the test to file when the line isn't the Emacs process. + :tags '(:unstable) (proced--within-buffer 'medium 'user @@ -128,7 +142,7 @@ (old-window (get-buffer-window))) (select-window new-window) (with-current-buffer "*Proced*" - (proced-update t t)) + (proced-update)) (select-window old-window) (should (= pid (proced-pid-at-point))))))) diff --git a/test/lisp/progmodes/peg-tests.el b/test/lisp/progmodes/peg-tests.el index 8fab549bcab..b9e9c47ab7c 100644 --- a/test/lisp/progmodes/peg-tests.el +++ b/test/lisp/progmodes/peg-tests.el @@ -180,6 +180,20 @@ resp. succeeded instead of signaling an error." (should (eobp))) ) +(define-peg-ruleset peg-test-myrules + (sign () (or "+" "-" "")) + (digit () [0-9]) + (nat () digit (* digit)) + (int () sign digit (* digit)) + (float () int "." nat)) + +(ert-deftest peg-test-ruleset () + (with-peg-rules + (peg-test-myrules + (complex float "+i" float)) + (should (peg-parse-string nat "123" t)) + (should (not (peg-parse-string nat "home" t))))) + ;;; Examples: ;; peg-ex-recognize-int recognizes integers. An integer begins with a |