Commit 98ac36ef authored by Paul Eggert's avatar Paul Eggert

Merge from origin/emacs-26

1e594964 ; * src/gtkutil.c (xg_create_frame_widgets): Add FIXME re....
e7c8da4d bug#28609: simple.el
827db6b5 Use a separate syntax-ppss cache for narrowed buffers
a2244f41 Improve python3-compatibility of fallback completion (Bug#...
79162cb0 Fix subr-x-tests when running from elc
66d35ae4 * lisp/eshell/esh-util.el (eshell-condition-case): Add deb...
f5e72b04 Make sh-indentation into an alias for sh-basic-offset (Bug...
a58d0c59 Fix loading of smie-config rules (Bug#24848)
3a68dec3 ; Update NEWS for the change in eldoc-message
5a41dd0a Reset default-directory inside *xref-grep* buffer
49cd561d * test/lisp/tramp-tests.el (tramp-test21-file-links): Spec...
b719f6b2 Loosen strict parsing requirement for desktop files
c7a0c137 * lisp/xdg.el (xdg-thumb-uri): Fix doc string.
dc6b3560 Fix documentation of `make-frame' and related variables an...
3d3778d8 Accept new `always' value for option `buffer-offer-save'
638f64c4 Improve new NS scrolling variable names
d9330124 Document 'replace-buffer-contents' in the manual.
00e4e3e9 Fix undecorated frame resizing issues on NS (bug#28512)
820739bb ; * doc/emacs/display.texi (Display Custom): Fix wording.
f2b22015 ; Spelling and URL fixes
0e143b1f Documentation improvements for 'display-line-numbers'
f656ccdb ; Fix typo
d64da52d Fix last change in bat-mode.el
908af46a Fix restoring in GUI sessions desktop saved in TTY sessions
51cbd854 Improve syntax highlighting in bat-mode
02739166 Document the 'list-FOO' convention
d24ec585 Expose viewing conditions in CAM02-UCS metric
a81d5a3d Revert "Set frame size to actual requested size (bug#18215)"
0bf066d4 Add tests for Edebug
68baca3e Catch more messages in ert-with-message-capture
28e0c410 ; * lisp/mouse.el (secondary-selection-exist-p): Doc fix.
31e1d9ef Support setting region from secondary selection and vice v...
047f02f0 Fix new copy-directory bug with empty dirs
fbd15836 * doc/lispref/strings.texi (Formatting Strings): Improve i...
f16a8d5d Fix 2 testsuite tests for MS-Windows
965cffd8 Rename timer-list to list-timers
a5fec62b Provide native touchpad scrolling on macOS
7b3d1c6b Fix MinGW64 build broken by recent MinGW64 import libraries
c83d0c5f Fix crashes in 'move-point-visually' in minibuffer windows
7f3d5f92 * src/emacs.c (usage_message): Don't mention 'find-file'.
68452822 Fix a minor inaccuracy in the Emacs manual
74d7bb94 Fix errors in flyspell-post-command-hook
40fdbb01 Work on Tramp's file-truename
1a01423b Fix bug with make-directory on MS-Windows root
066efb86 Fix log-view-diff-common when point is after last entry
3f006b56 Adapt fileio-tests--symlink-failure to Cygwin
ee512e9a Ignore buffers whose name begins with a space in save-some...
9e1b5bd9 Improve tramp-interrupt-process robustness
8d4223e6 Minor Tramp doc update
331d0e52 Fix gensym
466df76f Cleanup in files-tests.el
6359fe63 Remove old cl-assert calls in 'newline'
059184e6 Avoid crash with C-g C-g in GC
541006c5 Fix format-time-string %Z bug with negative tz
679e05ee message-citation-line-format %Z is now tz name
4e8888d4 Use doc-view or pdf-tools on any window-system
5f28f0db Fix bug with min and max and NaNs
37b5e661 Fix recently-introduced copy-directory bug
6bbbc38b Merge from Gnulib
57249fb2 Fix compatibility problem in Tramp
411bec82 Avoid GCC 7 compilation warning in eval.c
34a6774d ; Partially revert c3445aed
3003ac04 Adapt Tramp version.  Do not merge
48d39c39 Search for Syntax section when viewing MDN
9d101376 Allow smerge-keep-current to work for empty hunks
13aba24a Call vc-setup-buffer in vc-git-log-{in,out}going
1d599df5 Fix last change to textmodes/page-ext.el
a726e09a * test/src/lcms-tests.el (lcms-cri-cam02-ucs): Skip if lcm...
546413e1 * test/src/lcms-tests.el (lcms-whitepoint): Skip if lcms2 ...
96aaeaaf ; * src/lcms.c: Minor stylistic changes in comments.
c3df8165 Fix compilation warning in etags.c
parents 5406be4d 1e594964
......@@ -51,6 +51,12 @@ sets the XTerm window title. The default is to set the window title.
** The FILENAME argument to 'file-name-base' is now mandatory and no
longer defaults to 'buffer-file-name'.
---
** 'eldoc-message' only accepts one argument now. Programs that
called it with multiple arguments before should pass them through
'format' first. Even that is discouraged: for ElDoc support, you
should set 'eldoc-documentation-function' instead of calling
'eldoc-message' directly.
* Lisp Changes in Emacs 27.1
......
......@@ -1956,7 +1956,7 @@ E.g. provided via a file-local call to `smie-config-local'.")
(defvar smie-config--modefuns nil)
(defun smie-config--setter (var value)
(setq-default var value)
(set-default var value)
(let ((old-modefuns smie-config--modefuns))
(setq smie-config--modefuns nil)
(pcase-dolist (`(,mode . ,rules) value)
......@@ -1982,7 +1982,7 @@ value with which to replace it."
;; FIXME improve value-type.
:type '(choice (const nil)
(alist :key-type symbol))
:initialize 'custom-initialize-default
:initialize 'custom-initialize-set
:set #'smie-config--setter)
(defun smie-config-local (rules)
......
......@@ -381,10 +381,26 @@ This function should move the cursor back to some syntactically safe
point (where the PPSS is equivalent to nil).")
(make-obsolete-variable 'syntax-begin-function nil "25.1")
(defvar-local syntax-ppss-cache nil
"List of (POS . PPSS) pairs, in decreasing POS order.")
(defvar-local syntax-ppss-last nil
"Cache of (LAST-POS . LAST-PPSS).")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Several caches.
;;
;; Because `syntax-ppss' is equivalent to (parse-partial-sexp
;; (POINT-MIN) x), we need either to empty the cache when we narrow
;; the buffer, which is suboptimal, or we need to use several caches.
;; We use two of them, one for widened buffer, and one for narrowing.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar-local syntax-ppss-wide nil
"Cons of two elements (LAST . CACHE).
Where LAST is a pair (LAST-POS . LAST-PPS) caching the last invocation
and CACHE is a list of (POS . PPSS) pairs, in decreasing POS order.
These are valid when the buffer has no restriction.")
(defvar-local syntax-ppss-narrow nil
"Same as `syntax-ppss-wide' but for a narrowed buffer.")
(defvar-local syntax-ppss-narrow-start nil
"Start position of the narrowing for `syntax-ppss-narrow'.")
(defalias 'syntax-ppss-after-change-function 'syntax-ppss-flush-cache)
(defun syntax-ppss-flush-cache (beg &rest ignored)
......@@ -392,24 +408,29 @@ point (where the PPSS is equivalent to nil).")
;; Set syntax-propertize to refontify anything past beg.
(setq syntax-propertize--done (min beg syntax-propertize--done))
;; Flush invalid cache entries.
(while (and syntax-ppss-cache (> (caar syntax-ppss-cache) beg))
(setq syntax-ppss-cache (cdr syntax-ppss-cache)))
;; Throw away `last' value if made invalid.
(when (< beg (or (car syntax-ppss-last) 0))
;; If syntax-begin-function jumped to BEG, then the old state at BEG can
;; depend on the text after BEG (which is presumably changed). So if
;; BEG=(car (nth 10 syntax-ppss-last)) don't reuse that data because the
;; assumed nil state at BEG may not be valid any more.
(if (<= beg (or (syntax-ppss-toplevel-pos (cdr syntax-ppss-last))
(nth 3 syntax-ppss-last)
0))
(setq syntax-ppss-last nil)
(setcar syntax-ppss-last nil)))
;; Unregister if there's no cache left. Sadly this doesn't work
;; because `before-change-functions' is temporarily bound to nil here.
;; (unless syntax-ppss-cache
;; (remove-hook 'before-change-functions 'syntax-ppss-flush-cache t))
)
(dolist (cell (list syntax-ppss-wide syntax-ppss-narrow))
(pcase cell
(`(,last . ,cache)
(while (and cache (> (caar cache) beg))
(setq cache (cdr cache)))
;; Throw away `last' value if made invalid.
(when (< beg (or (car last) 0))
;; If syntax-begin-function jumped to BEG, then the old state at BEG can
;; depend on the text after BEG (which is presumably changed). So if
;; BEG=(car (nth 10 syntax-ppss-last)) don't reuse that data because the
;; assumed nil state at BEG may not be valid any more.
(if (<= beg (or (syntax-ppss-toplevel-pos (cdr last))
(nth 3 last)
0))
(setq last nil)
(setcar last nil)))
;; Unregister if there's no cache left. Sadly this doesn't work
;; because `before-change-functions' is temporarily bound to nil here.
;; (unless cache
;; (remove-hook 'before-change-functions 'syntax-ppss-flush-cache t))
(setcar cell last)
(setcdr cell cache)))
))
(defvar syntax-ppss-stats
[(0 . 0.0) (0 . 0.0) (0 . 0.0) (0 . 0.0) (0 . 0.0) (1 . 2500.0)])
......@@ -423,6 +444,17 @@ point (where the PPSS is equivalent to nil).")
(defvar-local syntax-ppss-table nil
"Syntax-table to use during `syntax-ppss', if any.")
(defun syntax-ppss--data ()
(if (eq (point-min) 1)
(progn
(unless syntax-ppss-wide
(setq syntax-ppss-wide (cons nil nil)))
syntax-ppss-wide)
(unless (eq syntax-ppss-narrow-start (point-min))
(setq syntax-ppss-narrow-start (point-min))
(setq syntax-ppss-narrow (cons nil nil)))
syntax-ppss-narrow))
(defun syntax-ppss (&optional pos)
"Parse-Partial-Sexp State at POS, defaulting to point.
The returned value is the same as that of `parse-partial-sexp'
......@@ -439,10 +471,13 @@ running the hook."
(syntax-propertize pos)
;;
(with-syntax-table (or syntax-ppss-table (syntax-table))
(let ((old-ppss (cdr syntax-ppss-last))
(old-pos (car syntax-ppss-last))
(ppss nil)
(pt-min (point-min)))
(let* ((cell (syntax-ppss--data))
(ppss-last (car cell))
(ppss-cache (cdr cell))
(old-ppss (cdr ppss-last))
(old-pos (car ppss-last))
(ppss nil)
(pt-min (point-min)))
(if (and old-pos (> old-pos pos)) (setq old-pos nil))
;; Use the OLD-POS if usable and close. Don't update the `last' cache.
(condition-case nil
......@@ -475,7 +510,7 @@ running the hook."
;; The OLD-* data can't be used. Consult the cache.
(t
(let ((cache-pred nil)
(cache syntax-ppss-cache)
(cache ppss-cache)
(pt-min (point-min))
;; I differentiate between PT-MIN and PT-BEST because
;; I feel like it might be important to ensure that the
......@@ -491,7 +526,7 @@ running the hook."
(if cache (setq pt-min (caar cache) ppss (cdar cache)))
;; Setup the before-change function if necessary.
(unless (or syntax-ppss-cache syntax-ppss-last)
(unless (or ppss-cache ppss-last)
(add-hook 'before-change-functions
'syntax-ppss-flush-cache t t))
......@@ -541,7 +576,7 @@ running the hook."
pt-min (setq pt-min (/ (+ pt-min pos) 2))
nil nil ppss))
(push (cons pt-min ppss)
(if cache-pred (cdr cache-pred) syntax-ppss-cache)))
(if cache-pred (cdr cache-pred) ppss-cache)))
;; Compute the actual return value.
(setq ppss (parse-partial-sexp pt-min pos nil nil ppss))
......@@ -562,13 +597,15 @@ running the hook."
(if (> (- (caar cache-pred) pos) syntax-ppss-max-span)
(push pair (cdr cache-pred))
(setcar cache-pred pair))
(if (or (null syntax-ppss-cache)
(> (- (caar syntax-ppss-cache) pos)
(if (or (null ppss-cache)
(> (- (caar ppss-cache) pos)
syntax-ppss-max-span))
(push pair syntax-ppss-cache)
(setcar syntax-ppss-cache pair)))))))))
(push pair ppss-cache)
(setcar ppss-cache pair)))))))))
(setq syntax-ppss-last (cons pos ppss))
(setq ppss-last (cons pos ppss))
(setcar cell ppss-last)
(setcdr cell ppss-cache)
ppss)
(args-out-of-range
;; If the buffer is more narrowed than when we built the cache,
......@@ -582,7 +619,7 @@ running the hook."
(defun syntax-ppss-debug ()
(let ((pt nil)
(min-diffs nil))
(dolist (x (append syntax-ppss-cache (list (cons (point-min) nil))))
(dolist (x (append (cdr (syntax-ppss--data)) (list (cons (point-min) nil))))
(when pt (push (- pt (car x)) min-diffs))
(setq pt (car x)))
min-diffs))
......
......@@ -142,7 +142,7 @@ function `string-to-number'."
(defmacro eshell-condition-case (tag form &rest handlers)
"If `eshell-handle-errors' is non-nil, this is `condition-case'.
Otherwise, evaluates FORM with no error handling."
(declare (indent 2))
(declare (indent 2) (debug (sexp form &rest form)))
(if eshell-handle-errors
`(condition-case-unless-debug ,tag
,form
......
......@@ -4271,8 +4271,10 @@ See `python-check-command' for the default."
import inspect
try:
str_type = basestring
argspec_function = inspect.getargspec
except NameError:
str_type = str
argspec_function = inspect.getfullargspec
if isinstance(obj, str_type):
obj = eval(obj, globals())
doc = inspect.getdoc(obj)
......@@ -4285,9 +4287,7 @@ See `python-check-command' for the default."
target = obj
objtype = 'def'
if target:
args = inspect.formatargspec(
*inspect.getargspec(target)
)
args = inspect.formatargspec(*argspec_function(target))
name = obj.__name__
doc = '{objtype} {name}{args}'.format(
objtype=objtype, name=name, args=args
......
......@@ -593,11 +593,7 @@ sign. See `sh-feature'."
(sexp :format "Evaluate: %v"))))
:group 'sh-script)
(defcustom sh-indentation 4
"The width for further indentation in Shell-Script mode."
:type 'integer
:group 'sh-script)
(define-obsolete-variable-alias 'sh-indentation 'sh-basic-offset "26.1")
(put 'sh-indentation 'safe-local-variable 'integerp)
(defcustom sh-remember-variable-min 3
......@@ -1617,7 +1613,7 @@ with your script for an edit-interpret-debug cycle."
(setq-local skeleton-pair-alist '((?` _ ?`)))
(setq-local skeleton-pair-filter-function 'sh-quoted-p)
(setq-local skeleton-further-elements
'((< '(- (min sh-indentation (current-column))))))
'((< '(- (min sh-basic-offset (current-column))))))
(setq-local skeleton-filter-function 'sh-feature)
(setq-local skeleton-newline-indent-rigidly t)
(setq-local defun-prompt-regexp
......@@ -2012,7 +2008,7 @@ May return nil if the line should not be treated as continued."
(forward-line -1)
(if (sh-smie--looking-back-at-continuation-p)
(current-indentation)
(+ (current-indentation) sh-indentation))))
(+ (current-indentation) sh-basic-offset))))
(t
;; Just make sure a line-continuation is indented deeper.
(save-excursion
......@@ -2033,13 +2029,13 @@ May return nil if the line should not be treated as continued."
;; check the line before that one.
(> ci indent))
(t ;Previous line is the beginning of the continued line.
(setq indent (min (+ ci sh-indentation) max))
(setq indent (min (+ ci sh-basic-offset) max))
nil)))))
indent))))))
(defun sh-smie-sh-rules (kind token)
(pcase (cons kind token)
(`(:elem . basic) sh-indentation)
(`(:elem . basic) sh-basic-offset)
(`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt)
(sh-var-value 'sh-indent-for-case-label)))
(`(:before . ,(or `"(" `"{" `"[" "while" "if" "for" "case"))
......@@ -2248,8 +2244,8 @@ Point should be before the newline."
(defun sh-smie-rc-rules (kind token)
(pcase (cons kind token)
(`(:elem . basic) sh-indentation)
;; (`(:after . "case") (or sh-indentation smie-indent-basic))
(`(:elem . basic) sh-basic-offset)
;; (`(:after . "case") (or sh-basic-offset smie-indent-basic))
(`(:after . ";")
(if (smie-rule-parent-p "case")
(smie-rule-parent (sh-var-value 'sh-indent-after-case))))
......@@ -2490,7 +2486,7 @@ the value thus obtained, and the result is used instead."
(defun sh-basic-indent-line ()
"Indent a line for Sh mode (shell script mode).
Indent as far as preceding non-empty line, then by steps of `sh-indentation'.
Indent as far as preceding non-empty line, then by steps of `sh-basic-offset'.
Lines containing only comments are considered empty."
(interactive)
(let ((previous (save-excursion
......@@ -2514,9 +2510,9 @@ Lines containing only comments are considered empty."
(delete-region (point)
(progn (beginning-of-line) (point)))
(if (eolp)
(max previous (* (1+ (/ current sh-indentation))
sh-indentation))
(* (1+ (/ current sh-indentation)) sh-indentation))))))
(max previous (* (1+ (/ current sh-basic-offset))
sh-basic-offset))
(* (1+ (/ current sh-basic-offset)) sh-basic-offset))))))
(if (< (current-column) (current-indentation))
(skip-chars-forward " \t"))))
......@@ -3594,6 +3590,10 @@ so that `occur-next' and `occur-prev' will work."
(defun sh-learn-buffer-indent (&optional arg)
"Learn how to indent the buffer the way it currently is.
If `sh-use-smie' is non-nil, call `smie-config-guess'.
Otherwise, run the sh-script specific indent learning command, as
decribed below.
Output in buffer \"*indent*\" shows any lines which have conflicting
values of a variable, and the final value of all variables learned.
When called interactively, pop to this buffer automatically if
......@@ -3610,8 +3610,7 @@ to the value of variable `sh-learn-basic-offset'.
Abnormal hook `sh-learned-buffer-hook' if non-nil is called when the
function completes. The function is abnormal because it is called
with an alist of variables learned. This feature may be changed or
removed in the future.
with an alist of variables learned.
This command can often take a long time to run."
(interactive "P")
......@@ -3809,7 +3808,6 @@ This command can often take a long time to run."
" has" "s have")
(if (zerop num-diffs)
"." ":"))))))
;; Are abnormal hooks considered bad form?
(run-hook-with-args 'sh-learned-buffer-hook learned-var-list)
(and (called-interactively-p 'any)
(or sh-popup-occur-buffer (> num-diffs 0))
......
......@@ -928,12 +928,14 @@ IGNORES is a list of glob patterns."
files
(expand-file-name dir)
ignores))
(def default-directory)
(buf (get-buffer-create " *xref-grep*"))
(`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist))
(status nil)
(hits nil))
(with-current-buffer buf
(erase-buffer)
(setq default-directory def)
(setq status
(call-process-shell-command command nil t))
(goto-char (point-min))
......
......@@ -1224,7 +1224,10 @@ xg_create_frame_widgets (struct frame *f)
with regular X drawing primitives, so from a GTK/GDK point of
view, the widget is totally blank. When an expose comes, this
will make the widget blank, and then Emacs redraws it. This flickers
a lot, so we turn off double buffering. */
a lot, so we turn off double buffering.
FIXME: gtk_widget_set_double_buffered is deprecated and might stop
working in the future. We need to migrate away from combining
X and GTK+ drawing to a pure GTK+ build. */
gtk_widget_set_double_buffered (wfixed, FALSE);
#if ! GTK_CHECK_VERSION (3, 22, 0)
......
......@@ -397,9 +397,14 @@
(should (equal 1 (let ((x 1)) (and-let* (x)))))
(should (equal nil (and-let* ((x nil)))))
(should (equal 1 (and-let* ((x 1)))))
(should-error (and-let* (nil (x 1))) :type 'setting-constant)
;; The error doesn't trigger when compiled: the compiler will give
;; a warning and then drop the erroneous code. Therefore, use
;; `eval' to avoid compilation.
(should-error (eval '(and-let* (nil (x 1))) lexical-binding)
:type 'setting-constant)
(should (equal nil (and-let* ((nil) (x 1)))))
(should-error (and-let* (2 (x 1))) :type 'wrong-type-argument)
(should-error (eval (and-let* (2 (x 1))) lexical-binding)
:type 'wrong-type-argument)
(should (equal 1 (and-let* ((2) (x 1)))))
(should (equal 2 (and-let* ((x 1) (2)))))
(should (equal nil (let ((x nil)) (and-let* (x) x))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment