&optional avoid-current
extra-test-inclusive
extra-test-exclusive)
- "Test if BUFFER is a `next-error' capable buffer.
-
-If AVOID-CURRENT is non-nil, treat the current buffer
-as an absolute last resort only.
-
-The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer
-that normally would not qualify. If it returns t, the buffer
-in question is treated as usable.
-
-The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called in each buffer
-that would normally be considered usable. If it returns nil,
-that buffer is rejected."
+ "Return non-nil if BUFFER is a `next-error' capable buffer.
+If AVOID-CURRENT is non-nil, and BUFFER is the current buffer,
+return nil.
+
+The function EXTRA-TEST-INCLUSIVE, if non-nil, is called if
+BUFFER would not normally qualify. If it returns non-nil, BUFFER
+is considered `next-error' capable, anyway, and the function
+returns non-nil.
+
+The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called if the
+buffer would normally qualify. If it returns nil, BUFFER is
+rejected, and the function returns nil."
(and (buffer-name buffer) ;First make sure it's live.
(not (and avoid-current (eq buffer (current-buffer))))
(with-current-buffer buffer
(last-command-event ?\n)
;; Don't auto-fill if we have a numeric argument.
(auto-fill-function (if arg nil auto-fill-function))
+ (arg (prefix-numeric-value arg))
(postproc
;; Do the rest in post-self-insert-hook, because we want to do it
;; *before* other functions on that hook.
(lambda ()
- (cl-assert (eq ?\n (char-before)))
+ ;; We are not going to insert any newlines if arg is
+ ;; non-positive.
+ (or (and (numberp arg) (<= arg 0))
+ (cl-assert (eq ?\n (char-before))))
;; Mark the newline(s) `hard'.
(if use-hard-newlines
(set-hard-newline-properties
- (- (point) (prefix-numeric-value arg)) (point)))
+ (- (point) arg) (point)))
;; If the newline leaves the previous line blank, and we
;; have a left margin, delete that from the blank line.
(save-excursion
(move-to-left-margin nil t)))))
(unwind-protect
(if (not interactive)
- ;; FIXME: For non-interactive uses, many calls actually just want
- ;; (insert "\n"), so maybe we should do just that, so as to avoid
- ;; the risk of filling or running abbrevs unexpectedly.
- (let ((post-self-insert-hook (list postproc)))
- (self-insert-command (prefix-numeric-value arg)))
- (unwind-protect
- (progn
- (add-hook 'post-self-insert-hook postproc nil t)
- (self-insert-command (prefix-numeric-value arg)))
- ;; We first used let-binding to protect the hook, but that was naive
- ;; since add-hook affects the symbol-default value of the variable,
- ;; whereas the let-binding might only protect the buffer-local value.
- (remove-hook 'post-self-insert-hook postproc t)))
+ ;; FIXME: For non-interactive uses, many calls actually
+ ;; just want (insert "\n"), so maybe we should do just
+ ;; that, so as to avoid the risk of filling or running
+ ;; abbrevs unexpectedly.
+ (let ((post-self-insert-hook (list postproc)))
+ (self-insert-command arg))
+ (unwind-protect
+ (progn
+ (add-hook 'post-self-insert-hook postproc nil t)
+ (self-insert-command arg))
+ ;; We first used let-binding to protect the hook, but that
+ ;; was naive since add-hook affects the symbol-default
+ ;; value of the variable, whereas the let-binding might
+ ;; only protect the buffer-local value.
+ (remove-hook 'post-self-insert-hook postproc t)))
(cl-assert (not (member postproc post-self-insert-hook)))
(cl-assert (not (member postproc (default-value 'post-self-insert-hook))))))
nil)
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
- (while (forward-word 1)
+ (while (forward-word-strictly 1)
(setq words (1+ words)))))
words))
((use-region-p)
:version "21.1")
(defun eval-expression-print-format (value)
- "Format VALUE as a result of evaluated expression.
-Return a formatted string which is displayed in the echo area
-in addition to the value printed by prin1 in functions which
-display the result of expression evaluation."
+ "If VALUE in an integer, return a specially formatted string.
+This string will typically look like \" (#o1, #x1, ?\\C-a)\".
+If VALUE is not an integer, nil is returned.
+This function is used by functions like `prin1' that display the
+result of expression evaluation."
(if (and (integerp value)
(or (eq standard-output t)
(zerop (prefix-numeric-value current-prefix-arg))))
;; the end of the line when it fails to go to the next line.
(goto-char old-point)
(next-history-element arg)
+ ;; Reset `temporary-goal-column' because a correct value is not
+ ;; calculated when `next-line' above fails by bumping against
+ ;; the bottom of the minibuffer (bug#22544).
+ (setq temporary-goal-column 0)
;; Restore the original goal column on the last line
;; of possibly multi-line input.
(goto-char (point-max))
;; the beginning of the line when it fails to go to the previous line.
(goto-char old-point)
(previous-history-element arg)
+ ;; Reset `temporary-goal-column' because a correct value is not
+ ;; calculated when `previous-line' above fails by bumping against
+ ;; the top of the minibuffer (bug#22544).
+ (setq temporary-goal-column 0)
;; Restore the original goal column on the first line
;; of possibly multi-line input.
(goto-char (minibuffer-prompt-end))
(if (= (line-number-at-pos) 1)
(move-to-column (+ old-column (1- (minibuffer-prompt-end))))
(move-to-column old-column))
- (goto-char (line-end-position)))))))
+ ;; Put the cursor at the end of the visual line instead of the
+ ;; logical line, so the next `previous-line-or-history-element'
+ ;; would move to the previous history element, not to a possible upper
+ ;; visual line from the end of logical line in `line-move-visual' mode.
+ (end-of-visual-line)
+ ;; Since `end-of-visual-line' puts the cursor at the beginning
+ ;; of the next visual line, move it one char back to the end
+ ;; of the first visual line (bug#22544).
+ (unless (eolp) (backward-char 1)))))))
(defun next-complete-history-element (n)
"Get next history element which completes the minibuffer before the point.
"Execute string COMMAND in inferior shell; display output, if any.
With prefix argument, insert the COMMAND's output at point.
+Interactively, prompt for COMMAND in the minibuffer.
+
If COMMAND ends in `&', execute it asynchronously.
The output appears in the buffer `*Async Shell Command*'.
That buffer is in shell mode. You can also use
(defcustom use-empty-active-region nil
"Whether \"region-aware\" commands should act on empty regions.
-If nil, region-aware commands treat empty regions as inactive.
+If nil, region-aware commands treat the empty region as inactive.
If non-nil, region-aware commands treat the region as active as
long as the mark is active, even if the region is empty.
rather than trying to keep the same horizontal position.
With a non-nil argument ARG, clears out the goal column
so that \\[next-line] and \\[previous-line] resume vertical motion.
-The goal column is stored in the variable `goal-column'."
+The goal column is stored in the variable `goal-column'.
+This is a buffer-local setting."
(interactive "P")
(if arg
(progn
(defun backward-word (&optional arg)
"Move backward until encountering the beginning of a word.
With argument ARG, do this that many times.
-If ARG is omitted or nil, move point backward one word."
+If ARG is omitted or nil, move point backward one word.
+
+The word boundaries are normally determined by the buffer's syntax
+table, but `find-word-boundary-function-table', such as set up
+by `subword-mode', can change that. If a Lisp program needs to
+move by words determined strictly by the syntax table, it should
+use `backward-word-strictly' instead."
(interactive "^p")
(forward-word (- (or arg 1))))