Commit c1ac8c17 authored by Eli Zaretskii's avatar Eli Zaretskii

Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emacs into emacs-26

parents 18073beb af130f90
......@@ -1089,12 +1089,15 @@ is not cleared by changing major modes.
@defopt buffer-offer-save
This variable, if non-@code{nil} in a particular buffer, tells
@code{save-buffers-kill-emacs} and @code{save-some-buffers} (if the
second optional argument to that function is @code{t}) to offer to
save that buffer, just as they offer to save file-visiting buffers.
@xref{Definition of save-some-buffers}. The variable
@code{buffer-offer-save} automatically becomes buffer-local when set
for any reason. @xref{Buffer-Local Variables}.
@code{save-buffers-kill-emacs} to offer to save that buffer, just as
it offers to save file-visiting buffers. If @code{save-some-buffers}
is called with the second optional argument set to @code{t}, it will
also offer to save the buffer. Lastly, if this variable is set to the
symbol @code{always}, both @code{save-buffers-kill-emacs} and
@code{save-some-buffers} will always offer to save. @xref{Definition
of save-some-buffers}. The variable @code{buffer-offer-save}
automatically becomes buffer-local when set for any reason.
@xref{Buffer-Local Variables}.
@end defopt
@defvar buffer-save-without-query
......
......@@ -368,8 +368,7 @@ With an argument of 0, unconditionally do @emph{not} make any backup file.
This command saves some modified file-visiting buffers. Normally it
asks the user about each buffer. But if @var{save-silently-p} is
non-@code{nil}, it saves all the file-visiting buffers without
querying the user. Additionally, buffers whose name begins with a
space (``internal'' buffers) will not be offered for save.
querying the user.
@vindex save-some-buffers-default-predicate
The optional @var{pred} argument provides a predicate that controls
......
......@@ -112,37 +112,39 @@ window of another Emacs frame. @xref{Child Frames}.
* Display Feature Testing:: Determining the features of a terminal.
@end menu
@node Creating Frames
@section Creating Frames
@cindex frame creation
To create a new frame, call the function @code{make-frame}.
@deffn Command make-frame &optional alist
@deffn Command make-frame &optional parameters
This function creates and returns a new frame, displaying the current
buffer.
The @var{alist} argument is an alist that specifies frame parameters
for the new frame. @xref{Frame Parameters}. If you specify the
@code{terminal} parameter in @var{alist}, the new frame is created on
that terminal. Otherwise, if you specify the @code{window-system}
frame parameter in @var{alist}, that determines whether the frame
should be displayed on a text terminal or a graphical terminal.
@xref{Window Systems}. If neither is specified, the new frame is
created in the same terminal as the selected frame.
Any parameters not mentioned in @var{alist} default to the values in
the alist @code{default-frame-alist} (@pxref{Initial Parameters});
The @var{parameters} argument is an alist that specifies frame
parameters for the new frame. @xref{Frame Parameters}. If you specify
the @code{terminal} parameter in @var{parameters}, the new frame is
created on that terminal. Otherwise, if you specify the
@code{window-system} frame parameter in @var{parameters}, that
determines whether the frame should be displayed on a text terminal or a
graphical terminal. @xref{Window Systems}. If neither is specified,
the new frame is created in the same terminal as the selected frame.
Any parameters not mentioned in @var{parameters} default to the values
in the alist @code{default-frame-alist} (@pxref{Initial Parameters});
parameters not specified there default from the X resources or its
equivalent on your operating system (@pxref{X Resources,, X Resources,
emacs, The GNU Emacs Manual}). After the frame is created, Emacs
applies any parameters listed in @code{frame-inherited-parameters}
(see below) and not present in the argument, taking the values from
the frame that was selected when @code{make-frame} was called.
emacs, The GNU Emacs Manual}). After the frame is created, this
function applies any parameters specified in
@code{frame-inherited-parameters} (see below) it has no assigned yet,
taking the values from the frame that was selected when
@code{make-frame} was called.
Note that on multi-monitor displays (@pxref{Multiple Terminals}), the
window manager might position the frame differently than specified by
the positional parameters in @var{alist} (@pxref{Position
the positional parameters in @var{parameters} (@pxref{Position
Parameters}). For example, some window managers have a policy of
displaying the frame on the monitor that contains the largest part of
the window (a.k.a.@: the @dfn{dominating} monitor).
......@@ -158,20 +160,28 @@ A normal hook run by @code{make-frame} before it creates the frame.
@end defvar
@defvar after-make-frame-functions
An abnormal hook run by @code{make-frame} after it creates the frame.
Each function in @code{after-make-frame-functions} receives one argument, the
frame just created.
An abnormal hook run by @code{make-frame} after it created the frame.
Each function in @code{after-make-frame-functions} receives one
argument, the frame just created.
@end defvar
Note that any functions added to these hooks by your initial file are
usually not run for the initial frame, since Emacs reads the initial
file only after creating that frame. However, if the initial frame is
specified to use a separate minibuffer frame (@pxref{Minibuffers and
Frames}), the functions will be run for both, the minibuffer-less and
the minibuffer frame.
@defvar frame-inherited-parameters
This variable specifies the list of frame parameters that a newly
created frame inherits from the currently selected frame. For each
parameter (a symbol) that is an element in the list and is not present
in the argument to @code{make-frame}, the function sets the value of
that parameter in the created frame to its value in the selected
frame.
parameter (a symbol) that is an element in this list and has not been
assigned earlier when processing @code{make-frame}, the function sets
the value of that parameter in the created frame to its value in the
selected frame.
@end defvar
@node Multiple Terminals
@section Multiple Terminals
@cindex multiple terminals
......
......@@ -54,6 +54,8 @@ the character after point.
* Registers:: How registers are implemented. Accessing the text or
position stored in a register.
* Transposition:: Swapping two portions of a buffer.
* Replacing:: Replacing the text of one buffer with the text
of another buffer.
* Decompression:: Dealing with compressed data.
* Base 64:: Conversion to or from base 64 encoding.
* Checksum/Hash:: Computing cryptographic hashes.
......@@ -4328,6 +4330,28 @@ is non-@code{nil}, @code{transpose-regions} does not do this---it leaves
all markers unrelocated.
@end defun
@node Replacing
@section Replacing Buffer Text
You can use the following function to replace the text of one buffer
with the text of another buffer:
@deffn Command replace-buffer-contents source
This function replaces the accessible portion of the current buffer
with the accessible portion of the buffer @var{source}. @var{source}
may either be a buffer object or the name of a buffer. When
@code{replace-buffer-contents} succeeds, the text of the accessible
portion of the current buffer will be equal to the text of the
accessible portion of the @var{source} buffer. This function attempts
to keep point, markers, text properties, and overlays in the current
buffer intact. One potential case where this behavior is useful is
external code formatting programs: they typically write the
reformatted text into a temporary buffer or file, and using
@code{delete-region} and @code{insert-buffer-substring} would destroy
these properties. However, the latter combination is typically
faster. @xref{Deletion}, and @ref{Insertion}.
@end deffn
@node Decompression
@section Dealing With Compressed Data
......
......@@ -117,6 +117,11 @@ The effect is similar to that of "toolBar" resource on the tool bar.
* Changes in Emacs 26.1
+++
** Option 'buffer-offer-save' can be set to new value, 'always'. When
set to 'always', the command `save-some-buffers' will always offer
this buffer for saving.
** Security vulnerability related to Enriched Text mode is removed.
+++
......@@ -144,8 +149,7 @@ init file:
'save-buffer' process. Previously, saving a buffer that was not
visiting a file would always prompt for a file name. Now it only does
so if 'write-contents-functions' is nil (or all its functions return
nil). A non-nil buffer-local value for this variable is sufficient
for 'save-some-buffers' to consider the buffer for saving.
nil).
---
** New variable 'executable-prefix-env' for inserting magic signatures.
......@@ -578,7 +582,6 @@ Negative prefix arg flips the direction of selection. Also,
defun are selected unless they are separated from the defun by a blank
line.
---
** New command 'replace-buffer-contents'.
This command replaces the contents of the accessible portion of the
current buffer with the contents of the accessible portion of a
......@@ -1350,6 +1353,12 @@ non-nil, but the code returned the list in the increasing order of
priority instead. Now the code does what the documentation says it
should do.
---
** '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 26.1
......@@ -1891,9 +1900,9 @@ of frame decorations on macOS 10.9+.
---
** Mousewheel and trackpad scrolling on macOS 10.7+ now behaves more
like the macOS default. The new variables
'ns-use-system-mwheel-acceleration', 'ns-touchpad-scroll-line-height'
and 'ns-touchpad-use-momentum' can be used to customize the behavior.
like the macOS default. The new variables 'ns-mwheel-line-height',
'ns-use-mwheel-acceleration' and 'ns-use-mwheel-momentum' can be used
to customize the behavior.
----------------------------------------------------------------------
......
......@@ -742,9 +742,8 @@ run. ARGS are the arguments to `debugger'."
;; backtrace ready for printing is important for batch
;; use.
;;
;; Grab the frames starting from `signal', frames below
;; that are all from the debugger.
(backtrace (backtrace-frames 'signal))
;; Grab the frames above the debugger.
(backtrace (cdr (backtrace-frames debugger)))
(infos (reverse ert--infos)))
(setf (ert--test-execution-info-result info)
(cl-ecase type
......
......@@ -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
......
......@@ -150,8 +150,13 @@ Called with an absolute file name as argument, it returns t to enable backup.")
(defcustom buffer-offer-save nil
"Non-nil in a buffer means always offer to save buffer on exit.
Do so even if the buffer is not visiting a file.
Automatically local in all buffers."
:type 'boolean
Automatically local in all buffers.
Set to the symbol `always' to offer to save buffer whenever
`save-some-buffers' is called."
:type '(choice (const :tag "Never" nil)
(const :tag "On Emacs exit" t)
(const :tag "Whenever save-some-buffers is called" always))
:group 'backup)
(make-variable-buffer-local 'buffer-offer-save)
(put 'buffer-offer-save 'permanent-local t)
......@@ -5188,15 +5193,11 @@ change the additional actions you can take on files."
(and (buffer-live-p buffer)
(buffer-modified-p buffer)
(not (buffer-base-buffer buffer))
(not (eq (aref (buffer-name buffer) 0) ?\s))
(or
(buffer-file-name buffer)
(and pred
(progn
(set-buffer buffer)
(and buffer-offer-save (> (buffer-size) 0))))
(buffer-local-value
'write-contents-functions buffer))
(with-current-buffer buffer
(or (eq buffer-offer-save 'always)
(and pred buffer-offer-save (> (buffer-size) 0)))))
(or (not (functionp pred))
(with-current-buffer buffer (funcall pred)))
(if arg
......
......@@ -604,11 +604,12 @@ new frame."
(select-frame (make-frame))))
(defvar before-make-frame-hook nil
"Functions to run before a frame is created.")
"Functions to run before `make-frame' creates a new frame.")
(defvar after-make-frame-functions nil
"Functions to run after a frame is created.
The functions are run with one arg, the newly created frame.")
"Functions to run after `make-frame' created a new frame.
The functions are run with one argument, the newly created
frame.")
(defvar after-setting-font-hook nil
"Functions to run after a frame's font has been changed.")
......@@ -617,7 +618,7 @@ The functions are run with one arg, the newly created frame.")
(define-obsolete-function-alias 'new-frame 'make-frame "22.1")
(defvar frame-inherited-parameters '()
"Parameters `make-frame' copies from the `selected-frame' to the new frame.")
"Parameters `make-frame' copies from the selected to the new frame.")
(defvar x-display-name)
......@@ -632,9 +633,6 @@ form (NAME . VALUE), for example:
(width . NUMBER) The frame should be NUMBER characters in width.
(height . NUMBER) The frame should be NUMBER text lines high.
You cannot specify either `width' or `height', you must specify
neither or both.
(minibuffer . t) The frame should have a minibuffer.
(minibuffer . nil) The frame should have no minibuffer.
(minibuffer . only) The frame should contain only a minibuffer.
......@@ -650,10 +648,10 @@ neither or both.
In addition, any parameter specified in `default-frame-alist',
but not present in PARAMETERS, is applied.
Before creating the frame (via `frame-creation-function-alist'),
this function runs the hook `before-make-frame-hook'. After
creating the frame, it runs the hook `after-make-frame-functions'
with one arg, the newly created frame.
Before creating the frame (via `frame-creation-function'), this
function runs the hook `before-make-frame-hook'. After creating
the frame, it runs the hook `after-make-frame-functions' with one
argument, the newly created frame.
If a display parameter is supplied and a window-system is not,
guess the window-system from the display.
......
......@@ -535,7 +535,7 @@ pass to the OPERATION."
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil)
(when t1 (delete-directory tmpdir 'recurse))))
(when t1 (delete-directory tmpdir 'recursive))))
;; Handle KEEP-DATE argument.
(when keep-date
......@@ -1583,6 +1583,10 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
"Read entries which match DIRECTORY.
Either the shares are listed, or the `dir' command is executed.
Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
;; If CIFS capabilities are enabled, symlinks are not listed
;; by `dir'. This is a consequence of
;; <https://www.samba.org/samba/news/symlink_attack.html>. See also
;; <https://bugzilla.samba.org/show_bug.cgi?id=5116>.
(with-parsed-tramp-file-name (file-name-as-directory directory) nil
(setq localname (or localname "/"))
(with-tramp-file-property v localname "file-entries"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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))
......
......@@ -39,11 +39,11 @@
(defcustom shell-command-dont-erase-buffer nil
"If non-nil, output buffer is not erased between shell commands.
Also, a non-nil value set the point in the output buffer
once the command complete.
The value `beg-last-out' set point at the beginning of the output,
`end-last-out' set point at the end of the buffer, `save-point'
restore the buffer position before the command."
Also, a non-nil value sets the point in the output buffer
once the command completes.
The value `beg-last-out' sets point at the beginning of the output,
`end-last-out' sets point at the end of the buffer, `save-point'
restores the buffer position before the command."
:type '(choice
(const :tag "Erase buffer" nil)
(const :tag "Set point to beginning of last output" beg-last-out)
......@@ -53,9 +53,9 @@ restore the buffer position before the command."
:version "26.1")
(defvar shell-command-saved-pos nil
"Point position in the output buffer after command complete.
It is an alist (BUFFER . POS), where BUFFER is the output
buffer, and POS is the point position in BUFFER once the command finish.
"Point position in the output buffer after command completes.
It is an alist of (BUFFER . POS), where BUFFER is the output
buffer, and POS is the point position in BUFFER once the command finishes.
This variable is used when `shell-command-dont-erase-buffer' is non-nil.")
(defcustom idle-update-delay 0.5
......@@ -1003,7 +1003,7 @@ Called with one argument METHOD.
If METHOD is `delete-only', then delete the region; the return value
is undefined. If METHOD is nil, then return the content as a string.
If METHOD is `bounds', then return the boundaries of the region
as a list of the form (START . END).
as a list of pairs of (START . END) positions.
If METHOD is anything else, delete the region and return its content
as a string, after filtering it with `filter-buffer-substring', which
is called with METHOD as its 3rd argument.")
......@@ -5473,7 +5473,7 @@ also checks the value of `use-empty-active-region'."
(progn (cl-assert (mark)) t)))
(defun region-bounds ()
"Return the boundaries of the region as a list of (START . END) positions."
"Return the boundaries of the region as a list of pairs of (START . END) positions."
(funcall region-extract-function 'bounds))
(defun region-noncontiguous-p ()
......
......@@ -84,7 +84,7 @@
(defun xdg-thumb-uri (filename)
"Return the canonical URI for FILENAME.
If FILENAME has absolute path /foo/bar.jpg, its canonical URI is
If FILENAME has absolute file name /foo/bar.jpg, its canonical URI is
file:///foo/bar.jpg"
(concat "file://" (expand-file-name filename)))
......@@ -197,8 +197,6 @@ Optional argument GROUP defaults to the string \"Desktop Entry\"."
(unless (looking-at xdg-desktop-group-regexp)
(error "Expected group name! Instead saw: %s"
(buffer-substring (point) (point-at-eol))))
(unless (equal (match-string 1) "Desktop Entry")
(error "Wrong first group: %s" (match-string 1)))