2013-01-08 15:15:15 -05:00
|
|
|
|
;;; simple.el --- basic editing commands for Emacs -*- lexical-binding: t -*-
|
1992-05-30 21:11:25 +00:00
|
|
|
|
|
2018-01-01 00:21:42 -08:00
|
|
|
|
;; Copyright (C) 1985-1987, 1993-2018 Free Software Foundation, Inc.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2014-02-09 17:34:22 -08:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
2002-05-02 05:41:46 +00:00
|
|
|
|
;; Keywords: internal
|
2010-08-29 12:17:13 -04:00
|
|
|
|
;; Package: emacs
|
2002-05-02 05:41:46 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1993-03-22 16:53:22 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; A grab-bag of basic Emacs commands not specifically related to some
|
|
|
|
|
;; major mode or to file-handling.
|
|
|
|
|
|
1992-07-22 04:22:42 +00:00
|
|
|
|
;;; Code:
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2014-10-31 16:57:59 -04:00
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
|
|
|
|
|
2008-03-14 17:42:18 +00:00
|
|
|
|
(declare-function widget-convert "wid-edit" (type &rest args))
|
|
|
|
|
(declare-function shell-mode "shell" ())
|
1999-11-16 13:29:51 +00:00
|
|
|
|
|
2011-04-19 15:44:55 +02:00
|
|
|
|
;;; From compile.el
|
2005-08-31 13:51:34 +00:00
|
|
|
|
(defvar compilation-current-error)
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defvar compilation-context-lines)
|
2005-08-31 13:51:34 +00:00
|
|
|
|
|
2005-03-29 20:53:19 +00:00
|
|
|
|
(defcustom idle-update-delay 0.5
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Idle time delay before updating various things on the screen.
|
2005-03-29 20:53:19 +00:00
|
|
|
|
Various Emacs features that update auxiliary information when point moves
|
|
|
|
|
wait this many seconds after Emacs becomes idle before doing an update."
|
|
|
|
|
:type 'number
|
|
|
|
|
:group 'display
|
|
|
|
|
:version "22.1")
|
1999-11-16 13:29:51 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defgroup killing nil
|
2004-06-10 04:20:02 +00:00
|
|
|
|
"Killing and yanking commands."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:group 'editing)
|
|
|
|
|
|
|
|
|
|
(defgroup paren-matching nil
|
|
|
|
|
"Highlight (un)matching of parens and expressions."
|
|
|
|
|
:group 'matching)
|
2004-09-01 18:41:06 +00:00
|
|
|
|
|
2004-04-21 21:36:15 +00:00
|
|
|
|
;;; next-error support framework
|
2004-11-08 16:59:43 +00:00
|
|
|
|
|
|
|
|
|
(defgroup next-error nil
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"`next-error' support framework."
|
2004-11-08 16:59:43 +00:00
|
|
|
|
:group 'compilation
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2004-11-08 16:59:43 +00:00
|
|
|
|
|
|
|
|
|
(defface next-error
|
|
|
|
|
'((t (:inherit region)))
|
|
|
|
|
"Face used to highlight next error locus."
|
|
|
|
|
:group 'next-error
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2004-11-08 16:59:43 +00:00
|
|
|
|
|
2006-09-24 20:38:47 +00:00
|
|
|
|
(defcustom next-error-highlight 0.5
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Highlighting of locations in selected source buffers.
|
2007-03-28 18:36:01 +00:00
|
|
|
|
If a number, highlight the locus in `next-error' face for the given time
|
|
|
|
|
in seconds, or until the next command is executed.
|
|
|
|
|
If t, highlight the locus until the next command is executed, or until
|
|
|
|
|
some other locus replaces it.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
If nil, don't highlight the locus in the source buffer.
|
2011-09-07 14:46:56 +03:00
|
|
|
|
If `fringe-arrow', indicate the locus by the fringe arrow
|
|
|
|
|
indefinitely until some other locus replaces it."
|
2006-09-11 19:05:46 +00:00
|
|
|
|
:type '(choice (number :tag "Highlight for specified time")
|
2006-09-11 22:33:46 +00:00
|
|
|
|
(const :tag "Semipermanent highlighting" t)
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(const :tag "No highlighting" nil)
|
2006-09-11 19:05:46 +00:00
|
|
|
|
(const :tag "Fringe arrow" fringe-arrow))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
:group 'next-error
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2004-11-08 16:59:43 +00:00
|
|
|
|
|
2006-09-24 20:38:47 +00:00
|
|
|
|
(defcustom next-error-highlight-no-select 0.5
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Highlighting of locations in `next-error-no-select'.
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
If number, highlight the locus in `next-error' face for given time in seconds.
|
2006-09-11 19:05:46 +00:00
|
|
|
|
If t, highlight the locus indefinitely until some other locus replaces it.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
If nil, don't highlight the locus in the source buffer.
|
2011-09-07 14:46:56 +03:00
|
|
|
|
If `fringe-arrow', indicate the locus by the fringe arrow
|
|
|
|
|
indefinitely until some other locus replaces it."
|
2006-09-11 19:05:46 +00:00
|
|
|
|
:type '(choice (number :tag "Highlight for specified time")
|
2006-09-11 22:33:46 +00:00
|
|
|
|
(const :tag "Semipermanent highlighting" t)
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(const :tag "No highlighting" nil)
|
2006-09-11 19:05:46 +00:00
|
|
|
|
(const :tag "Fringe arrow" fringe-arrow))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
:group 'next-error
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2004-11-08 16:59:43 +00:00
|
|
|
|
|
2007-06-22 07:56:01 +00:00
|
|
|
|
(defcustom next-error-recenter nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Display the line in the visited source file recentered as specified.
|
2007-06-23 12:19:38 +00:00
|
|
|
|
If non-nil, the value is passed directly to `recenter'."
|
|
|
|
|
:type '(choice (integer :tag "Line to recenter to")
|
|
|
|
|
(const :tag "Center of window" (4))
|
2007-06-22 07:56:01 +00:00
|
|
|
|
(const :tag "No recentering" nil))
|
|
|
|
|
:group 'next-error
|
|
|
|
|
:version "23.1")
|
|
|
|
|
|
2005-07-09 20:46:26 +00:00
|
|
|
|
(defcustom next-error-hook nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"List of hook functions run by `next-error' after visiting source file."
|
2005-07-09 20:46:26 +00:00
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'next-error)
|
|
|
|
|
|
2005-03-29 04:55:43 +00:00
|
|
|
|
(defvar next-error-highlight-timer nil)
|
|
|
|
|
|
2005-04-07 15:15:15 +00:00
|
|
|
|
(defvar next-error-overlay-arrow-position nil)
|
2009-11-11 05:49:09 +00:00
|
|
|
|
(put 'next-error-overlay-arrow-position 'overlay-arrow-string (purecopy "=>"))
|
2005-04-07 15:15:15 +00:00
|
|
|
|
(add-to-list 'overlay-arrow-variable-list 'next-error-overlay-arrow-position)
|
|
|
|
|
|
2004-04-21 21:36:15 +00:00
|
|
|
|
(defvar next-error-last-buffer nil
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"The most recent `next-error' buffer.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
A buffer becomes most recent when its compilation, grep, or
|
|
|
|
|
similar mode is started, or when it is used with \\[next-error]
|
|
|
|
|
or \\[compile-goto-error].")
|
2018-03-03 14:54:15 +02:00
|
|
|
|
|
2018-04-17 22:27:48 +03:00
|
|
|
|
(defvar next-error-buffer nil
|
|
|
|
|
"The buffer-local value of the most recent `next-error' buffer.")
|
|
|
|
|
;; next-error-buffer is made buffer-local to keep the reference
|
2018-03-03 14:54:15 +02:00
|
|
|
|
;; to the parent buffer used to navigate to the current buffer, so the
|
|
|
|
|
;; next call of next-buffer will use the same parent buffer to
|
|
|
|
|
;; continue navigation from it.
|
2018-04-17 22:27:48 +03:00
|
|
|
|
(make-variable-buffer-local 'next-error-buffer)
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
|
|
|
|
(defvar next-error-function nil
|
2004-04-22 22:56:08 +00:00
|
|
|
|
"Function to use to find the next error in the current buffer.
|
|
|
|
|
The function is called with 2 parameters:
|
|
|
|
|
ARG is an integer specifying by how many errors to move.
|
|
|
|
|
RESET is a boolean which, if non-nil, says to go back to the beginning
|
|
|
|
|
of the errors before moving.
|
|
|
|
|
Major modes providing compile-like functionality should set this variable
|
|
|
|
|
to indicate to `next-error' that this is a candidate buffer and how
|
|
|
|
|
to navigate in it.")
|
2004-04-21 21:36:15 +00:00
|
|
|
|
(make-variable-buffer-local 'next-error-function)
|
|
|
|
|
|
2009-08-13 00:57:17 +00:00
|
|
|
|
(defvar next-error-move-function nil
|
|
|
|
|
"Function to use to move to an error locus.
|
|
|
|
|
It takes two arguments, a buffer position in the error buffer
|
|
|
|
|
and a buffer position in the error locus buffer.
|
|
|
|
|
The buffer for the error locus should already be current.
|
|
|
|
|
nil means use goto-char using the second argument position.")
|
|
|
|
|
(make-variable-buffer-local 'next-error-move-function)
|
|
|
|
|
|
2004-12-14 00:51:02 +00:00
|
|
|
|
(defsubst next-error-buffer-p (buffer
|
2004-12-27 16:34:43 +00:00
|
|
|
|
&optional avoid-current
|
2004-12-14 00:51:02 +00:00
|
|
|
|
extra-test-inclusive
|
2004-11-29 18:44:29 +00:00
|
|
|
|
extra-test-exclusive)
|
2016-04-30 02:03:24 +02:00
|
|
|
|
"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."
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(and (buffer-name buffer) ;First make sure it's live.
|
|
|
|
|
(not (and avoid-current (eq buffer (current-buffer))))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(if next-error-function ; This is the normal test.
|
|
|
|
|
;; Optionally reject some buffers.
|
|
|
|
|
(if extra-test-exclusive
|
|
|
|
|
(funcall extra-test-exclusive)
|
|
|
|
|
t)
|
|
|
|
|
;; Optionally accept some other buffers.
|
|
|
|
|
(and extra-test-inclusive
|
|
|
|
|
(funcall extra-test-inclusive))))))
|
|
|
|
|
|
2018-02-27 23:38:04 +02:00
|
|
|
|
(defcustom next-error-find-buffer-function #'ignore
|
2018-04-21 22:52:47 +03:00
|
|
|
|
"Function called to find a `next-error' capable buffer.
|
|
|
|
|
This functions takes the same three arguments as the function
|
2018-04-22 20:39:46 +03:00
|
|
|
|
`next-error-find-buffer', and should return the buffer to be
|
|
|
|
|
used by the subsequent invocation of the command `next-error'
|
|
|
|
|
and `previous-error'.
|
|
|
|
|
If the function returns nil, `next-error-find-buffer' will
|
|
|
|
|
try to use the buffer it used previously, and failing that
|
|
|
|
|
all other buffers."
|
2018-04-17 22:27:48 +03:00
|
|
|
|
:type '(choice (const :tag "No default" ignore)
|
|
|
|
|
(const :tag "Single next-error capable buffer on selected frame"
|
2018-02-21 23:30:18 +02:00
|
|
|
|
next-error-buffer-on-selected-frame)
|
|
|
|
|
(function :tag "Other function"))
|
|
|
|
|
:group 'next-error
|
|
|
|
|
:version "27.1")
|
|
|
|
|
|
2018-04-17 22:27:48 +03:00
|
|
|
|
(defcustom next-error-found-function #'ignore
|
|
|
|
|
"Function called when a next locus is found and displayed.
|
|
|
|
|
Function is called with two arguments: a FROM-BUFFER buffer
|
|
|
|
|
from which next-error navigated, and a target buffer TO-BUFFER."
|
|
|
|
|
:type '(choice (const :tag "No default" ignore)
|
|
|
|
|
(function :tag "Other function"))
|
|
|
|
|
:group 'next-error
|
|
|
|
|
:version "27.1")
|
|
|
|
|
|
|
|
|
|
(defun next-error-buffer-on-selected-frame (&optional _avoid-current
|
2018-02-21 23:30:18 +02:00
|
|
|
|
extra-test-inclusive
|
|
|
|
|
extra-test-exclusive)
|
|
|
|
|
"Return a single visible next-error buffer on the selected frame."
|
|
|
|
|
(let ((window-buffers
|
|
|
|
|
(delete-dups
|
|
|
|
|
(delq nil (mapcar (lambda (w)
|
|
|
|
|
(if (next-error-buffer-p
|
|
|
|
|
(window-buffer w)
|
2018-04-17 22:27:48 +03:00
|
|
|
|
t
|
2018-02-21 23:30:18 +02:00
|
|
|
|
extra-test-inclusive extra-test-exclusive)
|
|
|
|
|
(window-buffer w)))
|
|
|
|
|
(window-list))))))
|
|
|
|
|
(if (eq (length window-buffers) 1)
|
|
|
|
|
(car window-buffers))))
|
|
|
|
|
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(defun next-error-find-buffer (&optional avoid-current
|
2004-12-14 00:51:02 +00:00
|
|
|
|
extra-test-inclusive
|
2004-11-29 18:44:29 +00:00
|
|
|
|
extra-test-exclusive)
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"Return a `next-error' capable buffer.
|
2005-12-23 21:50:38 +00:00
|
|
|
|
|
2004-12-27 16:34:43 +00:00
|
|
|
|
If AVOID-CURRENT is non-nil, treat the current buffer
|
|
|
|
|
as an absolute last resort only.
|
|
|
|
|
|
2005-06-20 10:29:02 +00:00
|
|
|
|
The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer
|
2004-12-27 16:34:43 +00:00
|
|
|
|
that normally would not qualify. If it returns t, the buffer
|
|
|
|
|
in question is treated as usable.
|
|
|
|
|
|
2005-12-23 21:50:38 +00:00
|
|
|
|
The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called in each buffer
|
2004-12-27 16:34:43 +00:00
|
|
|
|
that would normally be considered usable. If it returns nil,
|
|
|
|
|
that buffer is rejected."
|
2004-09-01 17:05:59 +00:00
|
|
|
|
(or
|
2018-02-21 23:30:18 +02:00
|
|
|
|
;; 1. If a customizable function returns a buffer, use it.
|
2018-02-27 23:38:04 +02:00
|
|
|
|
(funcall next-error-find-buffer-function avoid-current
|
|
|
|
|
extra-test-inclusive
|
|
|
|
|
extra-test-exclusive)
|
2018-04-17 22:27:48 +03:00
|
|
|
|
;; 2. If next-error-buffer has no buffer-local value
|
|
|
|
|
;; (i.e. never navigated to the current buffer from another),
|
|
|
|
|
;; and the current buffer is a `next-error' capable buffer,
|
|
|
|
|
;; use it unconditionally, so next-error will always use it.
|
|
|
|
|
(if (and (not (local-variable-p 'next-error-buffer))
|
|
|
|
|
(next-error-buffer-p (current-buffer) avoid-current
|
|
|
|
|
extra-test-inclusive extra-test-exclusive))
|
|
|
|
|
(current-buffer))
|
|
|
|
|
;; 3. If next-error-last-buffer is an acceptable buffer, use that.
|
2004-09-01 17:05:59 +00:00
|
|
|
|
(if (and next-error-last-buffer
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(next-error-buffer-p next-error-last-buffer avoid-current
|
2004-12-14 00:51:02 +00:00
|
|
|
|
extra-test-inclusive extra-test-exclusive))
|
2004-12-27 16:34:43 +00:00
|
|
|
|
next-error-last-buffer)
|
2018-04-17 22:27:48 +03:00
|
|
|
|
;; 4. If the current buffer is acceptable, choose it.
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(if (next-error-buffer-p (current-buffer) avoid-current
|
|
|
|
|
extra-test-inclusive extra-test-exclusive)
|
2004-09-01 17:05:59 +00:00
|
|
|
|
(current-buffer))
|
2018-04-17 22:27:48 +03:00
|
|
|
|
;; 5. Look for any acceptable buffer.
|
2004-09-01 17:05:59 +00:00
|
|
|
|
(let ((buffers (buffer-list)))
|
|
|
|
|
(while (and buffers
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(not (next-error-buffer-p
|
|
|
|
|
(car buffers) avoid-current
|
|
|
|
|
extra-test-inclusive extra-test-exclusive)))
|
2004-09-01 17:05:59 +00:00
|
|
|
|
(setq buffers (cdr buffers)))
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(car buffers))
|
2018-04-17 22:27:48 +03:00
|
|
|
|
;; 6. Use the current buffer as a last resort if it qualifies,
|
2004-12-27 16:34:43 +00:00
|
|
|
|
;; even despite AVOID-CURRENT.
|
|
|
|
|
(and avoid-current
|
|
|
|
|
(next-error-buffer-p (current-buffer) nil
|
|
|
|
|
extra-test-inclusive extra-test-exclusive)
|
|
|
|
|
(progn
|
2006-11-28 02:21:03 +00:00
|
|
|
|
(message "This is the only buffer with error message locations")
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(current-buffer)))
|
2018-04-17 22:27:48 +03:00
|
|
|
|
;; 7. Give up.
|
2006-11-28 02:21:03 +00:00
|
|
|
|
(error "No buffers contain error message locations")))
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(defun next-error (&optional arg reset)
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"Visit next `next-error' message and corresponding source code.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
|
|
|
|
If all the error messages parsed so far have been processed already,
|
|
|
|
|
the message buffer is checked for new ones.
|
|
|
|
|
|
2004-04-22 22:56:08 +00:00
|
|
|
|
A prefix ARG specifies how many error messages to move;
|
2004-04-21 21:36:15 +00:00
|
|
|
|
negative means move back to previous error messages.
|
|
|
|
|
Just \\[universal-argument] as a prefix means reparse the error message buffer
|
|
|
|
|
and start at the first error.
|
|
|
|
|
|
2004-05-07 22:31:54 +00:00
|
|
|
|
The RESET argument specifies that we should restart from the beginning.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
|
|
|
|
\\[next-error] normally uses the most recently started
|
|
|
|
|
compilation, grep, or occur buffer. It can also operate on any
|
|
|
|
|
buffer with output from the \\[compile], \\[grep] commands, or,
|
|
|
|
|
more generally, on any buffer in Compilation mode or with
|
|
|
|
|
Compilation Minor mode enabled, or any buffer in which
|
2004-09-01 17:05:59 +00:00
|
|
|
|
`next-error-function' is bound to an appropriate function.
|
|
|
|
|
To specify use of a particular buffer for error messages, type
|
2018-04-21 22:52:47 +03:00
|
|
|
|
\\[next-error] in that buffer. You can also use the command
|
|
|
|
|
`next-error-select-buffer' to select the buffer to use for the subsequent
|
|
|
|
|
invocation of `next-error'.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2005-07-09 20:46:26 +00:00
|
|
|
|
Once \\[next-error] has chosen the buffer for error messages, it
|
|
|
|
|
runs `next-error-hook' with `run-hooks', and stays with that buffer
|
|
|
|
|
until you use it in some other buffer which uses Compilation mode
|
|
|
|
|
or Compilation Minor mode.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2011-02-07 09:41:11 -08:00
|
|
|
|
To control which errors are matched, customize the variable
|
|
|
|
|
`compilation-error-regexp-alist'."
|
2004-04-21 21:36:15 +00:00
|
|
|
|
(interactive "P")
|
2004-04-22 22:56:08 +00:00
|
|
|
|
(if (consp arg) (setq reset t arg nil))
|
2017-11-06 23:40:31 +02:00
|
|
|
|
(let ((buffer (next-error-find-buffer)))
|
|
|
|
|
(when buffer
|
|
|
|
|
;; We know here that next-error-function is a valid symbol we can funcall
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(funcall next-error-function (prefix-numeric-value arg) reset)
|
2018-04-17 22:27:48 +03:00
|
|
|
|
(next-error-found buffer (current-buffer))
|
|
|
|
|
(message "%s locus from %s"
|
2018-02-21 23:30:18 +02:00
|
|
|
|
(cond (reset "First")
|
|
|
|
|
((eq (prefix-numeric-value arg) 0) "Current")
|
|
|
|
|
((< (prefix-numeric-value arg) 0) "Previous")
|
|
|
|
|
(t "Next"))
|
2018-04-17 22:27:48 +03:00
|
|
|
|
next-error-last-buffer)))))
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2005-10-02 03:33:02 +00:00
|
|
|
|
(defun next-error-internal ()
|
|
|
|
|
"Visit the source code corresponding to the `next-error' message at point."
|
2017-11-06 23:40:31 +02:00
|
|
|
|
(let ((buffer (current-buffer)))
|
|
|
|
|
;; We know here that next-error-function is a valid symbol we can funcall
|
2018-04-17 22:27:48 +03:00
|
|
|
|
(funcall next-error-function 0 nil)
|
|
|
|
|
(next-error-found buffer (current-buffer))
|
|
|
|
|
(message "Current locus from %s" next-error-last-buffer)))
|
|
|
|
|
|
|
|
|
|
(defun next-error-found (&optional from-buffer to-buffer)
|
|
|
|
|
"Function to call when the next locus is found and displayed.
|
|
|
|
|
FROM-BUFFER is a buffer from which next-error navigated,
|
|
|
|
|
and TO-BUFFER is a target buffer."
|
|
|
|
|
(setq next-error-last-buffer (or from-buffer (current-buffer)))
|
|
|
|
|
(when to-buffer
|
|
|
|
|
(with-current-buffer to-buffer
|
|
|
|
|
(setq next-error-buffer from-buffer)))
|
|
|
|
|
(when next-error-recenter
|
|
|
|
|
(recenter next-error-recenter))
|
|
|
|
|
(funcall next-error-found-function from-buffer to-buffer)
|
|
|
|
|
(run-hooks 'next-error-hook))
|
2005-10-02 03:33:02 +00:00
|
|
|
|
|
2018-02-21 23:30:18 +02:00
|
|
|
|
(defun next-error-select-buffer (buffer)
|
2018-04-21 22:52:47 +03:00
|
|
|
|
"Select a `next-error' capable BUFFER and set it as the last used.
|
|
|
|
|
This means that the selected buffer becomes the source of locations
|
2018-04-22 20:39:46 +03:00
|
|
|
|
for the subsequent invocation of `next-error' or `previous-error'.
|
|
|
|
|
Interactively, this command allows selection only among buffers
|
|
|
|
|
where `next-error-function' is bound to an appropriate function."
|
2018-02-21 23:30:18 +02:00
|
|
|
|
(interactive
|
|
|
|
|
(list (get-buffer
|
|
|
|
|
(read-buffer "Select next-error buffer: " nil nil
|
|
|
|
|
(lambda (b) (next-error-buffer-p (cdr b)))))))
|
2018-04-17 22:27:48 +03:00
|
|
|
|
(setq next-error-last-buffer buffer))
|
2018-02-21 23:30:18 +02:00
|
|
|
|
|
2004-04-21 21:36:15 +00:00
|
|
|
|
(defalias 'goto-next-locus 'next-error)
|
|
|
|
|
(defalias 'next-match 'next-error)
|
|
|
|
|
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(defun previous-error (&optional n)
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"Visit previous `next-error' message and corresponding source code.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
|
|
|
|
Prefix arg N says how many error messages to move backwards (or
|
|
|
|
|
forwards, if negative).
|
|
|
|
|
|
2018-04-22 20:39:46 +03:00
|
|
|
|
This operates on the output from the \\[compile] and \\[grep] commands.
|
|
|
|
|
|
|
|
|
|
See `next-error' for the details."
|
2004-04-21 21:36:15 +00:00
|
|
|
|
(interactive "p")
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(next-error (- (or n 1))))
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(defun first-error (&optional n)
|
2004-04-21 21:36:15 +00:00
|
|
|
|
"Restart at the first error.
|
|
|
|
|
Visit corresponding source code.
|
|
|
|
|
With prefix arg N, visit the source code of the Nth error.
|
|
|
|
|
This operates on the output from the \\[compile] command, for instance."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(next-error n t))
|
|
|
|
|
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(defun next-error-no-select (&optional n)
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"Move point to the next error in the `next-error' buffer and highlight match.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
Prefix arg N says how many error messages to move forwards (or
|
|
|
|
|
backwards, if negative).
|
|
|
|
|
Finds and highlights the source line like \\[next-error], but does not
|
|
|
|
|
select the source buffer."
|
|
|
|
|
(interactive "p")
|
2004-09-01 18:41:06 +00:00
|
|
|
|
(let ((next-error-highlight next-error-highlight-no-select))
|
|
|
|
|
(next-error n))
|
2018-09-13 00:47:03 +03:00
|
|
|
|
(let ((display-buffer-overriding-action '(display-buffer-reuse-window)))
|
|
|
|
|
;; Override user customization such as display-buffer-same-window
|
|
|
|
|
;; and use display-buffer-reuse-window to ensure next-error-last-buffer
|
|
|
|
|
;; is displayed somewhere, not necessarily in the same window (bug#32607).
|
|
|
|
|
(pop-to-buffer next-error-last-buffer)))
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(defun previous-error-no-select (&optional n)
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
"Move point to the previous error in the `next-error' buffer and highlight match.
|
2004-04-21 21:36:15 +00:00
|
|
|
|
Prefix arg N says how many error messages to move backwards (or
|
|
|
|
|
forwards, if negative).
|
|
|
|
|
Finds and highlights the source line like \\[previous-error], but does not
|
|
|
|
|
select the source buffer."
|
|
|
|
|
(interactive "p")
|
2004-09-01 16:19:04 +00:00
|
|
|
|
(next-error-no-select (- (or n 1))))
|
2004-04-21 21:36:15 +00:00
|
|
|
|
|
2009-08-19 02:31:59 +00:00
|
|
|
|
;; Internal variable for `next-error-follow-mode-post-command-hook'.
|
2004-09-04 12:45:26 +00:00
|
|
|
|
(defvar next-error-follow-last-line nil)
|
|
|
|
|
|
2004-09-04 13:06:38 +00:00
|
|
|
|
(define-minor-mode next-error-follow-minor-mode
|
2004-09-04 12:45:26 +00:00
|
|
|
|
"Minor mode for compilation, occur and diff modes.
|
2018-07-01 23:34:53 -04:00
|
|
|
|
|
2004-09-04 13:06:38 +00:00
|
|
|
|
When turned on, cursor motion in the compilation, grep, occur or diff
|
2012-02-07 21:12:24 -05:00
|
|
|
|
buffer causes automatic display of the corresponding source code location."
|
2005-08-15 17:23:50 +00:00
|
|
|
|
:group 'next-error :init-value nil :lighter " Fol"
|
2004-09-06 18:51:57 +00:00
|
|
|
|
(if (not next-error-follow-minor-mode)
|
2004-09-04 12:45:26 +00:00
|
|
|
|
(remove-hook 'post-command-hook 'next-error-follow-mode-post-command-hook t)
|
|
|
|
|
(add-hook 'post-command-hook 'next-error-follow-mode-post-command-hook nil t)
|
2005-07-29 20:55:36 +00:00
|
|
|
|
(make-local-variable 'next-error-follow-last-line)))
|
2004-09-04 12:45:26 +00:00
|
|
|
|
|
2009-08-19 02:31:59 +00:00
|
|
|
|
;; Used as a `post-command-hook' by `next-error-follow-mode'
|
|
|
|
|
;; for the *Compilation* *grep* and *Occur* buffers.
|
2004-09-04 12:45:26 +00:00
|
|
|
|
(defun next-error-follow-mode-post-command-hook ()
|
|
|
|
|
(unless (equal next-error-follow-last-line (line-number-at-pos))
|
|
|
|
|
(setq next-error-follow-last-line (line-number-at-pos))
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(let ((compilation-context-lines nil))
|
|
|
|
|
(setq compilation-current-error (point))
|
|
|
|
|
(next-error-no-select 0))
|
|
|
|
|
(error t))))
|
|
|
|
|
|
2004-09-01 18:41:06 +00:00
|
|
|
|
|
2004-04-21 21:36:15 +00:00
|
|
|
|
;;;
|
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(defun fundamental-mode ()
|
|
|
|
|
"Major mode not specialized for anything in particular.
|
|
|
|
|
Other major modes are defined by comparison with this one."
|
|
|
|
|
(interactive)
|
2004-09-19 00:02:44 +00:00
|
|
|
|
(kill-all-local-variables)
|
2013-02-08 10:53:49 -05:00
|
|
|
|
(run-mode-hooks))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2015-06-09 20:34:50 -07:00
|
|
|
|
;; Special major modes to view specially formatted data rather than files.
|
|
|
|
|
|
|
|
|
|
(defvar special-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(suppress-keymap map)
|
|
|
|
|
(define-key map "q" 'quit-window)
|
|
|
|
|
(define-key map " " 'scroll-up-command)
|
|
|
|
|
(define-key map [?\S-\ ] 'scroll-down-command)
|
|
|
|
|
(define-key map "\C-?" 'scroll-down-command)
|
|
|
|
|
(define-key map "?" 'describe-mode)
|
|
|
|
|
(define-key map "h" 'describe-mode)
|
|
|
|
|
(define-key map ">" 'end-of-buffer)
|
|
|
|
|
(define-key map "<" 'beginning-of-buffer)
|
|
|
|
|
(define-key map "g" 'revert-buffer)
|
|
|
|
|
map))
|
|
|
|
|
|
|
|
|
|
(put 'special-mode 'mode-class 'special)
|
|
|
|
|
(define-derived-mode special-mode nil "Special"
|
|
|
|
|
"Parent major mode from which special major modes should inherit."
|
|
|
|
|
(setq buffer-read-only t))
|
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
;; Making and deleting lines.
|
|
|
|
|
|
2014-08-18 11:20:27 -04:00
|
|
|
|
(defvar self-insert-uses-region-functions nil
|
|
|
|
|
"Special hook to tell if `self-insert-command' will use the region.
|
|
|
|
|
It must be called via `run-hook-with-args-until-success' with no arguments.
|
2017-11-24 12:49:04 +02:00
|
|
|
|
|
|
|
|
|
If any function on this hook returns a non-nil value, `delete-selection-mode'
|
|
|
|
|
will act on that value (see `delete-selection-helper'), and will
|
|
|
|
|
usually delete the region. If all the functions on this hook return
|
|
|
|
|
nil, it is an indiction that `self-insert-command' needs the region
|
|
|
|
|
untouched by `delete-selection-mode', and will itself do whatever is
|
|
|
|
|
appropriate with the region.
|
|
|
|
|
Any function on `post-self-insert-hook' which act on the region should
|
|
|
|
|
add a function to this hook so that `delete-selection-mode' could
|
|
|
|
|
refrain from deleting the region before `post-self-insert-hook'
|
|
|
|
|
functions are called.
|
|
|
|
|
This hook is run by `delete-selection-uses-region-p', which see.")
|
2014-08-18 11:20:27 -04:00
|
|
|
|
|
2009-09-17 06:02:20 +00:00
|
|
|
|
(defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))
|
|
|
|
|
"Propertized string representing a hard newline character.")
|
* simple.el (hard-newline): New variable.
* mail/sendmail.el (mail-setup, mail-send, mail-insert-from-field)
(sendmail-send-it, mail-do-fcc, mail-cc, mail-bcc, mail-fcc)
(mail-mail-reply-to, mail-mail-followup-to)
(mail-position-on-field, mail-signature, mail-yank-original)
(mail-attach-file): Use it.
* mail/mailheader.el (mail-header-format)
(mail-header-format-function): Likewise.
* add-log.el (add-change-log-entry, change-log-merge): Likewise.
2005-11-17 16:30:52 +00:00
|
|
|
|
|
2013-10-19 18:17:56 -04:00
|
|
|
|
(defun newline (&optional arg interactive)
|
1995-04-09 06:47:22 +00:00
|
|
|
|
"Insert a newline, and move to left margin of the new line if it's blank.
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
If option `use-hard-newlines' is non-nil, the newline is marked with the
|
2001-12-18 15:53:57 +00:00
|
|
|
|
text-property `hard'.
|
2000-09-29 03:18:24 +00:00
|
|
|
|
With ARG, insert that many newlines.
|
2013-12-21 17:55:59 -05:00
|
|
|
|
|
2014-03-05 20:11:08 -08:00
|
|
|
|
If `electric-indent-mode' is enabled, this indents the final new line
|
|
|
|
|
that it adds, and reindents the preceding line. To just insert
|
|
|
|
|
a newline, use \\[electric-indent-just-newline].
|
2013-12-21 17:55:59 -05:00
|
|
|
|
|
|
|
|
|
Calls `auto-fill-function' if the current column number is greater
|
2013-10-19 18:17:56 -04:00
|
|
|
|
than the value of `fill-column' and ARG is nil.
|
2013-12-21 17:55:59 -05:00
|
|
|
|
A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'."
|
2013-10-19 18:17:56 -04:00
|
|
|
|
(interactive "*P\np")
|
1995-10-06 22:40:25 +00:00
|
|
|
|
(barf-if-buffer-read-only)
|
2010-09-03 13:12:46 +02:00
|
|
|
|
;; Call self-insert so that auto-fill, abbrev expansion etc. happens.
|
|
|
|
|
;; Set last-command-event to tell self-insert what to insert.
|
|
|
|
|
(let* ((was-page-start (and (bolp) (looking-at page-delimiter)))
|
|
|
|
|
(beforepos (point))
|
|
|
|
|
(last-command-event ?\n)
|
|
|
|
|
;; Don't auto-fill if we have a numeric argument.
|
|
|
|
|
(auto-fill-function (if arg nil auto-fill-function))
|
2016-03-19 21:32:27 +02:00
|
|
|
|
(arg (prefix-numeric-value arg))
|
2010-09-03 13:12:46 +02:00
|
|
|
|
(postproc
|
|
|
|
|
;; Do the rest in post-self-insert-hook, because we want to do it
|
|
|
|
|
;; *before* other functions on that hook.
|
|
|
|
|
(lambda ()
|
|
|
|
|
;; Mark the newline(s) `hard'.
|
|
|
|
|
(if use-hard-newlines
|
|
|
|
|
(set-hard-newline-properties
|
2016-03-19 21:32:27 +02:00
|
|
|
|
(- (point) arg) (point)))
|
2010-09-03 13:12:46 +02:00
|
|
|
|
;; If the newline leaves the previous line blank, and we
|
|
|
|
|
;; have a left margin, delete that from the blank line.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char beforepos)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(and (looking-at "[ \t]$")
|
|
|
|
|
(> (current-left-margin) 0)
|
|
|
|
|
(delete-region (point)
|
|
|
|
|
(line-end-position))))
|
|
|
|
|
;; Indent the line after the newline, except in one case:
|
|
|
|
|
;; when we added the newline at the beginning of a line which
|
|
|
|
|
;; starts a page.
|
|
|
|
|
(or was-page-start
|
|
|
|
|
(move-to-left-margin nil t)))))
|
2017-09-17 22:32:31 -07:00
|
|
|
|
(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 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))))
|
1995-03-01 15:09:58 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
1996-09-01 03:24:22 +00:00
|
|
|
|
(defun set-hard-newline-properties (from to)
|
|
|
|
|
(let ((sticky (get-text-property from 'rear-nonsticky)))
|
|
|
|
|
(put-text-property from to 'hard 't)
|
|
|
|
|
;; If rear-nonsticky is not "t", add 'hard to rear-nonsticky list
|
|
|
|
|
(if (and (listp sticky) (not (memq 'hard sticky)))
|
|
|
|
|
(put-text-property from (point) 'rear-nonsticky
|
|
|
|
|
(cons 'hard sticky)))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2015-11-21 22:50:05 -06:00
|
|
|
|
(defun open-line (n)
|
1992-08-21 07:18:16 +00:00
|
|
|
|
"Insert a newline and leave point before it.
|
2015-10-24 22:24:09 +01:00
|
|
|
|
If there is a fill prefix and/or a `left-margin', insert them on
|
Revert `open-line' electric-indent sensitivity
* lisp/simple.el (open-line): Remove electric indent code.
(electric-indent-just-newline): Don't declare.
* test/automated/simple-test.el (open-line-indent): Adjust test.
This partly reverts Artur Malabarba's change that added electric
indent sensitivity to `open-line' (Oct 24 22:26:27 2015 +0100, git
commit bd4f04f86), and adjusts a new test he added right afterwards
(Sat Oct 24 23:43:06 2015 +0100, git commit 207f235e3) accordingly.
However, the new INTERACTIVE argument to `open-line', which he also
added in the first commit, is not reverted here.
See the thread "Questioning the new behavior of `open-line'." on the
Emacs Devel mailing list, and in particular this message:
From: Artur Malabarba
Subject: Re: Questioning the new behavior of `open-line'.
To: Karl Fogel
Cc: David Kastrup, Pierpaolo Bernardi, emacs-devel
Date: Wed, 18 Nov 2015 21:03:58 +0000
Message-ID: \
<CAAdUY-KN06pvCMy5bt3+Buk3yeKjf6n9iB2FaSTTOPpCqPwyhA@mail.gmail.com>
https://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01707.html
2015-11-19 17:32:37 -06:00
|
|
|
|
the new line if the line would have been blank.
|
2015-11-21 22:50:05 -06:00
|
|
|
|
With arg N, insert N newlines."
|
|
|
|
|
(interactive "*p")
|
1992-08-31 20:22:03 +00:00
|
|
|
|
(let* ((do-fill-prefix (and fill-prefix (bolp)))
|
1995-02-23 18:38:42 +00:00
|
|
|
|
(do-left-margin (and (bolp) (> (current-left-margin) 0)))
|
2010-11-12 08:32:02 -05:00
|
|
|
|
(loc (point-marker))
|
2015-10-24 22:26:27 +01:00
|
|
|
|
;; Don't expand an abbrev before point.
|
2001-01-26 09:23:17 +00:00
|
|
|
|
(abbrev-mode nil))
|
2015-11-21 22:50:05 -06:00
|
|
|
|
(newline n)
|
1995-04-09 06:47:22 +00:00
|
|
|
|
(goto-char loc)
|
2004-05-07 22:31:54 +00:00
|
|
|
|
(while (> n 0)
|
1995-04-09 06:47:22 +00:00
|
|
|
|
(cond ((bolp)
|
|
|
|
|
(if do-left-margin (indent-to (current-left-margin)))
|
|
|
|
|
(if do-fill-prefix (insert-and-inherit fill-prefix))))
|
|
|
|
|
(forward-line 1)
|
2004-05-07 22:31:54 +00:00
|
|
|
|
(setq n (1- n)))
|
1995-04-09 06:47:22 +00:00
|
|
|
|
(goto-char loc)
|
2015-10-24 22:24:09 +01:00
|
|
|
|
;; Necessary in case a margin or prefix was inserted.
|
1995-04-09 06:47:22 +00:00
|
|
|
|
(end-of-line)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2003-01-03 22:46:06 +00:00
|
|
|
|
(defun split-line (&optional arg)
|
|
|
|
|
"Split current line, moving portion beyond point vertically down.
|
|
|
|
|
If the current line starts with `fill-prefix', insert it on the new
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
line as well. With prefix ARG, don't insert `fill-prefix' on new line.
|
2003-01-03 22:46:06 +00:00
|
|
|
|
|
2004-05-07 22:31:54 +00:00
|
|
|
|
When called from Lisp code, ARG may be a prefix string to copy."
|
2003-01-03 22:46:06 +00:00
|
|
|
|
(interactive "*P")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(skip-chars-forward " \t")
|
2003-01-06 01:17:19 +00:00
|
|
|
|
(let* ((col (current-column))
|
|
|
|
|
(pos (point))
|
|
|
|
|
;; What prefix should we check for (nil means don't).
|
|
|
|
|
(prefix (cond ((stringp arg) arg)
|
|
|
|
|
(arg nil)
|
|
|
|
|
(t fill-prefix)))
|
|
|
|
|
;; Does this line start with it?
|
|
|
|
|
(have-prfx (and prefix
|
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(looking-at (regexp-quote prefix))))))
|
1995-01-13 08:43:40 +00:00
|
|
|
|
(newline 1)
|
2003-01-06 01:17:19 +00:00
|
|
|
|
(if have-prfx (insert-and-inherit prefix))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(indent-to col 0)
|
|
|
|
|
(goto-char pos)))
|
|
|
|
|
|
|
|
|
|
(defun delete-indentation (&optional arg)
|
|
|
|
|
"Join this line to previous and fix up whitespace at join.
|
1992-07-29 02:15:26 +00:00
|
|
|
|
If there is a fill prefix, delete it from the beginning of this line.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
With argument, join this line to following line."
|
|
|
|
|
(interactive "*P")
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if arg (forward-line 1))
|
|
|
|
|
(if (eq (preceding-char) ?\n)
|
|
|
|
|
(progn
|
|
|
|
|
(delete-region (point) (1- (point)))
|
1992-07-29 02:15:26 +00:00
|
|
|
|
;; If the second line started with the fill prefix,
|
|
|
|
|
;; delete the prefix.
|
|
|
|
|
(if (and fill-prefix
|
1992-09-30 10:31:31 +00:00
|
|
|
|
(<= (+ (point) (length fill-prefix)) (point-max))
|
1992-07-29 02:15:26 +00:00
|
|
|
|
(string= fill-prefix
|
|
|
|
|
(buffer-substring (point)
|
|
|
|
|
(+ (point) (length fill-prefix)))))
|
|
|
|
|
(delete-region (point) (+ (point) (length fill-prefix))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(fixup-whitespace))))
|
|
|
|
|
|
1999-01-15 16:57:27 +00:00
|
|
|
|
(defalias 'join-line #'delete-indentation) ; easier to find
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun delete-blank-lines ()
|
|
|
|
|
"On blank line, delete all surrounding blank lines, leaving just one.
|
|
|
|
|
On isolated blank line, delete that one.
|
1994-06-07 07:47:24 +00:00
|
|
|
|
On nonblank line, delete any immediately following blank lines."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*")
|
|
|
|
|
(let (thisblank singleblank)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq thisblank (looking-at "[ \t]*$"))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
;; Set singleblank if there is just one blank line here.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(setq singleblank
|
|
|
|
|
(and thisblank
|
|
|
|
|
(not (looking-at "[ \t]*\n[ \t]*$"))
|
|
|
|
|
(or (bobp)
|
|
|
|
|
(progn (forward-line -1)
|
|
|
|
|
(not (looking-at "[ \t]*$")))))))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
;; Delete preceding blank lines, and this one too if it's the only one.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if thisblank
|
|
|
|
|
(progn
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if singleblank (forward-line 1))
|
|
|
|
|
(delete-region (point)
|
|
|
|
|
(if (re-search-backward "[^ \t\n]" nil t)
|
|
|
|
|
(progn (forward-line 1) (point))
|
|
|
|
|
(point-min)))))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
;; Delete following blank lines, unless the current line is blank
|
|
|
|
|
;; and there are no following blank lines.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (not (and thisblank singleblank))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(delete-region (point)
|
|
|
|
|
(if (re-search-forward "[^ \t\n]" nil t)
|
|
|
|
|
(progn (beginning-of-line) (point))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(point-max)))))
|
|
|
|
|
;; Handle the special case where point is followed by newline and eob.
|
|
|
|
|
;; Delete the line, leaving point at eob.
|
|
|
|
|
(if (looking-at "^[ \t]*\n\\'")
|
|
|
|
|
(delete-region (point) (point-max)))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2012-07-28 18:38:55 +08:00
|
|
|
|
(defcustom delete-trailing-lines t
|
|
|
|
|
"If non-nil, \\[delete-trailing-whitespace] deletes trailing lines.
|
|
|
|
|
Trailing lines are deleted only if `delete-trailing-whitespace'
|
|
|
|
|
is called on the entire buffer (rather than an active region)."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'editing
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
2012-07-28 18:38:55 +08:00
|
|
|
|
|
2016-12-07 15:06:08 -05:00
|
|
|
|
(defun region-modifiable-p (start end)
|
2016-12-07 20:10:54 -05:00
|
|
|
|
"Return non-nil if the region contains no read-only text."
|
2016-12-07 15:06:08 -05:00
|
|
|
|
(and (not (get-text-property start 'read-only))
|
|
|
|
|
(eq end (next-single-property-change start 'read-only nil end))))
|
|
|
|
|
|
2011-02-11 19:25:06 +01:00
|
|
|
|
(defun delete-trailing-whitespace (&optional start end)
|
2012-07-28 18:38:55 +08:00
|
|
|
|
"Delete trailing whitespace between START and END.
|
|
|
|
|
If called interactively, START and END are the start/end of the
|
|
|
|
|
region if the mark is active, or of the buffer's accessible
|
|
|
|
|
portion if the mark is inactive.
|
|
|
|
|
|
|
|
|
|
This command deletes whitespace characters after the last
|
|
|
|
|
non-whitespace character in each line between START and END. It
|
|
|
|
|
does not consider formfeed characters to be whitespace.
|
|
|
|
|
|
|
|
|
|
If this command acts on the entire buffer (i.e. if called
|
|
|
|
|
interactively with the mark inactive, or called from Lisp with
|
|
|
|
|
END nil), it also deletes all trailing lines at the end of the
|
|
|
|
|
buffer if the variable `delete-trailing-lines' is non-nil."
|
2011-02-11 19:25:06 +01:00
|
|
|
|
(interactive (progn
|
|
|
|
|
(barf-if-buffer-read-only)
|
|
|
|
|
(if (use-region-p)
|
|
|
|
|
(list (region-beginning) (region-end))
|
|
|
|
|
(list nil nil))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
(save-match-data
|
|
|
|
|
(save-excursion
|
2016-06-22 19:06:57 +02:00
|
|
|
|
(let ((end-marker (and end (copy-marker end))))
|
2016-06-21 16:52:52 +02:00
|
|
|
|
(goto-char (or start (point-min)))
|
|
|
|
|
(with-syntax-table (make-syntax-table (syntax-table))
|
2011-02-11 19:25:06 +01:00
|
|
|
|
;; Don't delete formfeeds, even if they are considered whitespace.
|
2016-06-21 16:52:52 +02:00
|
|
|
|
(modify-syntax-entry ?\f "_")
|
2017-03-14 09:23:08 -04:00
|
|
|
|
(while (re-search-forward "\\s-$" end-marker t)
|
|
|
|
|
(skip-syntax-backward "-" (line-beginning-position))
|
|
|
|
|
(let ((b (point)) (e (match-end 0)))
|
2018-06-04 19:33:07 +03:00
|
|
|
|
(if (region-modifiable-p b e)
|
|
|
|
|
(delete-region b e)
|
|
|
|
|
(goto-char e)))))
|
2016-06-22 19:06:57 +02:00
|
|
|
|
(if end
|
|
|
|
|
(set-marker end-marker nil)
|
|
|
|
|
;; Delete trailing empty lines.
|
|
|
|
|
(and delete-trailing-lines
|
|
|
|
|
;; Really the end of buffer.
|
|
|
|
|
(= (goto-char (point-max)) (1+ (buffer-size)))
|
|
|
|
|
(<= (skip-chars-backward "\n") -2)
|
2016-12-07 15:06:08 -05:00
|
|
|
|
(region-modifiable-p (1+ (point)) (point-max))
|
2016-06-22 19:06:57 +02:00
|
|
|
|
(delete-region (1+ (point)) (point-max)))))))
|
2011-03-10 12:28:33 +01:00
|
|
|
|
;; Return nil for the benefit of `write-file-functions'.
|
|
|
|
|
nil)
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun newline-and-indent ()
|
|
|
|
|
"Insert a newline, then indent according to major mode.
|
1992-08-21 07:18:16 +00:00
|
|
|
|
Indentation is done using the value of `indent-line-function'.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
In programming language modes, this is the same as TAB.
|
1992-08-21 07:18:16 +00:00
|
|
|
|
In some text modes, where TAB inserts a tab, this command indents to the
|
1995-01-19 04:21:56 +00:00
|
|
|
|
column specified by the function `current-left-margin'."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*")
|
2000-12-12 01:20:55 +00:00
|
|
|
|
(delete-horizontal-space t)
|
2014-03-18 16:49:24 -04:00
|
|
|
|
(newline nil t)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(indent-according-to-mode))
|
|
|
|
|
|
|
|
|
|
(defun reindent-then-newline-and-indent ()
|
|
|
|
|
"Reindent current line, insert newline, then indent the new line.
|
|
|
|
|
Indentation of both lines is done according to the current major mode,
|
1992-08-21 07:18:16 +00:00
|
|
|
|
which means calling the current value of `indent-line-function'.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
In programming language modes, this is the same as TAB.
|
|
|
|
|
In some text modes, where TAB inserts a tab, this indents to the
|
1995-01-19 04:21:56 +00:00
|
|
|
|
column specified by the function `current-left-margin'."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*")
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(let ((pos (point)))
|
|
|
|
|
;; Be careful to insert the newline before indenting the line.
|
|
|
|
|
;; Otherwise, the indentation might be wrong.
|
|
|
|
|
(newline)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char pos)
|
2007-10-24 01:51:03 +00:00
|
|
|
|
;; We are at EOL before the call to indent-according-to-mode, and
|
|
|
|
|
;; after it we usually are as well, but not always. We tried to
|
|
|
|
|
;; address it with `save-excursion' but that uses a normal marker
|
|
|
|
|
;; whereas we need `move after insertion', so we do the save/restore
|
|
|
|
|
;; by hand.
|
|
|
|
|
(setq pos (copy-marker pos t))
|
|
|
|
|
(indent-according-to-mode)
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
;; Remove the trailing white-space after indentation because
|
|
|
|
|
;; indentation may introduce the whitespace.
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(delete-horizontal-space t))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(indent-according-to-mode)))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2013-10-29 22:14:16 -04:00
|
|
|
|
(defcustom read-quoted-char-radix 8
|
2014-02-21 14:22:14 +01:00
|
|
|
|
"Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
|
2013-10-29 22:14:16 -04:00
|
|
|
|
Legitimate radix values are 8, 10 and 16."
|
|
|
|
|
:type '(choice (const 8) (const 10) (const 16))
|
|
|
|
|
:group 'editing-basics)
|
|
|
|
|
|
|
|
|
|
(defun read-quoted-char (&optional prompt)
|
|
|
|
|
"Like `read-char', but do not allow quitting.
|
|
|
|
|
Also, if the first character read is an octal digit,
|
|
|
|
|
we read any number of octal digits and return the
|
|
|
|
|
specified character code. Any nondigit terminates the sequence.
|
|
|
|
|
If the terminator is RET, it is discarded;
|
|
|
|
|
any other terminator is used itself as input.
|
|
|
|
|
|
|
|
|
|
The optional argument PROMPT specifies a string to use to prompt the user.
|
|
|
|
|
The variable `read-quoted-char-radix' controls which radix to use
|
|
|
|
|
for numeric input."
|
2014-06-20 08:14:43 +08:00
|
|
|
|
(let ((message-log-max nil)
|
|
|
|
|
(help-events (delq nil (mapcar (lambda (c) (unless (characterp c) c))
|
|
|
|
|
help-event-list)))
|
2016-11-25 12:06:26 +02:00
|
|
|
|
done (first t) (code 0) char translated)
|
2013-10-29 22:14:16 -04:00
|
|
|
|
(while (not done)
|
|
|
|
|
(let ((inhibit-quit first)
|
2014-06-20 08:14:43 +08:00
|
|
|
|
;; Don't let C-h or other help chars get the help
|
|
|
|
|
;; message--only help function keys. See bug#16617.
|
2013-10-29 22:14:16 -04:00
|
|
|
|
(help-char nil)
|
2014-06-20 08:14:43 +08:00
|
|
|
|
(help-event-list help-events)
|
2013-10-29 22:14:16 -04:00
|
|
|
|
(help-form
|
|
|
|
|
"Type the special character you want to use,
|
|
|
|
|
or the octal character code.
|
|
|
|
|
RET terminates the character code and is discarded;
|
|
|
|
|
any other non-digit terminates the character code and is then used as input."))
|
2016-11-25 12:06:26 +02:00
|
|
|
|
(setq char (read-event (and prompt (format "%s-" prompt)) t))
|
2013-10-29 22:14:16 -04:00
|
|
|
|
(if inhibit-quit (setq quit-flag nil)))
|
2016-11-25 12:06:26 +02:00
|
|
|
|
;; Translate TAB key into control-I ASCII character, and so on.
|
|
|
|
|
;; Note: `read-char' does it using the `ascii-character' property.
|
|
|
|
|
;; We tried using read-key instead, but that disables the keystroke
|
|
|
|
|
;; echo produced by 'C-q', see bug#24635.
|
|
|
|
|
(let ((translation (lookup-key local-function-key-map (vector char))))
|
|
|
|
|
(setq translated (if (arrayp translation)
|
|
|
|
|
(aref translation 0)
|
|
|
|
|
char)))
|
2013-10-29 22:14:16 -04:00
|
|
|
|
(if (integerp translated)
|
|
|
|
|
(setq translated (char-resolve-modifiers translated)))
|
|
|
|
|
(cond ((null translated))
|
|
|
|
|
((not (integerp translated))
|
2016-11-25 12:06:26 +02:00
|
|
|
|
(setq unread-command-events (list char)
|
2013-10-29 22:14:16 -04:00
|
|
|
|
done t))
|
|
|
|
|
((/= (logand translated ?\M-\^@) 0)
|
|
|
|
|
;; Turn a meta-character into a character with the 0200 bit set.
|
|
|
|
|
(setq code (logior (logand translated (lognot ?\M-\^@)) 128)
|
|
|
|
|
done t))
|
|
|
|
|
((and (<= ?0 translated)
|
|
|
|
|
(< translated (+ ?0 (min 10 read-quoted-char-radix))))
|
|
|
|
|
(setq code (+ (* code read-quoted-char-radix) (- translated ?0)))
|
|
|
|
|
(and prompt (setq prompt (message "%s %c" prompt translated))))
|
|
|
|
|
((and (<= ?a (downcase translated))
|
|
|
|
|
(< (downcase translated)
|
|
|
|
|
(+ ?a -10 (min 36 read-quoted-char-radix))))
|
|
|
|
|
(setq code (+ (* code read-quoted-char-radix)
|
|
|
|
|
(+ 10 (- (downcase translated) ?a))))
|
|
|
|
|
(and prompt (setq prompt (message "%s %c" prompt translated))))
|
|
|
|
|
((and (not first) (eq translated ?\C-m))
|
|
|
|
|
(setq done t))
|
|
|
|
|
((not first)
|
2016-11-25 12:06:26 +02:00
|
|
|
|
(setq unread-command-events (list char)
|
2013-10-29 22:14:16 -04:00
|
|
|
|
done t))
|
|
|
|
|
(t (setq code translated
|
|
|
|
|
done t)))
|
|
|
|
|
(setq first nil))
|
|
|
|
|
code))
|
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(defun quoted-insert (arg)
|
|
|
|
|
"Read next input character and insert it.
|
|
|
|
|
This is useful for inserting control characters.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With argument, insert ARG copies of the character.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
If the first character you type after this command is an octal digit,
|
|
|
|
|
you should type a sequence of octal digits which specify a character code.
|
|
|
|
|
Any nondigit terminates the sequence. If the terminator is a RET,
|
|
|
|
|
it is discarded; any other terminator is used itself as input.
|
|
|
|
|
The variable `read-quoted-char-radix' specifies the radix for this feature;
|
|
|
|
|
set it to 10 or 16 to use decimal or hex instead of octal.
|
1993-04-29 13:57:52 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
In overwrite mode, this function inserts the character anyway, and
|
|
|
|
|
does not handle octal digits specially. This means that if you use
|
|
|
|
|
overwrite as your normal editing mode, you can use this function to
|
|
|
|
|
insert characters when necessary.
|
1993-04-29 13:57:52 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
In binary overwrite mode, this function does overwrite, and octal
|
|
|
|
|
digits are interpreted as a character code. This is intended to be
|
|
|
|
|
useful for editing binary files."
|
|
|
|
|
(interactive "*p")
|
2009-02-14 09:06:30 +00:00
|
|
|
|
(let* ((char
|
|
|
|
|
;; Avoid "obsolete" warnings for translation-table-for-input.
|
|
|
|
|
(with-no-warnings
|
|
|
|
|
(let (translation-table-for-input input-method-function)
|
|
|
|
|
(if (or (not overwrite-mode)
|
|
|
|
|
(eq overwrite-mode 'overwrite-mode-binary))
|
|
|
|
|
(read-quoted-char)
|
|
|
|
|
(read-char))))))
|
2008-07-30 16:38:29 +00:00
|
|
|
|
;; This used to assume character codes 0240 - 0377 stand for
|
|
|
|
|
;; characters in some single-byte character set, and converted them
|
|
|
|
|
;; to Emacs characters. But in 23.1 this feature is deprecated
|
|
|
|
|
;; in favor of inserting the corresponding Unicode characters.
|
|
|
|
|
;; (if (and enable-multibyte-characters
|
|
|
|
|
;; (>= char ?\240)
|
|
|
|
|
;; (<= char ?\377))
|
|
|
|
|
;; (setq char (unibyte-char-to-multibyte char)))
|
2014-02-07 12:13:31 +01:00
|
|
|
|
(unless (characterp char)
|
|
|
|
|
(user-error "%s is not a valid character"
|
|
|
|
|
(key-description (vector char))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(if (> arg 0)
|
|
|
|
|
(if (eq overwrite-mode 'overwrite-mode-binary)
|
|
|
|
|
(delete-char arg)))
|
|
|
|
|
(while (> arg 0)
|
|
|
|
|
(insert-and-inherit char)
|
|
|
|
|
(setq arg (1- arg)))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defun forward-to-indentation (&optional arg)
|
1999-08-16 20:42:38 +00:00
|
|
|
|
"Move forward ARG lines and position at first nonblank character."
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p")
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(forward-line (or arg 1))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(skip-chars-forward " \t"))
|
1998-03-06 05:51:51 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defun backward-to-indentation (&optional arg)
|
1999-08-16 20:42:38 +00:00
|
|
|
|
"Move backward ARG lines and position at first nonblank character."
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p")
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(forward-line (- (or arg 1)))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(skip-chars-forward " \t"))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(defun back-to-indentation ()
|
|
|
|
|
"Move point to the first non-whitespace character on this line."
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^")
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(beginning-of-line 1)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(skip-syntax-forward " " (line-end-position))
|
2003-04-24 01:57:46 +00:00
|
|
|
|
;; Move back over chars that have whitespace syntax but have the p flag.
|
|
|
|
|
(backward-prefix-chars))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
|
|
|
|
(defun fixup-whitespace ()
|
|
|
|
|
"Fixup white space between objects around point.
|
|
|
|
|
Leave one space or none, according to the context."
|
|
|
|
|
(interactive "*")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(delete-horizontal-space)
|
2014-10-21 11:59:11 +02:00
|
|
|
|
(if (or (looking-at "^\\|$\\|\\s)")
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(save-excursion (forward-char -1)
|
|
|
|
|
(looking-at "$\\|\\s(\\|\\s'")))
|
|
|
|
|
nil
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
(insert ?\s))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
2000-12-12 01:20:55 +00:00
|
|
|
|
(defun delete-horizontal-space (&optional backward-only)
|
|
|
|
|
"Delete all spaces and tabs around point.
|
2006-12-23 18:08:24 +00:00
|
|
|
|
If BACKWARD-ONLY is non-nil, only delete them before point."
|
2006-12-17 22:14:48 +00:00
|
|
|
|
(interactive "*P")
|
2001-05-18 07:13:47 +00:00
|
|
|
|
(let ((orig-pos (point)))
|
|
|
|
|
(delete-region
|
|
|
|
|
(if backward-only
|
|
|
|
|
orig-pos
|
|
|
|
|
(progn
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(constrain-to-field nil orig-pos t)))
|
2000-12-12 01:20:55 +00:00
|
|
|
|
(progn
|
2001-05-18 07:13:47 +00:00
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(constrain-to-field nil orig-pos)))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
2005-01-17 10:56:07 +00:00
|
|
|
|
(defun just-one-space (&optional n)
|
2010-12-06 13:21:42 -05:00
|
|
|
|
"Delete all spaces and tabs around point, leaving one space (or N spaces).
|
2014-01-29 00:27:55 -08:00
|
|
|
|
If N is negative, delete newlines as well, leaving -N spaces.
|
|
|
|
|
See also `cycle-spacing'."
|
2005-01-15 18:08:46 +00:00
|
|
|
|
(interactive "*p")
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(cycle-spacing n nil 'single-shot))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
|
|
|
|
(defvar cycle-spacing--context nil
|
|
|
|
|
"Store context used in consecutive calls to `cycle-spacing' command.
|
2014-03-30 17:35:12 -07:00
|
|
|
|
The first time `cycle-spacing' runs, it saves in this variable:
|
|
|
|
|
its N argument, the original point position, and the original spacing
|
|
|
|
|
around point.")
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(defun cycle-spacing (&optional n preserve-nl-back mode)
|
2014-01-29 00:27:55 -08:00
|
|
|
|
"Manipulate whitespace around point in a smart way.
|
2014-03-30 17:35:12 -07:00
|
|
|
|
In interactive use, this function behaves differently in successive
|
|
|
|
|
consecutive calls.
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
2014-03-30 17:35:12 -07:00
|
|
|
|
The first call in a sequence acts like `just-one-space'.
|
|
|
|
|
It deletes all spaces and tabs around point, leaving one space
|
|
|
|
|
\(or N spaces). N is the prefix argument. If N is negative,
|
|
|
|
|
it deletes newlines as well, leaving -N spaces.
|
|
|
|
|
\(If PRESERVE-NL-BACK is non-nil, it does not delete newlines before point.)
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
2014-03-28 17:26:15 +01:00
|
|
|
|
The second call in a sequence deletes all spaces.
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
2014-03-30 17:35:12 -07:00
|
|
|
|
The third call in a sequence restores the original whitespace (and point).
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
2014-03-30 17:35:12 -07:00
|
|
|
|
If MODE is `single-shot', it only performs the first step in the sequence.
|
|
|
|
|
If MODE is `fast' and the first step would not result in any change
|
|
|
|
|
\(i.e., there are exactly (abs N) spaces around point),
|
|
|
|
|
the function goes straight to the second step.
|
2014-03-28 17:26:15 +01:00
|
|
|
|
|
2014-03-30 17:35:12 -07:00
|
|
|
|
Repeatedly calling the function with different values of N starts a
|
|
|
|
|
new sequence each time."
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(interactive "*p")
|
|
|
|
|
(let ((orig-pos (point))
|
|
|
|
|
(skip-characters (if (and n (< n 0)) " \t\n\r" " \t"))
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(num (abs (or n 1))))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(skip-chars-backward (if preserve-nl-back " \t" skip-characters))
|
2001-05-18 07:13:47 +00:00
|
|
|
|
(constrain-to-field nil orig-pos)
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(cond
|
2014-03-28 17:26:15 +01:00
|
|
|
|
;; Command run for the first time, single-shot mode or different argument
|
|
|
|
|
((or (eq 'single-shot mode)
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(not (equal last-command this-command))
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(not cycle-spacing--context)
|
|
|
|
|
(not (eq (car cycle-spacing--context) n)))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(let* ((start (point))
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(num (- num (skip-chars-forward " " (+ num (point)))))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(mid (point))
|
|
|
|
|
(end (progn
|
|
|
|
|
(skip-chars-forward skip-characters)
|
|
|
|
|
(constrain-to-field nil orig-pos t))))
|
|
|
|
|
(setq cycle-spacing--context ;; Save for later.
|
|
|
|
|
;; Special handling for case where there was no space at all.
|
|
|
|
|
(unless (= start end)
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(cons n (cons orig-pos (buffer-substring start (point))))))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
;; If this run causes no change in buffer content, delete all spaces,
|
2013-02-01 22:04:06 -08:00
|
|
|
|
;; otherwise delete all excess spaces.
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(delete-region (if (and (eq mode 'fast) (zerop num) (= mid end))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
start mid) end)
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(insert (make-string num ?\s))))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
|
|
|
|
|
;; Command run for the second time.
|
|
|
|
|
((not (equal orig-pos (point)))
|
|
|
|
|
(delete-region (point) orig-pos))
|
|
|
|
|
|
|
|
|
|
;; Command run for the third time.
|
|
|
|
|
(t
|
2014-03-28 17:26:15 +01:00
|
|
|
|
(insert (cddr cycle-spacing--context))
|
|
|
|
|
(goto-char (cadr cycle-spacing--context))
|
2013-01-30 21:57:35 -05:00
|
|
|
|
(setq cycle-spacing--context nil)))))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun beginning-of-buffer (&optional arg)
|
2010-08-26 11:09:45 -04:00
|
|
|
|
"Move point to the beginning of the buffer.
|
2004-07-16 10:42:00 +00:00
|
|
|
|
With numeric arg N, put point N/10 of the way from the beginning.
|
2010-08-26 11:09:45 -04:00
|
|
|
|
If the buffer is narrowed, this command uses the beginning of the
|
|
|
|
|
accessible part of the buffer.
|
1994-11-28 19:44:16 +00:00
|
|
|
|
|
2015-10-30 12:05:33 +02:00
|
|
|
|
Push mark at previous position, unless either a \\[universal-argument] prefix
|
|
|
|
|
is supplied, or Transient Mark mode is enabled and the mark is active."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only "use `(goto-char (point-min))' instead."))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^P")
|
2004-12-14 12:17:43 +00:00
|
|
|
|
(or (consp arg)
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(region-active-p)
|
2004-12-13 03:08:52 +00:00
|
|
|
|
(push-mark))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
(let ((size (- (point-max) (point-min))))
|
2004-07-16 10:42:00 +00:00
|
|
|
|
(goto-char (if (and arg (not (consp arg)))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
(+ (point-min)
|
|
|
|
|
(if (> size 10000)
|
|
|
|
|
;; Avoid overflow for large buffer sizes!
|
|
|
|
|
(* (prefix-numeric-value arg)
|
|
|
|
|
(/ size 10))
|
|
|
|
|
(/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
|
|
|
|
|
(point-min))))
|
2007-03-04 17:48:56 +00:00
|
|
|
|
(if (and arg (not (consp arg))) (forward-line 1)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun end-of-buffer (&optional arg)
|
2010-08-26 11:09:45 -04:00
|
|
|
|
"Move point to the end of the buffer.
|
2004-07-16 10:42:00 +00:00
|
|
|
|
With numeric arg N, put point N/10 of the way from the end.
|
2010-08-26 11:09:45 -04:00
|
|
|
|
If the buffer is narrowed, this command uses the end of the
|
|
|
|
|
accessible part of the buffer.
|
1994-11-28 19:44:16 +00:00
|
|
|
|
|
2015-10-30 12:05:33 +02:00
|
|
|
|
Push mark at previous position, unless either a \\[universal-argument] prefix
|
|
|
|
|
is supplied, or Transient Mark mode is enabled and the mark is active."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only "use `(goto-char (point-max))' instead."))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^P")
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(or (consp arg) (region-active-p) (push-mark))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
(let ((size (- (point-max) (point-min))))
|
2004-07-16 10:42:00 +00:00
|
|
|
|
(goto-char (if (and arg (not (consp arg)))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
(- (point-max)
|
|
|
|
|
(if (> size 10000)
|
|
|
|
|
;; Avoid overflow for large buffer sizes!
|
|
|
|
|
(* (prefix-numeric-value arg)
|
|
|
|
|
(/ size 10))
|
|
|
|
|
(/ (* size (prefix-numeric-value arg)) 10)))
|
|
|
|
|
(point-max))))
|
1992-07-22 04:22:42 +00:00
|
|
|
|
;; If we went to a place in the middle of the buffer,
|
|
|
|
|
;; adjust it to the beginning of a line.
|
2007-03-04 17:48:56 +00:00
|
|
|
|
(cond ((and arg (not (consp arg))) (forward-line 1))
|
2013-02-08 10:53:49 -05:00
|
|
|
|
((and (eq (current-buffer) (window-buffer))
|
|
|
|
|
(> (point) (window-end nil t)))
|
1999-11-01 11:44:58 +00:00
|
|
|
|
;; If the end of the buffer is not already on the screen,
|
|
|
|
|
;; then scroll specially to put it near, but not at, the bottom.
|
|
|
|
|
(overlay-recenter (point))
|
|
|
|
|
(recenter -3))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2010-06-27 21:01:11 -04:00
|
|
|
|
(defcustom delete-active-region t
|
|
|
|
|
"Whether single-char deletion commands delete an active region.
|
|
|
|
|
This has an effect only if Transient Mark mode is enabled, and
|
|
|
|
|
affects `delete-forward-char' and `delete-backward-char', though
|
|
|
|
|
not `delete-char'.
|
|
|
|
|
|
|
|
|
|
If the value is the symbol `kill', the active region is killed
|
|
|
|
|
instead of deleted."
|
|
|
|
|
:type '(choice (const :tag "Delete active region" t)
|
|
|
|
|
(const :tag "Kill active region" kill)
|
|
|
|
|
(const :tag "Do ordinary deletion" nil))
|
2012-04-22 15:19:29 +08:00
|
|
|
|
:group 'killing
|
2010-06-27 21:01:11 -04:00
|
|
|
|
:version "24.1")
|
|
|
|
|
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(defvar region-extract-function
|
2017-08-05 11:03:24 +03:00
|
|
|
|
(lambda (method)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(when (region-beginning)
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(cond
|
2017-08-05 11:03:24 +03:00
|
|
|
|
((eq method 'bounds)
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(list (cons (region-beginning) (region-end))))
|
2017-08-05 11:03:24 +03:00
|
|
|
|
((eq method 'delete-only)
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(delete-region (region-beginning) (region-end)))
|
|
|
|
|
(t
|
2017-08-05 11:03:24 +03:00
|
|
|
|
(filter-buffer-substring (region-beginning) (region-end) method)))))
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
"Function to get the region's content.
|
2018-04-24 14:06:20 -04:00
|
|
|
|
Called with one argument METHOD which can be:
|
2018-10-27 14:08:40 +03:00
|
|
|
|
- nil: return the content as a string (list of strings for
|
|
|
|
|
non-contiguous regions).
|
2018-04-24 14:06:20 -04:00
|
|
|
|
- `delete-only': delete the region; the return value is undefined.
|
2018-10-27 14:08:40 +03:00
|
|
|
|
- `bounds': return the boundaries of the region as a list of one
|
|
|
|
|
or more cons cells of the form (START . END).
|
2018-04-24 14:06:20 -04:00
|
|
|
|
- anything else: delete the region and return its content
|
2018-10-27 14:08:40 +03:00
|
|
|
|
as a string (or list of strings for non-contiguous regions),
|
|
|
|
|
after filtering it with `filter-buffer-substring', which
|
|
|
|
|
is called, for each contiguous sub-region, with METHOD as its
|
|
|
|
|
3rd argument.")
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(defvar region-insert-function
|
|
|
|
|
(lambda (lines)
|
|
|
|
|
(let ((first t))
|
|
|
|
|
(while lines
|
|
|
|
|
(or first
|
|
|
|
|
(insert ?\n))
|
|
|
|
|
(insert-for-yank (car lines))
|
|
|
|
|
(setq lines (cdr lines)
|
|
|
|
|
first nil))))
|
|
|
|
|
"Function to insert the region's content.
|
|
|
|
|
Called with one argument LINES.
|
|
|
|
|
Insert the region as a list of lines.")
|
|
|
|
|
|
2010-06-27 21:01:11 -04:00
|
|
|
|
(defun delete-backward-char (n &optional killflag)
|
|
|
|
|
"Delete the previous N characters (following if N is negative).
|
|
|
|
|
If Transient Mark mode is enabled, the mark is active, and N is 1,
|
|
|
|
|
delete the text in the region and deactivate the mark instead.
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
To disable this, set option `delete-active-region' to nil.
|
2010-06-27 21:01:11 -04:00
|
|
|
|
|
|
|
|
|
Optional second arg KILLFLAG, if non-nil, means to kill (save in
|
|
|
|
|
kill ring) instead of delete. Interactively, N is the prefix
|
|
|
|
|
arg, and KILLFLAG is set if N is explicitly specified.
|
|
|
|
|
|
2015-12-07 18:20:43 +02:00
|
|
|
|
When killing, the killed text is filtered by
|
|
|
|
|
`filter-buffer-substring' before it is saved in the kill ring, so
|
|
|
|
|
the actual saved text might be different from what was killed.
|
|
|
|
|
|
2010-06-27 21:01:11 -04:00
|
|
|
|
In Overwrite mode, single character backward deletion may replace
|
|
|
|
|
tabs with spaces so as to back over columns, unless point is at
|
|
|
|
|
the end of the line."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only delete-char))
|
2010-06-27 21:01:11 -04:00
|
|
|
|
(interactive "p\nP")
|
|
|
|
|
(unless (integerp n)
|
|
|
|
|
(signal 'wrong-type-argument (list 'integerp n)))
|
|
|
|
|
(cond ((and (use-region-p)
|
|
|
|
|
delete-active-region
|
|
|
|
|
(= n 1))
|
|
|
|
|
;; If a region is active, kill or delete it.
|
|
|
|
|
(if (eq delete-active-region 'kill)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(kill-region (region-beginning) (region-end) 'region)
|
|
|
|
|
(funcall region-extract-function 'delete-only)))
|
2010-06-27 21:01:11 -04:00
|
|
|
|
;; In Overwrite mode, maybe untabify while deleting
|
|
|
|
|
((null (or (null overwrite-mode)
|
|
|
|
|
(<= n 0)
|
|
|
|
|
(memq (char-before) '(?\t ?\n))
|
|
|
|
|
(eobp)
|
|
|
|
|
(eq (char-after) ?\n)))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(let ((ocol (current-column)))
|
|
|
|
|
(delete-char (- n) killflag)
|
2010-06-27 21:01:11 -04:00
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-char ?\s (- ocol (current-column)) nil))))
|
|
|
|
|
;; Otherwise, do simple deletion.
|
|
|
|
|
(t (delete-char (- n) killflag))))
|
|
|
|
|
|
|
|
|
|
(defun delete-forward-char (n &optional killflag)
|
2010-08-07 13:11:07 +03:00
|
|
|
|
"Delete the following N characters (previous if N is negative).
|
2010-06-27 21:01:11 -04:00
|
|
|
|
If Transient Mark mode is enabled, the mark is active, and N is 1,
|
|
|
|
|
delete the text in the region and deactivate the mark instead.
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
To disable this, set variable `delete-active-region' to nil.
|
2010-06-27 21:01:11 -04:00
|
|
|
|
|
|
|
|
|
Optional second arg KILLFLAG non-nil means to kill (save in kill
|
|
|
|
|
ring) instead of delete. Interactively, N is the prefix arg, and
|
2015-12-07 18:20:43 +02:00
|
|
|
|
KILLFLAG is set if N was explicitly specified.
|
|
|
|
|
|
|
|
|
|
When killing, the killed text is filtered by
|
|
|
|
|
`filter-buffer-substring' before it is saved in the kill ring, so
|
|
|
|
|
the actual saved text might be different from what was killed."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only delete-char))
|
2010-06-27 21:01:11 -04:00
|
|
|
|
(interactive "p\nP")
|
|
|
|
|
(unless (integerp n)
|
|
|
|
|
(signal 'wrong-type-argument (list 'integerp n)))
|
|
|
|
|
(cond ((and (use-region-p)
|
|
|
|
|
delete-active-region
|
|
|
|
|
(= n 1))
|
|
|
|
|
;; If a region is active, kill or delete it.
|
|
|
|
|
(if (eq delete-active-region 'kill)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(kill-region (region-beginning) (region-end) 'region)
|
|
|
|
|
(funcall region-extract-function 'delete-only)))
|
|
|
|
|
|
2010-06-27 21:01:11 -04:00
|
|
|
|
;; Otherwise, do simple deletion.
|
|
|
|
|
(t (delete-char n killflag))))
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun mark-whole-buffer ()
|
1992-06-12 22:23:00 +00:00
|
|
|
|
"Put point at beginning and mark at end of buffer.
|
2018-03-11 11:25:01 +01:00
|
|
|
|
Also push mark at point before pushing mark at end of buffer.
|
2011-11-14 19:38:10 -05:00
|
|
|
|
If narrowing is in effect, only uses the accessible part of the buffer.
|
1992-06-12 22:23:00 +00:00
|
|
|
|
You probably should not use this function in Lisp programs;
|
|
|
|
|
it is usually a mistake for a Lisp function to use any subroutine
|
|
|
|
|
that uses or sets the mark."
|
Include interactive-only information in describe-function output
* lisp/help-fns.el (help-fns--interactive-only): New function.
(help-fns-describe-function-functions): Add the above function.
* lisp/simple.el (beginning-of-buffer, end-of-buffer, insert-buffer)
(next-line, previous-line): Remove hand-written interactive-only
information from doc strings, it is auto-generated now.
* lisp/bookmark.el (bookmark-write):
* lisp/epa-mail.el (epa-mail-decrypt, epa-mail-verify, epa-mail-sign)
(epa-mail-import-keys): Mark interactive-only,
and remove hand-written interactive-only information from doc strings.
* lisp/epa.el (epa-decrypt-armor-in-region, epa-verify-region)
(epa-verify-cleartext-in-region, epa-sign-region, epa-encrypt-region):
* lisp/files.el (not-modified):
* lisp/simple.el (mark-whole-buffer): Mark interactive-only.
* doc/lispref/commands.texi (Defining Commands):
Mention that interactive-only also affects describe-function.
* etc/NEWS: Mention this.
2014-03-22 15:36:29 -07:00
|
|
|
|
(declare (interactive-only t))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive)
|
2017-04-28 11:25:26 +03:00
|
|
|
|
(push-mark)
|
1993-05-16 15:39:39 +00:00
|
|
|
|
(push-mark (point-max) nil t)
|
2016-04-27 19:52:46 +02:00
|
|
|
|
;; This is really `point-min' in most cases, but if we're in the
|
|
|
|
|
;; minibuffer, this is at the end of the prompt.
|
|
|
|
|
(goto-char (minibuffer-prompt-end)))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
;; Counting lines, one way or another.
|
|
|
|
|
|
2008-11-22 17:33:06 +00:00
|
|
|
|
(defun goto-line (line &optional buffer)
|
2012-03-12 00:57:04 +08:00
|
|
|
|
"Go to LINE, counting from line 1 at beginning of buffer.
|
|
|
|
|
If called interactively, a numeric prefix argument specifies
|
|
|
|
|
LINE; without a numeric prefix argument, read LINE from the
|
|
|
|
|
minibuffer.
|
2008-11-22 17:33:06 +00:00
|
|
|
|
|
2012-03-12 00:57:04 +08:00
|
|
|
|
If optional argument BUFFER is non-nil, switch to that buffer and
|
|
|
|
|
move to line LINE there. If called interactively with \\[universal-argument]
|
|
|
|
|
as argument, BUFFER is the most recently selected other buffer.
|
|
|
|
|
|
|
|
|
|
Prior to moving point, this function sets the mark (without
|
|
|
|
|
activating it), unless Transient Mark mode is enabled and the
|
|
|
|
|
mark is already active.
|
2009-08-10 16:38:16 +00:00
|
|
|
|
|
|
|
|
|
This function is usually the wrong thing to use in a Lisp program.
|
|
|
|
|
What you probably want instead is something like:
|
2012-03-12 00:57:04 +08:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line (1- N))
|
2009-08-10 16:38:16 +00:00
|
|
|
|
If at all possible, an even better solution is to use char counts
|
|
|
|
|
rather than line counts."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only forward-line))
|
2005-03-05 18:02:40 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(if (and current-prefix-arg (not (consp current-prefix-arg)))
|
|
|
|
|
(list (prefix-numeric-value current-prefix-arg))
|
|
|
|
|
;; Look for a default, a number in the buffer at point.
|
|
|
|
|
(let* ((default
|
|
|
|
|
(save-excursion
|
|
|
|
|
(skip-chars-backward "0-9")
|
|
|
|
|
(if (looking-at "[0-9]")
|
2011-07-28 16:05:07 +02:00
|
|
|
|
(string-to-number
|
|
|
|
|
(buffer-substring-no-properties
|
|
|
|
|
(point)
|
|
|
|
|
(progn (skip-chars-forward "0-9")
|
|
|
|
|
(point)))))))
|
2005-03-05 18:02:40 +00:00
|
|
|
|
;; Decide if we're switching buffers.
|
|
|
|
|
(buffer
|
|
|
|
|
(if (consp current-prefix-arg)
|
|
|
|
|
(other-buffer (current-buffer) t)))
|
|
|
|
|
(buffer-prompt
|
|
|
|
|
(if buffer
|
|
|
|
|
(concat " in " (buffer-name buffer))
|
|
|
|
|
"")))
|
|
|
|
|
;; Read the argument, offering that number (if any) as default.
|
2012-07-29 21:11:42 +03:00
|
|
|
|
(list (read-number (format "Goto line%s: " buffer-prompt)
|
|
|
|
|
(list default (line-number-at-pos)))
|
2005-03-05 18:02:40 +00:00
|
|
|
|
buffer))))
|
|
|
|
|
;; Switch to the desired buffer, one way or another.
|
|
|
|
|
(if buffer
|
|
|
|
|
(let ((window (get-buffer-window buffer)))
|
|
|
|
|
(if window (select-window window)
|
|
|
|
|
(switch-to-buffer-other-window buffer))))
|
2008-03-16 17:45:11 +00:00
|
|
|
|
;; Leave mark at previous position
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(or (region-active-p) (push-mark))
|
2005-03-05 18:02:40 +00:00
|
|
|
|
;; Move to the specified line number in that buffer.
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
2009-08-10 16:38:16 +00:00
|
|
|
|
(goto-char (point-min))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(if (eq selective-display t)
|
2008-11-22 17:33:06 +00:00
|
|
|
|
(re-search-forward "[\n\C-m]" nil 'end (1- line))
|
|
|
|
|
(forward-line (1- line)))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2012-08-11 00:02:48 +08:00
|
|
|
|
(defun count-words-region (start end &optional arg)
|
2012-03-05 14:10:11 +08:00
|
|
|
|
"Count the number of words in the region.
|
2011-10-08 12:37:46 -04:00
|
|
|
|
If called interactively, print a message reporting the number of
|
2012-08-11 00:02:48 +08:00
|
|
|
|
lines, words, and characters in the region (whether or not the
|
|
|
|
|
region is active); with prefix ARG, report for the entire buffer
|
|
|
|
|
rather than the region.
|
|
|
|
|
|
2012-03-05 14:10:11 +08:00
|
|
|
|
If called from Lisp, return the number of words between positions
|
|
|
|
|
START and END."
|
2012-09-07 16:58:31 +08:00
|
|
|
|
(interactive (if current-prefix-arg
|
|
|
|
|
(list nil nil current-prefix-arg)
|
|
|
|
|
(list (region-beginning) (region-end) nil)))
|
2012-08-11 00:02:48 +08:00
|
|
|
|
(cond ((not (called-interactively-p 'any))
|
|
|
|
|
(count-words start end))
|
|
|
|
|
(arg
|
|
|
|
|
(count-words--buffer-message))
|
|
|
|
|
(t
|
|
|
|
|
(count-words--message "Region" start end))))
|
2012-03-05 14:10:11 +08:00
|
|
|
|
|
|
|
|
|
(defun count-words (start end)
|
|
|
|
|
"Count words between START and END.
|
|
|
|
|
If called interactively, START and END are normally the start and
|
|
|
|
|
end of the buffer; but if the region is active, START and END are
|
|
|
|
|
the start and end of the region. Print a message reporting the
|
|
|
|
|
number of lines, words, and chars.
|
|
|
|
|
|
|
|
|
|
If called from Lisp, return the number of words between START and
|
|
|
|
|
END, without printing any message."
|
|
|
|
|
(interactive (list nil nil))
|
|
|
|
|
(cond ((not (called-interactively-p 'any))
|
|
|
|
|
(let ((words 0))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region start end)
|
|
|
|
|
(goto-char (point-min))
|
Fix problems caused by new implementation of sub-word mode
* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.
* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.
* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'. (Bug#22560)
* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.
* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.
[This reapplies commit c1d32a65372c72d7de4808d620eefd3214a8e92a,
which was inadvertently lost by merge commit
c71e7cc113ed0d5f01aaa2e441a3e3c9fbeb9fa5.]
2016-03-21 17:42:35 -07:00
|
|
|
|
(while (forward-word-strictly 1)
|
2012-03-05 14:10:11 +08:00
|
|
|
|
(setq words (1+ words)))))
|
|
|
|
|
words))
|
|
|
|
|
((use-region-p)
|
|
|
|
|
(call-interactively 'count-words-region))
|
|
|
|
|
(t
|
2012-08-11 00:02:48 +08:00
|
|
|
|
(count-words--buffer-message))))
|
|
|
|
|
|
|
|
|
|
(defun count-words--buffer-message ()
|
|
|
|
|
(count-words--message
|
2012-09-07 16:58:31 +08:00
|
|
|
|
(if (buffer-narrowed-p) "Narrowed part of buffer" "Buffer")
|
2012-08-11 00:02:48 +08:00
|
|
|
|
(point-min) (point-max)))
|
2012-03-05 14:10:11 +08:00
|
|
|
|
|
|
|
|
|
(defun count-words--message (str start end)
|
|
|
|
|
(let ((lines (count-lines start end))
|
|
|
|
|
(words (count-words start end))
|
|
|
|
|
(chars (- end start)))
|
|
|
|
|
(message "%s has %d line%s, %d word%s, and %d character%s."
|
|
|
|
|
str
|
|
|
|
|
lines (if (= lines 1) "" "s")
|
|
|
|
|
words (if (= words 1) "" "s")
|
|
|
|
|
chars (if (= chars 1) "" "s"))))
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'count-lines-region 'count-words-region "24.1")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun what-line ()
|
1995-08-25 14:16:26 +00:00
|
|
|
|
"Print the current buffer line number and narrowed line number of point."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive)
|
2004-12-03 22:26:13 +00:00
|
|
|
|
(let ((start (point-min))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(n (line-number-at-pos)))
|
|
|
|
|
(if (= start 1)
|
|
|
|
|
(message "Line %d" n)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(message "line %d (narrowed line %d)"
|
|
|
|
|
(+ n (line-number-at-pos start) -1) n))))))
|
1995-08-25 14:16:26 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun count-lines (start end)
|
|
|
|
|
"Return number of lines between START and END.
|
|
|
|
|
This is usually the number of newlines between them,
|
1992-08-21 07:18:16 +00:00
|
|
|
|
but can be one more if START is not equal to END
|
1991-12-21 09:29:41 +00:00
|
|
|
|
and the greater of them is not at the start of a line."
|
1994-10-16 08:20:07 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region start end)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (eq selective-display t)
|
|
|
|
|
(save-match-data
|
1993-03-29 19:09:05 +00:00
|
|
|
|
(let ((done 0))
|
2011-09-09 23:02:06 -04:00
|
|
|
|
(while (re-search-forward "[\n\C-m]" nil t 40)
|
|
|
|
|
(setq done (+ 40 done)))
|
|
|
|
|
(while (re-search-forward "[\n\C-m]" nil t 1)
|
|
|
|
|
(setq done (+ 1 done)))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(if (and (/= start end)
|
1993-11-24 04:35:28 +00:00
|
|
|
|
(not (bolp)))
|
|
|
|
|
(1+ done)
|
1994-10-16 08:20:07 +00:00
|
|
|
|
done)))
|
|
|
|
|
(- (buffer-size) (forward-line (buffer-size)))))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2017-04-09 12:46:57 +02:00
|
|
|
|
(defun line-number-at-pos (&optional pos absolute)
|
|
|
|
|
"Return buffer line number at position POS.
|
2006-08-20 12:16:58 +00:00
|
|
|
|
If POS is nil, use current buffer location.
|
2017-04-09 12:46:57 +02:00
|
|
|
|
|
|
|
|
|
If ABSOLUTE is nil, the default, counting starts
|
|
|
|
|
at (point-min), so the value refers to the contents of the
|
|
|
|
|
accessible portion of the (potentially narrowed) buffer. If
|
|
|
|
|
ABSOLUTE is non-nil, ignore any narrowing and return the
|
|
|
|
|
absolute line number."
|
|
|
|
|
(save-restriction
|
|
|
|
|
(when absolute
|
|
|
|
|
(widen))
|
|
|
|
|
(let ((opoint (or pos (point))) start)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(setq start (point))
|
|
|
|
|
(goto-char opoint)
|
|
|
|
|
(forward-line 0)
|
|
|
|
|
(1+ (count-lines start (point)))))))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
1997-02-20 05:35:12 +00:00
|
|
|
|
(defun what-cursor-position (&optional detail)
|
|
|
|
|
"Print info on cursor position (on screen and within buffer).
|
1998-12-30 20:41:24 +00:00
|
|
|
|
Also describe the character after point, and give its character code
|
1999-02-25 13:25:07 +00:00
|
|
|
|
in octal, decimal and hex.
|
|
|
|
|
|
|
|
|
|
For a non-ASCII multibyte character, also give its encoding in the
|
|
|
|
|
buffer's selected coding system if the coding system encodes the
|
|
|
|
|
character safely. If the character is encoded into one byte, that
|
|
|
|
|
code is shown in hex. If the character is encoded into more than one
|
|
|
|
|
byte, just \"...\" is shown.
|
1998-08-02 01:06:57 +00:00
|
|
|
|
|
2000-05-13 00:28:57 +00:00
|
|
|
|
In addition, with prefix argument, show details about that character
|
2002-06-17 16:15:09 +00:00
|
|
|
|
in *Help* buffer. See also the command `describe-char'."
|
1997-02-20 05:35:12 +00:00
|
|
|
|
(interactive "P")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(let* ((char (following-char))
|
2011-12-05 19:46:27 +02:00
|
|
|
|
(bidi-fixer
|
2014-10-04 15:09:46 +03:00
|
|
|
|
;; If the character is one of LRE, LRO, RLE, RLO, it will
|
|
|
|
|
;; start a directional embedding, which could completely
|
|
|
|
|
;; disrupt the rest of the line (e.g., RLO will display the
|
|
|
|
|
;; rest of the line right-to-left). So we put an invisible
|
|
|
|
|
;; PDF character after these characters, to end the
|
|
|
|
|
;; embedding, which eliminates any effects on the rest of
|
|
|
|
|
;; the line. For RLE and RLO we also append an invisible
|
|
|
|
|
;; LRM, to avoid reordering the following numerical
|
2014-10-13 15:29:26 +03:00
|
|
|
|
;; characters. For LRI/RLI/FSI we append a PDI.
|
2014-10-04 15:09:46 +03:00
|
|
|
|
(cond ((memq char '(?\x202a ?\x202d))
|
2011-12-05 19:46:27 +02:00
|
|
|
|
(propertize (string ?\x202c) 'invisible t))
|
2014-10-04 15:09:46 +03:00
|
|
|
|
((memq char '(?\x202b ?\x202e))
|
|
|
|
|
(propertize (string ?\x202c ?\x200e) 'invisible t))
|
2014-10-13 15:27:19 +03:00
|
|
|
|
((memq char '(?\x2066 ?\x2067 ?\x2068))
|
|
|
|
|
(propertize (string ?\x2069) 'invisible t))
|
2011-12-05 19:46:27 +02:00
|
|
|
|
;; Strong right-to-left characters cause reordering of
|
|
|
|
|
;; the following numerical characters which show the
|
|
|
|
|
;; codepoint, so append LRM to countermand that.
|
|
|
|
|
((memq (get-char-code-property char 'bidi-class) '(R AL))
|
|
|
|
|
(propertize (string ?\x200e) 'invisible t))
|
|
|
|
|
(t
|
|
|
|
|
"")))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(beg (point-min))
|
|
|
|
|
(end (point-max))
|
|
|
|
|
(pos (point))
|
|
|
|
|
(total (buffer-size))
|
2015-07-31 10:12:37 -07:00
|
|
|
|
(percent (round (* 100.0 (1- pos)) (max 1 total)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(hscroll (if (= (window-hscroll) 0)
|
|
|
|
|
""
|
|
|
|
|
(format " Hscroll=%d" (window-hscroll))))
|
|
|
|
|
(col (current-column)))
|
|
|
|
|
(if (= pos end)
|
|
|
|
|
(if (or (/= beg 1) (/= end (1+ total)))
|
2005-11-20 07:43:01 +00:00
|
|
|
|
(message "point=%d of %d (%d%%) <%d-%d> column=%d%s"
|
1991-12-21 09:29:41 +00:00
|
|
|
|
pos total percent beg end col hscroll)
|
2005-11-20 07:43:01 +00:00
|
|
|
|
(message "point=%d of %d (EOB) column=%d%s"
|
2005-11-12 00:10:56 +00:00
|
|
|
|
pos total col hscroll))
|
1999-02-25 13:25:07 +00:00
|
|
|
|
(let ((coding buffer-file-coding-system)
|
2005-10-06 06:57:41 +00:00
|
|
|
|
encoded encoding-msg display-prop under-display)
|
1999-02-25 13:25:07 +00:00
|
|
|
|
(if (or (not coding)
|
|
|
|
|
(eq (coding-system-type coding) t))
|
2009-08-28 04:21:14 +00:00
|
|
|
|
(setq coding (default-value 'buffer-file-coding-system)))
|
2018-07-28 20:34:57 +03:00
|
|
|
|
(if (eq (char-charset char) 'eight-bit)
|
1999-03-22 04:12:42 +00:00
|
|
|
|
(setq encoding-msg
|
2006-01-16 08:37:27 +00:00
|
|
|
|
(format "(%d, #o%o, #x%x, raw-byte)" char char char))
|
2005-10-06 06:57:41 +00:00
|
|
|
|
;; Check if the character is displayed with some `display'
|
|
|
|
|
;; text property. In that case, set under-display to the
|
|
|
|
|
;; buffer substring covered by that property.
|
2011-09-22 19:49:57 +03:00
|
|
|
|
(setq display-prop (get-char-property pos 'display))
|
2005-10-06 06:57:41 +00:00
|
|
|
|
(if display-prop
|
2011-09-22 19:49:57 +03:00
|
|
|
|
(let ((to (or (next-single-char-property-change pos 'display)
|
2005-10-06 06:57:41 +00:00
|
|
|
|
(point-max))))
|
|
|
|
|
(if (< to (+ pos 4))
|
|
|
|
|
(setq under-display "")
|
|
|
|
|
(setq under-display "..."
|
|
|
|
|
to (+ pos 4)))
|
|
|
|
|
(setq under-display
|
|
|
|
|
(concat (buffer-substring-no-properties pos to)
|
|
|
|
|
under-display)))
|
|
|
|
|
(setq encoded (and (>= char 128) (encode-coding-char char coding))))
|
1999-03-22 04:12:42 +00:00
|
|
|
|
(setq encoding-msg
|
2005-10-06 06:57:41 +00:00
|
|
|
|
(if display-prop
|
|
|
|
|
(if (not (stringp display-prop))
|
2005-11-20 07:43:01 +00:00
|
|
|
|
(format "(%d, #o%o, #x%x, part of display \"%s\")"
|
2005-10-06 06:57:41 +00:00
|
|
|
|
char char char under-display)
|
2005-11-20 07:43:01 +00:00
|
|
|
|
(format "(%d, #o%o, #x%x, part of display \"%s\"->\"%s\")"
|
2005-10-06 06:57:41 +00:00
|
|
|
|
char char char under-display display-prop))
|
|
|
|
|
(if encoded
|
2005-11-20 07:43:01 +00:00
|
|
|
|
(format "(%d, #o%o, #x%x, file %s)"
|
2005-10-06 06:57:41 +00:00
|
|
|
|
char char char
|
|
|
|
|
(if (> (length encoded) 1)
|
|
|
|
|
"..."
|
|
|
|
|
(encoded-string-description encoded coding)))
|
2005-11-20 07:43:01 +00:00
|
|
|
|
(format "(%d, #o%o, #x%x)" char char char)))))
|
1998-12-27 04:09:09 +00:00
|
|
|
|
(if detail
|
2000-05-13 00:28:57 +00:00
|
|
|
|
;; We show the detailed information about CHAR.
|
2002-06-17 16:15:09 +00:00
|
|
|
|
(describe-char (point)))
|
2000-05-13 00:28:57 +00:00
|
|
|
|
(if (or (/= beg 1) (/= end (1+ total)))
|
2011-10-13 13:58:54 +02:00
|
|
|
|
(message "Char: %s%s %s point=%d of %d (%d%%) <%d-%d> column=%d%s"
|
1998-08-02 01:06:57 +00:00
|
|
|
|
(if (< char 256)
|
|
|
|
|
(single-key-description char)
|
1999-12-15 00:39:33 +00:00
|
|
|
|
(buffer-substring-no-properties (point) (1+ (point))))
|
2011-12-05 19:46:27 +02:00
|
|
|
|
bidi-fixer
|
|
|
|
|
encoding-msg pos total percent beg end col hscroll)
|
2011-10-13 13:58:54 +02:00
|
|
|
|
(message "Char: %s%s %s point=%d of %d (%d%%) column=%d%s"
|
2005-10-06 06:57:41 +00:00
|
|
|
|
(if enable-multibyte-characters
|
|
|
|
|
(if (< char 128)
|
|
|
|
|
(single-key-description char)
|
|
|
|
|
(buffer-substring-no-properties (point) (1+ (point))))
|
|
|
|
|
(single-key-description char))
|
2011-12-05 19:46:27 +02:00
|
|
|
|
bidi-fixer encoding-msg pos total percent col hscroll))))))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2006-10-18 10:58:39 +00:00
|
|
|
|
;; Initialize read-expression-map. It is defined at C level.
|
2013-05-04 15:27:41 -04:00
|
|
|
|
(defvar read-expression-map
|
|
|
|
|
(let ((m (make-sparse-keymap)))
|
|
|
|
|
(define-key m "\M-\t" 'completion-at-point)
|
|
|
|
|
;; Might as well bind TAB to completion, since inserting a TAB char is
|
|
|
|
|
;; much too rarely useful.
|
|
|
|
|
(define-key m "\t" 'completion-at-point)
|
|
|
|
|
(set-keymap-parent m minibuffer-local-map)
|
|
|
|
|
m))
|
|
|
|
|
|
|
|
|
|
(defun read-minibuffer (prompt &optional initial-contents)
|
|
|
|
|
"Return a Lisp object read using the minibuffer, unevaluated.
|
|
|
|
|
Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
|
|
|
|
|
is a string to insert in the minibuffer before reading.
|
|
|
|
|
\(INITIAL-CONTENTS can also be a cons of a string and an integer.
|
|
|
|
|
Such arguments are used as in `read-from-minibuffer'.)"
|
|
|
|
|
;; Used for interactive spec `x'.
|
|
|
|
|
(read-from-minibuffer prompt initial-contents minibuffer-local-map
|
2013-09-10 00:21:19 -07:00
|
|
|
|
t 'minibuffer-history))
|
2013-05-04 15:27:41 -04:00
|
|
|
|
|
|
|
|
|
(defun eval-minibuffer (prompt &optional initial-contents)
|
|
|
|
|
"Return value of Lisp expression read using the minibuffer.
|
|
|
|
|
Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
|
|
|
|
|
is a string to insert in the minibuffer before reading.
|
|
|
|
|
\(INITIAL-CONTENTS can also be a cons of a string and an integer.
|
|
|
|
|
Such arguments are used as in `read-from-minibuffer'.)"
|
|
|
|
|
;; Used for interactive spec `X'.
|
2013-05-24 22:21:49 -04:00
|
|
|
|
(eval (read--expression prompt initial-contents)))
|
1992-09-14 06:53:22 +00:00
|
|
|
|
|
2007-03-08 14:43:08 +00:00
|
|
|
|
(defvar minibuffer-completing-symbol nil
|
|
|
|
|
"Non-nil means completing a Lisp symbol in the minibuffer.")
|
2011-06-01 16:32:04 -03:00
|
|
|
|
(make-obsolete-variable 'minibuffer-completing-symbol nil "24.1" 'get)
|
2007-03-08 14:43:08 +00:00
|
|
|
|
|
2009-01-01 03:36:43 +00:00
|
|
|
|
(defvar minibuffer-default nil
|
|
|
|
|
"The current default value or list of default values in the minibuffer.
|
|
|
|
|
The functions `read-from-minibuffer' and `completing-read' bind
|
|
|
|
|
this variable locally.")
|
|
|
|
|
|
1999-09-14 07:00:04 +00:00
|
|
|
|
(defcustom eval-expression-print-level 4
|
2005-06-04 22:04:29 +00:00
|
|
|
|
"Value for `print-level' while printing value in `eval-expression'.
|
2001-12-18 23:39:21 +00:00
|
|
|
|
A value of nil means no limit."
|
1999-09-14 07:00:04 +00:00
|
|
|
|
:group 'lisp
|
2001-12-18 15:53:57 +00:00
|
|
|
|
:type '(choice (const :tag "No Limit" nil) integer)
|
1999-09-14 07:00:04 +00:00
|
|
|
|
:version "21.1")
|
|
|
|
|
|
|
|
|
|
(defcustom eval-expression-print-length 12
|
2005-06-04 22:04:29 +00:00
|
|
|
|
"Value for `print-length' while printing value in `eval-expression'.
|
2001-12-18 23:39:21 +00:00
|
|
|
|
A value of nil means no limit."
|
1999-09-14 07:00:04 +00:00
|
|
|
|
:group 'lisp
|
2001-12-18 15:53:57 +00:00
|
|
|
|
:type '(choice (const :tag "No Limit" nil) integer)
|
1999-09-14 07:00:04 +00:00
|
|
|
|
:version "21.1")
|
|
|
|
|
|
|
|
|
|
(defcustom eval-expression-debug-on-error t
|
2005-06-04 22:04:29 +00:00
|
|
|
|
"If non-nil set `debug-on-error' to t in `eval-expression'.
|
2000-01-12 13:06:52 +00:00
|
|
|
|
If nil, don't change the value of `debug-on-error'."
|
1999-09-14 07:00:04 +00:00
|
|
|
|
:group 'lisp
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "21.1")
|
|
|
|
|
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(defcustom eval-expression-print-maximum-character 127
|
|
|
|
|
"The largest integer that will be displayed as a character.
|
|
|
|
|
This affects printing by `eval-expression' (via
|
|
|
|
|
`eval-expression-print-format')."
|
|
|
|
|
:group 'lisp
|
|
|
|
|
:type 'integer
|
|
|
|
|
:version "26.1")
|
|
|
|
|
|
2004-05-28 21:00:14 +00:00
|
|
|
|
(defun eval-expression-print-format (value)
|
2018-07-06 12:31:51 +03:00
|
|
|
|
"If VALUE is an integer, return a specially formatted string.
|
2016-04-30 17:39:05 +02:00
|
|
|
|
This string will typically look like \" (#o1, #x1, ?\\C-a)\".
|
2018-07-06 12:31:51 +03:00
|
|
|
|
If VALUE is not an integer, return nil.
|
2017-04-23 22:30:20 -04:00
|
|
|
|
This function is used by commands like `eval-expression' that
|
|
|
|
|
display the result of expression evaluation."
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(when (integerp value)
|
|
|
|
|
(let ((char-string
|
|
|
|
|
(and (characterp value)
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(<= value eval-expression-print-maximum-character)
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(char-displayable-p value)
|
|
|
|
|
(prin1-char value))))
|
|
|
|
|
(if char-string
|
|
|
|
|
(format " (#o%o, #x%x, %s)" value value char-string)
|
|
|
|
|
(format " (#o%o, #x%x)" value value)))))
|
2004-05-28 21:00:14 +00:00
|
|
|
|
|
2013-03-17 23:00:37 +08:00
|
|
|
|
(defvar eval-expression-minibuffer-setup-hook nil
|
|
|
|
|
"Hook run by `eval-expression' when entering the minibuffer.")
|
|
|
|
|
|
2013-05-24 22:21:49 -04:00
|
|
|
|
(defun read--expression (prompt &optional initial-contents)
|
|
|
|
|
(let ((minibuffer-completing-symbol t))
|
|
|
|
|
(minibuffer-with-setup-hook
|
|
|
|
|
(lambda ()
|
Introduce global-eldoc-mode. Move Elisp-specific code to elisp-mode.el.
* lisp/emacs-lisp/eldoc.el (global-eldoc-mode): New minor mode.
(eldoc-schedule-timer): Obey it.
(eldoc-documentation-function): Default to nil.
(eldoc-mode): Don't enable if eldoc-documentation-function is not set.
(eldoc-documentation-function-default, eldoc-get-fnsym-args-string)
(eldoc-highlight-function-argument, eldoc-get-var-docstring)
(eldoc-last-data-store, eldoc-docstring-first-line)
(eldoc-docstring-format-sym-doc, eldoc-fnsym-in-current-sexp)
(eldoc-beginning-of-sexp, eldoc-current-symbol)
(eldoc-function-argstring): Move to elisp-mode.el.
(eldoc-symbol-function): Remove, unused.
* lisp/progmodes/elisp-mode.el: New file. Rename all "eldoc-*" to "elisp--*".
(elisp-completion-at-point): Rename from lisp-completion-at-point.
(elisp--preceding-sexp): Rename from preceding-sexp.
* lisp/loadup.el: Load new file progmodes/elisp-mode.
* lisp/ielm.el (inferior-emacs-lisp-mode): Set eldoc-documentation-function.
* lisp/emacs-lisp/lisp.el (lisp--local-variables-1, lisp--local-variables)
(lisp--local-variables-completion-table, lisp--expect-function-p)
(lisp--form-quoted-p, lisp--company-doc-buffer)
(lisp--company-doc-string, lisp--company-location)
(lisp-completion-at-point): Move to elisp-mode.el.
* lisp/emacs-lisp/lisp-mode.el (lisp--mode-syntax-table): New syntax-table,
extracted from emacs-lisp-mode-syntax-table.
(emacs-lisp-mode-abbrev-table, emacs-lisp-mode-syntax-table): Move to
elisp-mode.el.
(lisp-imenu-generic-expression): Add comments to document what comes
from which Lisp dialect.
(emacs-lisp-mode-map, emacs-lisp-byte-compile)
(emacs-lisp-byte-compile-and-load, emacs-lisp-mode-hook)
(emacs-lisp-mode, emacs-list-byte-code-comment-re)
(emacs-lisp-byte-code-comment)
(emacs-lisp-byte-code-syntax-propertize, emacs-lisp-byte-code-mode)
(lisp-interaction-mode-map, lisp-interaction-mode)
(eval-print-last-sexp, last-sexp-setup-props)
(last-sexp-toggle-display, prin1-char, preceding-sexp)
(eval-last-sexp-1, eval-last-sexp-print-value)
(eval-last-sexp-fake-value, eval-sexp-add-defvars, eval-last-sexp)
(eval-defun-1, eval-defun-2, eval-defun): Move to elisp-mode.el.
* src/lisp.mk (lisp): Add elisp-mode.elc.
2014-09-26 23:57:41 -04:00
|
|
|
|
;; FIXME: call emacs-lisp-mode?
|
2016-07-18 02:17:06 +03:00
|
|
|
|
(add-function :before-until (local 'eldoc-documentation-function)
|
|
|
|
|
#'elisp-eldoc-documentation-function)
|
2017-06-06 01:04:04 +03:00
|
|
|
|
(eldoc-mode 1)
|
2013-05-24 22:21:49 -04:00
|
|
|
|
(add-hook 'completion-at-point-functions
|
Introduce global-eldoc-mode. Move Elisp-specific code to elisp-mode.el.
* lisp/emacs-lisp/eldoc.el (global-eldoc-mode): New minor mode.
(eldoc-schedule-timer): Obey it.
(eldoc-documentation-function): Default to nil.
(eldoc-mode): Don't enable if eldoc-documentation-function is not set.
(eldoc-documentation-function-default, eldoc-get-fnsym-args-string)
(eldoc-highlight-function-argument, eldoc-get-var-docstring)
(eldoc-last-data-store, eldoc-docstring-first-line)
(eldoc-docstring-format-sym-doc, eldoc-fnsym-in-current-sexp)
(eldoc-beginning-of-sexp, eldoc-current-symbol)
(eldoc-function-argstring): Move to elisp-mode.el.
(eldoc-symbol-function): Remove, unused.
* lisp/progmodes/elisp-mode.el: New file. Rename all "eldoc-*" to "elisp--*".
(elisp-completion-at-point): Rename from lisp-completion-at-point.
(elisp--preceding-sexp): Rename from preceding-sexp.
* lisp/loadup.el: Load new file progmodes/elisp-mode.
* lisp/ielm.el (inferior-emacs-lisp-mode): Set eldoc-documentation-function.
* lisp/emacs-lisp/lisp.el (lisp--local-variables-1, lisp--local-variables)
(lisp--local-variables-completion-table, lisp--expect-function-p)
(lisp--form-quoted-p, lisp--company-doc-buffer)
(lisp--company-doc-string, lisp--company-location)
(lisp-completion-at-point): Move to elisp-mode.el.
* lisp/emacs-lisp/lisp-mode.el (lisp--mode-syntax-table): New syntax-table,
extracted from emacs-lisp-mode-syntax-table.
(emacs-lisp-mode-abbrev-table, emacs-lisp-mode-syntax-table): Move to
elisp-mode.el.
(lisp-imenu-generic-expression): Add comments to document what comes
from which Lisp dialect.
(emacs-lisp-mode-map, emacs-lisp-byte-compile)
(emacs-lisp-byte-compile-and-load, emacs-lisp-mode-hook)
(emacs-lisp-mode, emacs-list-byte-code-comment-re)
(emacs-lisp-byte-code-comment)
(emacs-lisp-byte-code-syntax-propertize, emacs-lisp-byte-code-mode)
(lisp-interaction-mode-map, lisp-interaction-mode)
(eval-print-last-sexp, last-sexp-setup-props)
(last-sexp-toggle-display, prin1-char, preceding-sexp)
(eval-last-sexp-1, eval-last-sexp-print-value)
(eval-last-sexp-fake-value, eval-sexp-add-defvars, eval-last-sexp)
(eval-defun-1, eval-defun-2, eval-defun): Move to elisp-mode.el.
* src/lisp.mk (lisp): Add elisp-mode.elc.
2014-09-26 23:57:41 -04:00
|
|
|
|
#'elisp-completion-at-point nil t)
|
2013-05-24 22:21:49 -04:00
|
|
|
|
(run-hooks 'eval-expression-minibuffer-setup-hook))
|
|
|
|
|
(read-from-minibuffer prompt initial-contents
|
|
|
|
|
read-expression-map t
|
|
|
|
|
'read-expression-history))))
|
|
|
|
|
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(defun eval-expression-get-print-arguments (prefix-argument)
|
|
|
|
|
"Get arguments for commands that print an expression result.
|
2017-04-23 22:30:20 -04:00
|
|
|
|
Returns a list (INSERT-VALUE NO-TRUNCATE CHAR-PRINT-LIMIT)
|
2017-04-23 22:21:42 -04:00
|
|
|
|
based on PREFIX-ARG. This function determines the interpretation
|
|
|
|
|
of the prefix argument for `eval-expression' and
|
|
|
|
|
`eval-last-sexp'."
|
|
|
|
|
(let ((num (prefix-numeric-value prefix-argument)))
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(list (not (memq prefix-argument '(- nil)))
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(= num 0)
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(cond ((not (memq prefix-argument '(0 -1 - nil))) nil)
|
|
|
|
|
((= num -1) most-positive-fixnum)
|
|
|
|
|
(t eval-expression-print-maximum-character)))))
|
2017-04-23 22:21:42 -04:00
|
|
|
|
|
1993-07-26 18:32:07 +00:00
|
|
|
|
;; We define this, rather than making `eval' interactive,
|
2006-07-05 07:44:35 +00:00
|
|
|
|
;; for the sake of completion of names like eval-region, eval-buffer.
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(defun eval-expression (exp &optional insert-value no-truncate char-print-limit)
|
2013-02-15 18:47:50 -05:00
|
|
|
|
"Evaluate EXP and print value in the echo area.
|
2017-04-23 22:30:20 -04:00
|
|
|
|
When called interactively, read an Emacs Lisp expression and
|
|
|
|
|
evaluate it. Value is also consed on to front of the variable
|
|
|
|
|
`values'. Optional argument INSERT-VALUE non-nil (interactively,
|
|
|
|
|
with a non `-' prefix argument) means insert the result into the
|
|
|
|
|
current buffer instead of printing it in the echo area.
|
|
|
|
|
|
|
|
|
|
Normally, this function truncates long output according to the
|
|
|
|
|
value of the variables `eval-expression-print-length' and
|
|
|
|
|
`eval-expression-print-level'. When NO-TRUNCATE is
|
|
|
|
|
non-nil (interactively, with a prefix argument of zero), however,
|
|
|
|
|
there is no such truncation.
|
|
|
|
|
|
|
|
|
|
If the resulting value is an integer, and CHAR-PRINT-LIMIT is
|
2018-07-06 12:31:51 +03:00
|
|
|
|
non-nil (interactively, unless given a non-zero prefix argument)
|
2017-04-23 22:30:20 -04:00
|
|
|
|
it will be printed in several additional formats (octal,
|
|
|
|
|
hexadecimal, and character). The character format is only used
|
|
|
|
|
if the value is below CHAR-PRINT-LIMIT (interactively, if the
|
2018-07-06 12:31:51 +03:00
|
|
|
|
prefix argument is -1 or the value doesn't exceed
|
2017-04-23 22:30:20 -04:00
|
|
|
|
`eval-expression-print-maximum-character').
|
2006-04-07 23:30:42 +00:00
|
|
|
|
|
2014-01-29 23:48:06 -08:00
|
|
|
|
Runs the hook `eval-expression-minibuffer-setup-hook' on entering the
|
|
|
|
|
minibuffer.
|
|
|
|
|
|
2006-04-07 23:30:42 +00:00
|
|
|
|
If `eval-expression-debug-on-error' is non-nil, which is the default,
|
|
|
|
|
this command arranges for all errors to enter the debugger."
|
1993-10-25 06:07:23 +00:00
|
|
|
|
(interactive
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(cons (read--expression "Eval: ")
|
|
|
|
|
(eval-expression-get-print-arguments current-prefix-arg)))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2000-01-12 13:06:52 +00:00
|
|
|
|
(if (null eval-expression-debug-on-error)
|
2013-02-15 18:47:50 -05:00
|
|
|
|
(push (eval exp lexical-binding) values)
|
2000-01-12 13:06:52 +00:00
|
|
|
|
(let ((old-value (make-symbol "t")) new-value)
|
|
|
|
|
;; Bind debug-on-error to something unique so that we can
|
2011-12-18 22:21:24 -08:00
|
|
|
|
;; detect when evalled code changes it.
|
2000-01-12 13:06:52 +00:00
|
|
|
|
(let ((debug-on-error old-value))
|
2015-06-09 22:14:47 -04:00
|
|
|
|
(push (eval (macroexpand-all exp) lexical-binding) values)
|
2000-01-12 13:06:52 +00:00
|
|
|
|
(setq new-value debug-on-error))
|
2011-12-18 22:21:24 -08:00
|
|
|
|
;; If evalled code has changed the value of debug-on-error,
|
2000-01-12 13:06:52 +00:00
|
|
|
|
;; propagate that change to the global binding.
|
|
|
|
|
(unless (eq old-value new-value)
|
|
|
|
|
(setq debug-on-error new-value))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(let ((print-length (unless no-truncate eval-expression-print-length))
|
|
|
|
|
(print-level (unless no-truncate eval-expression-print-level))
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(eval-expression-print-maximum-character char-print-limit)
|
2013-02-15 18:47:50 -05:00
|
|
|
|
(deactivate-mark))
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(let ((out (if insert-value (current-buffer) t)))
|
2004-05-28 21:00:14 +00:00
|
|
|
|
(prog1
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(prin1 (car values) out)
|
2017-04-23 22:30:20 -04:00
|
|
|
|
(let ((str (and char-print-limit
|
2017-04-23 22:21:42 -04:00
|
|
|
|
(eval-expression-print-format (car values)))))
|
|
|
|
|
(when str (princ str out)))))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun edit-and-eval-command (prompt command)
|
|
|
|
|
"Prompting with PROMPT, let user edit COMMAND and eval result.
|
|
|
|
|
COMMAND is a Lisp expression. Let user edit that expression in
|
|
|
|
|
the minibuffer, then read and evaluate the result."
|
2002-09-24 18:40:59 +00:00
|
|
|
|
(let ((command
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(let ((print-level nil)
|
|
|
|
|
(minibuffer-history-sexp-flag (1+ (minibuffer-depth))))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(read-from-minibuffer prompt
|
|
|
|
|
(prin1-to-string command)
|
|
|
|
|
read-expression-map t
|
|
|
|
|
'command-history)
|
|
|
|
|
;; If command was added to command-history as a string,
|
|
|
|
|
;; get rid of that. We want only evaluable expressions there.
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(when (stringp (car command-history))
|
|
|
|
|
(pop command-history))))))
|
1994-10-20 20:14:45 +00:00
|
|
|
|
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(add-to-history 'command-history command)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(eval command)))
|
|
|
|
|
|
1992-07-24 03:42:21 +00:00
|
|
|
|
(defun repeat-complex-command (arg)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Edit and re-evaluate last complex command, or ARGth from last.
|
|
|
|
|
A complex command is one which used the minibuffer.
|
|
|
|
|
The command is placed in the minibuffer as a Lisp form for editing.
|
|
|
|
|
The result is executed, repeating the command as changed.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
If the command has been changed or is not the most recent previous
|
|
|
|
|
command it is added to the front of the command history.
|
|
|
|
|
You can use the minibuffer history commands \
|
|
|
|
|
\\<minibuffer-local-map>\\[next-history-element] and \\[previous-history-element]
|
1992-07-24 22:37:33 +00:00
|
|
|
|
to get different commands to edit and resubmit."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "p")
|
1992-07-24 06:09:27 +00:00
|
|
|
|
(let ((elt (nth (1- arg) command-history))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
newcmd)
|
|
|
|
|
(if elt
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(progn
|
1993-10-05 01:19:12 +00:00
|
|
|
|
(setq newcmd
|
1997-01-01 03:37:37 +00:00
|
|
|
|
(let ((print-level nil)
|
|
|
|
|
(minibuffer-history-position arg)
|
1997-10-02 03:04:15 +00:00
|
|
|
|
(minibuffer-history-sexp-flag (1+ (minibuffer-depth))))
|
2002-09-24 18:40:59 +00:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(read-from-minibuffer
|
|
|
|
|
"Redo: " (prin1-to-string elt) read-expression-map t
|
|
|
|
|
(cons 'command-history arg))
|
|
|
|
|
|
|
|
|
|
;; If command was added to command-history as a
|
|
|
|
|
;; string, get rid of that. We want only
|
|
|
|
|
;; evaluable expressions there.
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(when (stringp (car command-history))
|
|
|
|
|
(pop command-history)))))
|
1993-11-23 11:03:16 +00:00
|
|
|
|
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(add-to-history 'command-history newcmd)
|
2014-05-27 20:09:14 -04:00
|
|
|
|
(apply #'funcall-interactively
|
|
|
|
|
(car newcmd)
|
|
|
|
|
(mapcar (lambda (e) (eval e t)) (cdr newcmd))))
|
2002-12-28 21:23:23 +00:00
|
|
|
|
(if command-history
|
|
|
|
|
(error "Argument %d is beyond length of command history" arg)
|
|
|
|
|
(error "There are no previous complex commands to repeat")))))
|
2010-08-23 00:27:59 +01:00
|
|
|
|
|
2013-08-28 17:19:54 -04:00
|
|
|
|
|
2013-02-20 11:37:06 -05:00
|
|
|
|
(defvar extended-command-history nil)
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(defvar execute-extended-command--last-typed nil)
|
2013-02-20 11:37:06 -05:00
|
|
|
|
|
2010-08-23 00:27:59 +01:00
|
|
|
|
(defun read-extended-command ()
|
|
|
|
|
"Read command name to invoke in `execute-extended-command'."
|
|
|
|
|
(minibuffer-with-setup-hook
|
|
|
|
|
(lambda ()
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(add-hook 'post-self-insert-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(setq execute-extended-command--last-typed
|
|
|
|
|
(minibuffer-contents)))
|
|
|
|
|
nil 'local)
|
2010-08-23 00:27:59 +01:00
|
|
|
|
(set (make-local-variable 'minibuffer-default-add-function)
|
|
|
|
|
(lambda ()
|
|
|
|
|
;; Get a command name at point in the original buffer
|
|
|
|
|
;; to propose it after M-n.
|
|
|
|
|
(with-current-buffer (window-buffer (minibuffer-selected-window))
|
|
|
|
|
(and (commandp (function-called-at-point))
|
|
|
|
|
(format "%S" (function-called-at-point)))))))
|
|
|
|
|
;; Read a string, completing from and restricting to the set of
|
|
|
|
|
;; all defined commands. Don't provide any initial input.
|
|
|
|
|
;; Save the command read on the extended-command history list.
|
|
|
|
|
(completing-read
|
|
|
|
|
(concat (cond
|
|
|
|
|
((eq current-prefix-arg '-) "- ")
|
|
|
|
|
((and (consp current-prefix-arg)
|
|
|
|
|
(eq (car current-prefix-arg) 4)) "C-u ")
|
|
|
|
|
((and (consp current-prefix-arg)
|
|
|
|
|
(integerp (car current-prefix-arg)))
|
|
|
|
|
(format "%d " (car current-prefix-arg)))
|
|
|
|
|
((integerp current-prefix-arg)
|
|
|
|
|
(format "%d " current-prefix-arg)))
|
|
|
|
|
;; This isn't strictly correct if `execute-extended-command'
|
|
|
|
|
;; is bound to anything else (e.g. [menu]).
|
|
|
|
|
;; It could use (key-description (this-single-command-keys)),
|
|
|
|
|
;; but actually a prompt other than "M-x" would be confusing,
|
|
|
|
|
;; because "M-x" is a well-known prompt to read a command
|
|
|
|
|
;; and it serves as a shorthand for "Extended command: ".
|
|
|
|
|
"M-x ")
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(lambda (string pred action)
|
|
|
|
|
(let ((pred
|
|
|
|
|
(if (memq action '(nil t))
|
|
|
|
|
;; Exclude obsolete commands from completions.
|
|
|
|
|
(lambda (sym)
|
|
|
|
|
(and (funcall pred sym)
|
|
|
|
|
(or (equal string (symbol-name sym))
|
|
|
|
|
(not (get sym 'byte-obsolete-info)))))
|
|
|
|
|
pred)))
|
|
|
|
|
(complete-with-action action obarray string pred)))
|
|
|
|
|
#'commandp t nil 'extended-command-history)))
|
2010-08-23 00:27:59 +01:00
|
|
|
|
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(defcustom suggest-key-bindings t
|
|
|
|
|
"Non-nil means show the equivalent key-binding when M-x command has one.
|
|
|
|
|
The value can be a length of time to show the message for.
|
|
|
|
|
If the value is non-nil and not a number, we wait 2 seconds."
|
|
|
|
|
:group 'keyboard
|
|
|
|
|
:type '(choice (const :tag "off" nil)
|
|
|
|
|
(integer :tag "time" 2)
|
|
|
|
|
(other :tag "on")))
|
|
|
|
|
|
2016-04-30 17:24:57 +02:00
|
|
|
|
(defcustom extended-command-suggest-shorter t
|
2016-04-30 17:30:59 +02:00
|
|
|
|
"If non-nil, show a shorter M-x invocation when there is one."
|
2016-04-30 17:24:57 +02:00
|
|
|
|
:group 'keyboard
|
2016-04-30 17:30:59 +02:00
|
|
|
|
:type 'boolean
|
2016-11-17 00:39:43 +09:00
|
|
|
|
:version "26.1")
|
2016-04-30 17:24:57 +02:00
|
|
|
|
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(defun execute-extended-command--shorter-1 (name length)
|
|
|
|
|
(cond
|
|
|
|
|
((zerop length) (list ""))
|
|
|
|
|
((equal name "") nil)
|
|
|
|
|
(t
|
|
|
|
|
(nconc (mapcar (lambda (s) (concat (substring name 0 1) s))
|
|
|
|
|
(execute-extended-command--shorter-1
|
|
|
|
|
(substring name 1) (1- length)))
|
|
|
|
|
(when (string-match "\\`\\(-\\)?[^-]*" name)
|
|
|
|
|
(execute-extended-command--shorter-1
|
|
|
|
|
(substring name (match-end 0)) length))))))
|
|
|
|
|
|
|
|
|
|
(defun execute-extended-command--shorter (name typed)
|
|
|
|
|
(let ((candidates '())
|
2014-11-28 18:14:38 -05:00
|
|
|
|
(max (length typed))
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(len 1)
|
|
|
|
|
binding)
|
|
|
|
|
(while (and (not binding)
|
|
|
|
|
(progn
|
|
|
|
|
(unless candidates
|
|
|
|
|
(setq len (1+ len))
|
|
|
|
|
(setq candidates (execute-extended-command--shorter-1
|
|
|
|
|
name len)))
|
2014-11-16 17:24:55 -05:00
|
|
|
|
;; Don't show the help message if the binding isn't
|
|
|
|
|
;; significantly shorter than the M-x command the user typed.
|
|
|
|
|
(< len (- max 5))))
|
2016-12-23 10:53:31 +02:00
|
|
|
|
(input-pending-p) ;Dummy call to trigger input-processing, bug#23002.
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(let ((candidate (pop candidates)))
|
|
|
|
|
(when (equal name
|
|
|
|
|
(car-safe (completion-try-completion
|
|
|
|
|
candidate obarray 'commandp len)))
|
|
|
|
|
(setq binding candidate))))
|
|
|
|
|
binding))
|
|
|
|
|
|
|
|
|
|
(defun execute-extended-command (prefixarg &optional command-name typed)
|
2012-05-01 12:10:02 -04:00
|
|
|
|
;; Based on Fexecute_extended_command in keyboard.c of Emacs.
|
|
|
|
|
;; Aaron S. Hawley <aaron.s.hawley(at)gmail.com> 2009-08-24
|
2014-02-08 05:13:46 -08:00
|
|
|
|
"Read a command name, then read the arguments and call the command.
|
2014-11-03 17:27:26 -05:00
|
|
|
|
To pass a prefix argument to the command you are
|
|
|
|
|
invoking, give a prefix argument to `execute-extended-command'."
|
|
|
|
|
(declare (interactive-only command-execute))
|
|
|
|
|
;; FIXME: Remember the actual text typed by the user before completion,
|
|
|
|
|
;; so that we don't later on suggest the same shortening.
|
|
|
|
|
(interactive
|
|
|
|
|
(let ((execute-extended-command--last-typed nil))
|
|
|
|
|
(list current-prefix-arg
|
|
|
|
|
(read-extended-command)
|
|
|
|
|
execute-extended-command--last-typed)))
|
2012-05-01 12:10:02 -04:00
|
|
|
|
;; Emacs<24 calling-convention was with a single `prefixarg' argument.
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(unless command-name
|
|
|
|
|
(let ((current-prefix-arg prefixarg) ; for prompt
|
|
|
|
|
(execute-extended-command--last-typed nil))
|
|
|
|
|
(setq command-name (read-extended-command))
|
|
|
|
|
(setq typed execute-extended-command--last-typed)))
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(let* ((function (and (stringp command-name) (intern-soft command-name)))
|
|
|
|
|
(binding (and suggest-key-bindings
|
2012-06-02 15:21:34 -04:00
|
|
|
|
(not executing-kbd-macro)
|
|
|
|
|
(where-is-internal function overriding-local-map t))))
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(unless (commandp function)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(error "`%s' is not a valid command name" command-name))
|
2017-02-10 10:57:41 +02:00
|
|
|
|
;; Some features, such as novice.el, rely on this-command-keys
|
|
|
|
|
;; including M-x COMMAND-NAME RET.
|
|
|
|
|
(set--this-command-keys (concat "\M-x" (symbol-name function) "\r"))
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(setq this-command function)
|
2012-06-02 15:21:34 -04:00
|
|
|
|
;; Normally `real-this-command' should never be changed, but here we really
|
|
|
|
|
;; want to pretend that M-x <cmd> RET is nothing more than a "key
|
|
|
|
|
;; binding" for <cmd>, so the command the user really wanted to run is
|
|
|
|
|
;; `function' and not `execute-extended-command'. The difference is
|
|
|
|
|
;; visible in cases such as M-x <cmd> RET and then C-x z (bug#11506).
|
|
|
|
|
(setq real-this-command function)
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(let ((prefix-arg prefixarg))
|
|
|
|
|
(command-execute function 'record))
|
|
|
|
|
;; If enabled, show which key runs this command.
|
2014-11-03 17:27:26 -05:00
|
|
|
|
;; But first wait, and skip the message if there is input.
|
|
|
|
|
(let* ((waited
|
|
|
|
|
;; If this command displayed something in the echo area;
|
|
|
|
|
;; wait a few seconds, then display our suggestion message.
|
|
|
|
|
;; FIXME: Wait *after* running post-command-hook!
|
|
|
|
|
;; FIXME: Don't wait if execute-extended-command--shorter won't
|
|
|
|
|
;; find a better answer anyway!
|
2014-12-28 01:24:17 +02:00
|
|
|
|
(when suggest-key-bindings
|
|
|
|
|
(sit-for (cond
|
|
|
|
|
((zerop (length (current-message))) 0)
|
|
|
|
|
((numberp suggest-key-bindings) suggest-key-bindings)
|
|
|
|
|
(t 2))))))
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(when (and waited (not (consp unread-command-events)))
|
2016-04-30 17:24:57 +02:00
|
|
|
|
(unless (or (not extended-command-suggest-shorter)
|
|
|
|
|
binding executing-kbd-macro (not (symbolp function))
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(<= (length (symbol-name function)) 2))
|
|
|
|
|
;; There's no binding for CMD. Let's try and find the shortest
|
|
|
|
|
;; string to use in M-x.
|
|
|
|
|
;; FIXME: Can be slow. Cache it maybe?
|
|
|
|
|
(while-no-input
|
|
|
|
|
(setq binding (execute-extended-command--shorter
|
|
|
|
|
(symbol-name function) typed))))
|
2014-11-16 17:24:55 -05:00
|
|
|
|
(when binding
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(with-temp-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(format-message "You can run the command `%s' with %s"
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
function
|
|
|
|
|
(if (stringp binding)
|
|
|
|
|
(concat "M-x " binding " RET")
|
|
|
|
|
(key-description binding)))
|
2012-05-01 12:10:02 -04:00
|
|
|
|
(sit-for (if (numberp suggest-key-bindings)
|
|
|
|
|
suggest-key-bindings
|
|
|
|
|
2))))))))
|
2013-02-20 11:37:06 -05:00
|
|
|
|
|
|
|
|
|
(defun command-execute (cmd &optional record-flag keys special)
|
|
|
|
|
;; BEWARE: Called directly from the C code.
|
|
|
|
|
"Execute CMD as an editor command.
|
|
|
|
|
CMD must be a symbol that satisfies the `commandp' predicate.
|
|
|
|
|
Optional second arg RECORD-FLAG non-nil
|
|
|
|
|
means unconditionally put this command in the variable `command-history'.
|
|
|
|
|
Otherwise, that is done only if an arg is read using the minibuffer.
|
|
|
|
|
The argument KEYS specifies the value to use instead of (this-command-keys)
|
|
|
|
|
when reading the arguments; if it is nil, (this-command-keys) is used.
|
|
|
|
|
The argument SPECIAL, if non-nil, means that this command is executing
|
|
|
|
|
a special event, so ignore the prefix argument and don't clear it."
|
|
|
|
|
(setq debug-on-next-call nil)
|
|
|
|
|
(let ((prefixarg (unless special
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
;; FIXME: This should probably be done around
|
|
|
|
|
;; pre-command-hook rather than here!
|
2013-02-20 11:37:06 -05:00
|
|
|
|
(prog1 prefix-arg
|
|
|
|
|
(setq current-prefix-arg prefix-arg)
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(setq prefix-arg nil)
|
|
|
|
|
(when current-prefix-arg
|
|
|
|
|
(prefix-command-update))))))
|
2014-04-01 23:51:59 -07:00
|
|
|
|
(if (and (symbolp cmd)
|
2014-04-01 23:53:10 -07:00
|
|
|
|
(get cmd 'disabled)
|
|
|
|
|
disabled-command-function)
|
2014-04-01 23:51:59 -07:00
|
|
|
|
;; FIXME: Weird calling convention!
|
|
|
|
|
(run-hooks 'disabled-command-function)
|
|
|
|
|
(let ((final cmd))
|
|
|
|
|
(while
|
|
|
|
|
(progn
|
|
|
|
|
(setq final (indirect-function final))
|
|
|
|
|
(if (autoloadp final)
|
|
|
|
|
(setq final (autoload-do-load final cmd)))))
|
|
|
|
|
(cond
|
|
|
|
|
((arrayp final)
|
|
|
|
|
;; If requested, place the macro in the command history. For
|
|
|
|
|
;; other sorts of commands, call-interactively takes care of this.
|
|
|
|
|
(when record-flag
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(add-to-history
|
|
|
|
|
'command-history `(execute-kbd-macro ,final ,prefixarg) nil t))
|
2014-04-01 23:51:59 -07:00
|
|
|
|
(execute-kbd-macro final prefixarg))
|
|
|
|
|
(t
|
|
|
|
|
;; Pass `cmd' rather than `final', for the backtrace's sake.
|
|
|
|
|
(prog1 (call-interactively cmd record-flag keys)
|
|
|
|
|
(when (and (symbolp cmd)
|
|
|
|
|
(get cmd 'byte-obsolete-info)
|
|
|
|
|
(not (get cmd 'command-execute-obsolete-warned)))
|
|
|
|
|
(put cmd 'command-execute-obsolete-warned t)
|
|
|
|
|
(message "%s" (macroexp--obsolete-warning
|
|
|
|
|
cmd (get cmd 'byte-obsolete-info) "command"))))))))))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(defvar minibuffer-history nil
|
|
|
|
|
"Default minibuffer history list.
|
|
|
|
|
This is used for all minibuffer input
|
2007-12-22 17:12:30 +00:00
|
|
|
|
except when an alternate history list is specified.
|
|
|
|
|
|
|
|
|
|
Maximum length of the history list is determined by the value
|
|
|
|
|
of `history-length', which see.")
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(defvar minibuffer-history-sexp-flag nil
|
2004-04-16 12:51:06 +00:00
|
|
|
|
"Control whether history list elements are expressions or strings.
|
|
|
|
|
If the value of this variable equals current minibuffer depth,
|
|
|
|
|
they are expressions; otherwise they are strings.
|
2005-12-23 21:50:38 +00:00
|
|
|
|
\(That convention is designed to do the right thing for
|
2004-04-16 12:51:06 +00:00
|
|
|
|
recursive uses of the minibuffer.)")
|
1992-07-26 19:54:20 +00:00
|
|
|
|
(setq minibuffer-history-variable 'minibuffer-history)
|
2006-05-06 23:57:11 +00:00
|
|
|
|
(setq minibuffer-history-position nil) ;; Defvar is in C code.
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(defvar minibuffer-history-search-history nil)
|
1992-07-26 19:54:20 +00:00
|
|
|
|
|
1997-05-05 11:54:37 +00:00
|
|
|
|
(defvar minibuffer-text-before-history nil
|
|
|
|
|
"Text that was in this minibuffer before any history commands.
|
|
|
|
|
This is nil if there have not yet been any history commands
|
|
|
|
|
in this use of the minibuffer.")
|
|
|
|
|
|
|
|
|
|
(add-hook 'minibuffer-setup-hook 'minibuffer-history-initialize)
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-initialize ()
|
|
|
|
|
(setq minibuffer-text-before-history nil))
|
|
|
|
|
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun minibuffer-avoid-prompt (_new _old)
|
2000-11-21 15:58:33 +00:00
|
|
|
|
"A point-motion hook for the minibuffer, that moves point out of the prompt."
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 15:51:15 -04:00
|
|
|
|
(declare (obsolete cursor-intangible-mode "25.1"))
|
2000-11-21 15:58:33 +00:00
|
|
|
|
(constrain-to-field nil (point-max)))
|
|
|
|
|
|
1998-05-26 20:55:22 +00:00
|
|
|
|
(defcustom minibuffer-history-case-insensitive-variables nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Minibuffer history variables for which matching should ignore case.
|
1998-05-26 20:55:22 +00:00
|
|
|
|
If a history variable is a member of this list, then the
|
|
|
|
|
\\[previous-matching-history-element] and \\[next-matching-history-element]\
|
|
|
|
|
commands ignore case when searching it, regardless of `case-fold-search'."
|
|
|
|
|
:type '(repeat variable)
|
|
|
|
|
:group 'minibuffer)
|
|
|
|
|
|
1992-07-26 19:54:20 +00:00
|
|
|
|
(defun previous-matching-history-element (regexp n)
|
1992-09-14 06:53:22 +00:00
|
|
|
|
"Find the previous history element that matches REGEXP.
|
|
|
|
|
\(Previous history elements refer to earlier actions.)
|
|
|
|
|
With prefix argument N, search for Nth previous match.
|
1997-12-22 21:33:35 +00:00
|
|
|
|
If N is negative, find the next or Nth next match.
|
2001-02-06 19:39:07 +00:00
|
|
|
|
Normally, history elements are matched case-insensitively if
|
|
|
|
|
`case-fold-search' is non-nil, but an uppercase letter in REGEXP
|
|
|
|
|
makes the search case-sensitive.
|
1998-05-26 20:55:22 +00:00
|
|
|
|
See also `minibuffer-history-case-insensitive-variables'."
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(interactive
|
1993-05-06 18:54:32 +00:00
|
|
|
|
(let* ((enable-recursive-minibuffers t)
|
|
|
|
|
(regexp (read-from-minibuffer "Previous element matching (regexp): "
|
|
|
|
|
nil
|
|
|
|
|
minibuffer-local-map
|
|
|
|
|
nil
|
2004-06-13 22:00:17 +00:00
|
|
|
|
'minibuffer-history-search-history
|
|
|
|
|
(car minibuffer-history-search-history))))
|
1993-05-06 18:54:32 +00:00
|
|
|
|
;; Use the last regexp specified, by default, if input is empty.
|
|
|
|
|
(list (if (string= regexp "")
|
1995-05-27 00:40:31 +00:00
|
|
|
|
(if minibuffer-history-search-history
|
|
|
|
|
(car minibuffer-history-search-history)
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error "No previous history search regexp"))
|
1993-05-06 18:54:32 +00:00
|
|
|
|
regexp)
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(prefix-numeric-value current-prefix-arg))))
|
2000-10-26 04:35:48 +00:00
|
|
|
|
(unless (zerop n)
|
|
|
|
|
(if (and (zerop minibuffer-history-position)
|
|
|
|
|
(null minibuffer-text-before-history))
|
2001-10-05 12:28:31 +00:00
|
|
|
|
(setq minibuffer-text-before-history
|
2001-10-05 15:16:24 +00:00
|
|
|
|
(minibuffer-contents-no-properties)))
|
2000-10-26 04:35:48 +00:00
|
|
|
|
(let ((history (symbol-value minibuffer-history-variable))
|
|
|
|
|
(case-fold-search
|
|
|
|
|
(if (isearch-no-upper-case-p regexp t) ; assume isearch.el is dumped
|
|
|
|
|
;; On some systems, ignore case for file names.
|
|
|
|
|
(if (memq minibuffer-history-variable
|
|
|
|
|
minibuffer-history-case-insensitive-variables)
|
|
|
|
|
t
|
|
|
|
|
;; Respect the user's setting for case-fold-search:
|
|
|
|
|
case-fold-search)
|
|
|
|
|
nil))
|
|
|
|
|
prevpos
|
|
|
|
|
match-string
|
|
|
|
|
match-offset
|
|
|
|
|
(pos minibuffer-history-position))
|
|
|
|
|
(while (/= n 0)
|
|
|
|
|
(setq prevpos pos)
|
|
|
|
|
(setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history)))
|
|
|
|
|
(when (= pos prevpos)
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error (if (= pos 1)
|
|
|
|
|
"No later matching history item"
|
|
|
|
|
"No earlier matching history item")))
|
2000-10-26 04:35:48 +00:00
|
|
|
|
(setq match-string
|
|
|
|
|
(if (eq minibuffer-history-sexp-flag (minibuffer-depth))
|
1994-09-14 09:01:02 +00:00
|
|
|
|
(let ((print-level nil))
|
2000-10-26 04:35:48 +00:00
|
|
|
|
(prin1-to-string (nth (1- pos) history)))
|
|
|
|
|
(nth (1- pos) history)))
|
|
|
|
|
(setq match-offset
|
|
|
|
|
(if (< n 0)
|
|
|
|
|
(and (string-match regexp match-string)
|
|
|
|
|
(match-end 0))
|
|
|
|
|
(and (string-match (concat ".*\\(" regexp "\\)") match-string)
|
|
|
|
|
(match-beginning 1))))
|
|
|
|
|
(when match-offset
|
|
|
|
|
(setq n (+ n (if (< n 0) 1 -1)))))
|
|
|
|
|
(setq minibuffer-history-position pos)
|
|
|
|
|
(goto-char (point-max))
|
2001-10-05 12:28:31 +00:00
|
|
|
|
(delete-minibuffer-contents)
|
2000-10-26 04:35:48 +00:00
|
|
|
|
(insert match-string)
|
2001-10-05 15:16:24 +00:00
|
|
|
|
(goto-char (+ (minibuffer-prompt-end) match-offset))))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(if (memq (car (car command-history)) '(previous-matching-history-element
|
|
|
|
|
next-matching-history-element))
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(setq command-history (cdr command-history))))
|
1992-07-26 19:54:20 +00:00
|
|
|
|
|
|
|
|
|
(defun next-matching-history-element (regexp n)
|
1992-09-14 06:53:22 +00:00
|
|
|
|
"Find the next history element that matches REGEXP.
|
|
|
|
|
\(The next history element refers to a more recent action.)
|
|
|
|
|
With prefix argument N, search for Nth next match.
|
1997-12-22 21:33:35 +00:00
|
|
|
|
If N is negative, find the previous or Nth previous match.
|
2001-02-06 19:39:07 +00:00
|
|
|
|
Normally, history elements are matched case-insensitively if
|
|
|
|
|
`case-fold-search' is non-nil, but an uppercase letter in REGEXP
|
|
|
|
|
makes the search case-sensitive."
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(interactive
|
1993-05-06 18:54:32 +00:00
|
|
|
|
(let* ((enable-recursive-minibuffers t)
|
|
|
|
|
(regexp (read-from-minibuffer "Next element matching (regexp): "
|
|
|
|
|
nil
|
|
|
|
|
minibuffer-local-map
|
|
|
|
|
nil
|
2004-12-27 16:34:43 +00:00
|
|
|
|
'minibuffer-history-search-history
|
|
|
|
|
(car minibuffer-history-search-history))))
|
1993-05-06 18:54:32 +00:00
|
|
|
|
;; Use the last regexp specified, by default, if input is empty.
|
|
|
|
|
(list (if (string= regexp "")
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(if minibuffer-history-search-history
|
|
|
|
|
(car minibuffer-history-search-history)
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error "No previous history search regexp"))
|
1993-05-06 18:54:32 +00:00
|
|
|
|
regexp)
|
1992-09-14 06:53:22 +00:00
|
|
|
|
(prefix-numeric-value current-prefix-arg))))
|
1992-07-26 19:54:20 +00:00
|
|
|
|
(previous-matching-history-element regexp (- n)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2000-10-03 17:32:34 +00:00
|
|
|
|
(defvar minibuffer-temporary-goal-position nil)
|
|
|
|
|
|
2008-03-29 22:56:17 +00:00
|
|
|
|
(defvar minibuffer-default-add-function 'minibuffer-default-add-completions
|
2008-11-17 00:45:25 +00:00
|
|
|
|
"Function run by `goto-history-element' before consuming default values.
|
|
|
|
|
This is useful to dynamically add more elements to the list of default values
|
2008-03-29 22:56:17 +00:00
|
|
|
|
when `goto-history-element' reaches the end of this list.
|
|
|
|
|
Before calling this function `goto-history-element' sets the variable
|
|
|
|
|
`minibuffer-default-add-done' to t, so it will call this function only
|
|
|
|
|
once. In special cases, when this function needs to be called more
|
|
|
|
|
than once, it can set `minibuffer-default-add-done' to nil explicitly,
|
|
|
|
|
overriding the setting of this variable to t in `goto-history-element'.")
|
|
|
|
|
|
|
|
|
|
(defvar minibuffer-default-add-done nil
|
|
|
|
|
"When nil, add more elements to the end of the list of default values.
|
|
|
|
|
The value nil causes `goto-history-element' to add more elements to
|
|
|
|
|
the list of defaults when it reaches the end of this list. It does
|
|
|
|
|
this by calling a function defined by `minibuffer-default-add-function'.")
|
|
|
|
|
|
|
|
|
|
(make-variable-buffer-local 'minibuffer-default-add-done)
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-default-add-completions ()
|
|
|
|
|
"Return a list of all completions without the default value.
|
|
|
|
|
This function is used to add all elements of the completion table to
|
|
|
|
|
the end of the list of defaults just after the default value."
|
|
|
|
|
(let ((def minibuffer-default)
|
|
|
|
|
(all (all-completions ""
|
|
|
|
|
minibuffer-completion-table
|
2009-11-13 14:50:17 +00:00
|
|
|
|
minibuffer-completion-predicate)))
|
2008-03-29 22:56:17 +00:00
|
|
|
|
(if (listp def)
|
|
|
|
|
(append def all)
|
|
|
|
|
(cons def (delete def all)))))
|
|
|
|
|
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(defun goto-history-element (nabs)
|
|
|
|
|
"Puts element of the minibuffer history in the minibuffer.
|
|
|
|
|
The argument NABS specifies the absolute history position."
|
|
|
|
|
(interactive "p")
|
2008-03-29 22:56:17 +00:00
|
|
|
|
(when (and (not minibuffer-default-add-done)
|
|
|
|
|
(functionp minibuffer-default-add-function)
|
|
|
|
|
(< nabs (- (if (listp minibuffer-default)
|
|
|
|
|
(length minibuffer-default)
|
|
|
|
|
1))))
|
|
|
|
|
(setq minibuffer-default-add-done t
|
|
|
|
|
minibuffer-default (funcall minibuffer-default-add-function)))
|
2007-10-22 00:17:55 +00:00
|
|
|
|
(let ((minimum (if minibuffer-default
|
|
|
|
|
(- (if (listp minibuffer-default)
|
|
|
|
|
(length minibuffer-default)
|
|
|
|
|
1))
|
|
|
|
|
0))
|
2007-07-23 20:29:55 +00:00
|
|
|
|
elt minibuffer-returned-to-present)
|
|
|
|
|
(if (and (zerop minibuffer-history-position)
|
|
|
|
|
(null minibuffer-text-before-history))
|
|
|
|
|
(setq minibuffer-text-before-history
|
|
|
|
|
(minibuffer-contents-no-properties)))
|
|
|
|
|
(if (< nabs minimum)
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error (if minibuffer-default
|
|
|
|
|
"End of defaults; no next item"
|
|
|
|
|
"End of history; no default available")))
|
2015-03-11 10:54:56 -04:00
|
|
|
|
(if (> nabs (if (listp (symbol-value minibuffer-history-variable))
|
|
|
|
|
(length (symbol-value minibuffer-history-variable))
|
|
|
|
|
0))
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error "Beginning of history; no preceding item"))
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(unless (memq last-command '(next-history-element
|
|
|
|
|
previous-history-element))
|
|
|
|
|
(let ((prompt-end (minibuffer-prompt-end)))
|
|
|
|
|
(set (make-local-variable 'minibuffer-temporary-goal-position)
|
|
|
|
|
(cond ((<= (point) prompt-end) prompt-end)
|
|
|
|
|
((eobp) nil)
|
|
|
|
|
(t (point))))))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(delete-minibuffer-contents)
|
|
|
|
|
(setq minibuffer-history-position nabs)
|
2007-10-22 00:17:55 +00:00
|
|
|
|
(cond ((< nabs 0)
|
|
|
|
|
(setq elt (if (listp minibuffer-default)
|
|
|
|
|
(nth (1- (abs nabs)) minibuffer-default)
|
|
|
|
|
minibuffer-default)))
|
2007-07-23 20:29:55 +00:00
|
|
|
|
((= nabs 0)
|
|
|
|
|
(setq elt (or minibuffer-text-before-history ""))
|
|
|
|
|
(setq minibuffer-returned-to-present t)
|
|
|
|
|
(setq minibuffer-text-before-history nil))
|
|
|
|
|
(t (setq elt (nth (1- minibuffer-history-position)
|
|
|
|
|
(symbol-value minibuffer-history-variable)))))
|
|
|
|
|
(insert
|
|
|
|
|
(if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
|
|
|
|
|
(not minibuffer-returned-to-present))
|
|
|
|
|
(let ((print-level nil))
|
|
|
|
|
(prin1-to-string elt))
|
|
|
|
|
elt))
|
|
|
|
|
(goto-char (or minibuffer-temporary-goal-position (point-max)))))
|
|
|
|
|
|
1992-07-24 03:42:21 +00:00
|
|
|
|
(defun next-history-element (n)
|
2006-05-04 01:00:24 +00:00
|
|
|
|
"Puts next element of the minibuffer history in the minibuffer.
|
|
|
|
|
With argument N, it uses the Nth following element."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "p")
|
1995-02-12 08:27:38 +00:00
|
|
|
|
(or (zerop n)
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(goto-history-element (- minibuffer-history-position n))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1992-07-24 03:42:21 +00:00
|
|
|
|
(defun previous-history-element (n)
|
2006-05-04 01:00:24 +00:00
|
|
|
|
"Puts previous element of the minibuffer history in the minibuffer.
|
|
|
|
|
With argument N, it uses the Nth previous element."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "p")
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(or (zerop n)
|
|
|
|
|
(goto-history-element (+ minibuffer-history-position n))))
|
1993-01-25 00:45:01 +00:00
|
|
|
|
|
2014-11-18 23:33:42 +02:00
|
|
|
|
(defun next-line-or-history-element (&optional arg)
|
|
|
|
|
"Move cursor vertically down ARG lines, or to the next history element.
|
|
|
|
|
When point moves over the bottom line of multi-line minibuffer, puts ARGth
|
|
|
|
|
next element of the minibuffer history in the minibuffer."
|
|
|
|
|
(interactive "^p")
|
|
|
|
|
(or arg (setq arg 1))
|
2015-03-12 22:22:22 +02:00
|
|
|
|
(let* ((old-point (point))
|
2017-12-03 17:59:03 +02:00
|
|
|
|
;; Don't add newlines if they have the mode enabled globally.
|
|
|
|
|
(next-line-add-newlines nil)
|
2015-03-12 22:22:22 +02:00
|
|
|
|
;; Remember the original goal column of possibly multi-line input
|
|
|
|
|
;; excluding the length of the prompt on the first line.
|
|
|
|
|
(prompt-end (minibuffer-prompt-end))
|
|
|
|
|
(old-column (unless (and (eolp) (> (point) prompt-end))
|
|
|
|
|
(if (= (line-number-at-pos) 1)
|
|
|
|
|
(max (- (current-column) (1- prompt-end)) 0)
|
|
|
|
|
(current-column)))))
|
2014-11-18 23:33:42 +02:00
|
|
|
|
(condition-case nil
|
2014-11-19 00:23:47 +02:00
|
|
|
|
(with-no-warnings
|
|
|
|
|
(next-line arg))
|
2014-11-18 23:33:42 +02:00
|
|
|
|
(end-of-buffer
|
|
|
|
|
;; Restore old position since `line-move-visual' moves point to
|
|
|
|
|
;; the end of the line when it fails to go to the next line.
|
|
|
|
|
(goto-char old-point)
|
2015-03-12 22:22:22 +02:00
|
|
|
|
(next-history-element arg)
|
2016-02-10 02:31:40 +02:00
|
|
|
|
;; 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)
|
2015-03-12 22:22:22 +02:00
|
|
|
|
;; Restore the original goal column on the last line
|
|
|
|
|
;; of possibly multi-line input.
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when old-column
|
|
|
|
|
(if (= (line-number-at-pos) 1)
|
|
|
|
|
(move-to-column (+ old-column (1- (minibuffer-prompt-end))))
|
|
|
|
|
(move-to-column old-column)))))))
|
2014-11-18 23:33:42 +02:00
|
|
|
|
|
|
|
|
|
(defun previous-line-or-history-element (&optional arg)
|
|
|
|
|
"Move cursor vertically up ARG lines, or to the previous history element.
|
|
|
|
|
When point moves over the top line of multi-line minibuffer, puts ARGth
|
|
|
|
|
previous element of the minibuffer history in the minibuffer."
|
|
|
|
|
(interactive "^p")
|
|
|
|
|
(or arg (setq arg 1))
|
2015-03-12 22:22:22 +02:00
|
|
|
|
(let* ((old-point (point))
|
|
|
|
|
;; Remember the original goal column of possibly multi-line input
|
|
|
|
|
;; excluding the length of the prompt on the first line.
|
|
|
|
|
(prompt-end (minibuffer-prompt-end))
|
|
|
|
|
(old-column (unless (and (eolp) (> (point) prompt-end))
|
|
|
|
|
(if (= (line-number-at-pos) 1)
|
|
|
|
|
(max (- (current-column) (1- prompt-end)) 0)
|
|
|
|
|
(current-column)))))
|
2014-11-18 23:33:42 +02:00
|
|
|
|
(condition-case nil
|
2014-11-19 00:23:47 +02:00
|
|
|
|
(with-no-warnings
|
|
|
|
|
(previous-line arg))
|
2014-11-18 23:33:42 +02:00
|
|
|
|
(beginning-of-buffer
|
|
|
|
|
;; Restore old position since `line-move-visual' moves point to
|
|
|
|
|
;; the beginning of the line when it fails to go to the previous line.
|
|
|
|
|
(goto-char old-point)
|
2015-03-12 22:22:22 +02:00
|
|
|
|
(previous-history-element arg)
|
2016-02-10 02:31:40 +02:00
|
|
|
|
;; 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)
|
2015-03-12 22:22:22 +02:00
|
|
|
|
;; Restore the original goal column on the first line
|
|
|
|
|
;; of possibly multi-line input.
|
|
|
|
|
(goto-char (minibuffer-prompt-end))
|
|
|
|
|
(if old-column
|
|
|
|
|
(if (= (line-number-at-pos) 1)
|
|
|
|
|
(move-to-column (+ old-column (1- (minibuffer-prompt-end))))
|
|
|
|
|
(move-to-column old-column))
|
2016-02-10 02:31:40 +02:00
|
|
|
|
;; 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)))))))
|
2014-11-18 23:33:42 +02:00
|
|
|
|
|
1993-01-25 00:45:01 +00:00
|
|
|
|
(defun next-complete-history-element (n)
|
1999-10-17 12:50:04 +00:00
|
|
|
|
"Get next history element which completes the minibuffer before the point.
|
|
|
|
|
The contents of the minibuffer after the point are deleted, and replaced
|
|
|
|
|
by the new completion."
|
1993-01-25 00:45:01 +00:00
|
|
|
|
(interactive "p")
|
1993-01-28 20:22:03 +00:00
|
|
|
|
(let ((point-at-start (point)))
|
|
|
|
|
(next-matching-history-element
|
1999-10-17 12:50:04 +00:00
|
|
|
|
(concat
|
2001-10-05 12:28:31 +00:00
|
|
|
|
"^" (regexp-quote (buffer-substring (minibuffer-prompt-end) (point))))
|
1999-10-17 12:50:04 +00:00
|
|
|
|
n)
|
1993-01-28 20:22:03 +00:00
|
|
|
|
;; next-matching-history-element always puts us at (point-min).
|
|
|
|
|
;; Move to the position we were at before changing the buffer contents.
|
2011-12-04 00:02:42 -08:00
|
|
|
|
;; This is still sensible, because the text before point has not changed.
|
1993-01-28 20:22:03 +00:00
|
|
|
|
(goto-char point-at-start)))
|
1993-01-25 00:45:01 +00:00
|
|
|
|
|
|
|
|
|
(defun previous-complete-history-element (n)
|
1993-12-24 02:44:13 +00:00
|
|
|
|
"\
|
1999-10-17 12:50:04 +00:00
|
|
|
|
Get previous history element which completes the minibuffer before the point.
|
|
|
|
|
The contents of the minibuffer after the point are deleted, and replaced
|
|
|
|
|
by the new completion."
|
1993-01-25 00:45:01 +00:00
|
|
|
|
(interactive "p")
|
|
|
|
|
(next-complete-history-element (- n)))
|
1999-10-17 12:50:04 +00:00
|
|
|
|
|
2001-10-05 12:28:31 +00:00
|
|
|
|
;; For compatibility with the old subr of the same name.
|
1999-10-17 12:50:04 +00:00
|
|
|
|
(defun minibuffer-prompt-width ()
|
|
|
|
|
"Return the display width of the minibuffer prompt.
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
Return 0 if current buffer is not a minibuffer."
|
1999-10-17 12:50:04 +00:00
|
|
|
|
;; Return the width of everything before the field at the end of
|
|
|
|
|
;; the buffer; this should be 0 for normal buffers.
|
2001-10-05 12:28:31 +00:00
|
|
|
|
(1- (minibuffer-prompt-end)))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2007-07-23 20:29:55 +00:00
|
|
|
|
;; isearch minibuffer history
|
|
|
|
|
(add-hook 'minibuffer-setup-hook 'minibuffer-history-isearch-setup)
|
|
|
|
|
|
|
|
|
|
(defvar minibuffer-history-isearch-message-overlay)
|
|
|
|
|
(make-variable-buffer-local 'minibuffer-history-isearch-message-overlay)
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-isearch-setup ()
|
|
|
|
|
"Set up a minibuffer for using isearch to search the minibuffer history.
|
|
|
|
|
Intended to be added to `minibuffer-setup-hook'."
|
|
|
|
|
(set (make-local-variable 'isearch-search-fun-function)
|
|
|
|
|
'minibuffer-history-isearch-search)
|
|
|
|
|
(set (make-local-variable 'isearch-message-function)
|
|
|
|
|
'minibuffer-history-isearch-message)
|
|
|
|
|
(set (make-local-variable 'isearch-wrap-function)
|
|
|
|
|
'minibuffer-history-isearch-wrap)
|
|
|
|
|
(set (make-local-variable 'isearch-push-state-function)
|
|
|
|
|
'minibuffer-history-isearch-push-state)
|
|
|
|
|
(add-hook 'isearch-mode-end-hook 'minibuffer-history-isearch-end nil t))
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-isearch-end ()
|
|
|
|
|
"Clean up the minibuffer after terminating isearch in the minibuffer."
|
|
|
|
|
(if minibuffer-history-isearch-message-overlay
|
|
|
|
|
(delete-overlay minibuffer-history-isearch-message-overlay)))
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-isearch-search ()
|
|
|
|
|
"Return the proper search function, for isearch in minibuffer history."
|
2012-05-29 12:09:38 +03:00
|
|
|
|
(lambda (string bound noerror)
|
|
|
|
|
(let ((search-fun
|
|
|
|
|
;; Use standard functions to search within minibuffer text
|
|
|
|
|
(isearch-search-fun-default))
|
|
|
|
|
found)
|
|
|
|
|
;; Avoid lazy-highlighting matches in the minibuffer prompt when
|
|
|
|
|
;; searching forward. Lazy-highlight calls this lambda with the
|
|
|
|
|
;; bound arg, so skip the minibuffer prompt.
|
|
|
|
|
(if (and bound isearch-forward (< (point) (minibuffer-prompt-end)))
|
|
|
|
|
(goto-char (minibuffer-prompt-end)))
|
|
|
|
|
(or
|
|
|
|
|
;; 1. First try searching in the initial minibuffer text
|
|
|
|
|
(funcall search-fun string
|
|
|
|
|
(if isearch-forward bound (minibuffer-prompt-end))
|
|
|
|
|
noerror)
|
|
|
|
|
;; 2. If the above search fails, start putting next/prev history
|
|
|
|
|
;; elements in the minibuffer successively, and search the string
|
|
|
|
|
;; in them. Do this only when bound is nil (i.e. not while
|
|
|
|
|
;; lazy-highlighting search strings in the current minibuffer text).
|
|
|
|
|
(unless bound
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(progn
|
|
|
|
|
(while (not found)
|
|
|
|
|
(cond (isearch-forward
|
|
|
|
|
(next-history-element 1)
|
|
|
|
|
(goto-char (minibuffer-prompt-end)))
|
|
|
|
|
(t
|
|
|
|
|
(previous-history-element 1)
|
|
|
|
|
(goto-char (point-max))))
|
|
|
|
|
(setq isearch-barrier (point) isearch-opoint (point))
|
|
|
|
|
;; After putting the next/prev history element, search
|
|
|
|
|
;; the string in them again, until next-history-element
|
|
|
|
|
;; or previous-history-element raises an error at the
|
|
|
|
|
;; beginning/end of history.
|
|
|
|
|
(setq found (funcall search-fun string
|
|
|
|
|
(unless isearch-forward
|
|
|
|
|
;; For backward search, don't search
|
|
|
|
|
;; in the minibuffer prompt
|
|
|
|
|
(minibuffer-prompt-end))
|
|
|
|
|
noerror)))
|
|
|
|
|
;; Return point of the new search result
|
|
|
|
|
(point))
|
|
|
|
|
;; Return nil when next(prev)-history-element fails
|
|
|
|
|
(error nil)))))))
|
2007-07-23 20:29:55 +00:00
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-isearch-message (&optional c-q-hack ellipsis)
|
|
|
|
|
"Display the minibuffer history search prompt.
|
|
|
|
|
If there are no search errors, this function displays an overlay with
|
|
|
|
|
the isearch prompt which replaces the original minibuffer prompt.
|
|
|
|
|
Otherwise, it displays the standard isearch message returned from
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
the function `isearch-message'."
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(if (not (and (minibufferp) isearch-success (not isearch-error)))
|
|
|
|
|
;; Use standard function `isearch-message' when not in the minibuffer,
|
|
|
|
|
;; or search fails, or has an error (like incomplete regexp).
|
|
|
|
|
;; This function overwrites minibuffer text with isearch message,
|
|
|
|
|
;; so it's possible to see what is wrong in the search string.
|
|
|
|
|
(isearch-message c-q-hack ellipsis)
|
|
|
|
|
;; Otherwise, put the overlay with the standard isearch prompt over
|
|
|
|
|
;; the initial minibuffer prompt.
|
|
|
|
|
(if (overlayp minibuffer-history-isearch-message-overlay)
|
|
|
|
|
(move-overlay minibuffer-history-isearch-message-overlay
|
|
|
|
|
(point-min) (minibuffer-prompt-end))
|
|
|
|
|
(setq minibuffer-history-isearch-message-overlay
|
|
|
|
|
(make-overlay (point-min) (minibuffer-prompt-end)))
|
|
|
|
|
(overlay-put minibuffer-history-isearch-message-overlay 'evaporate t))
|
|
|
|
|
(overlay-put minibuffer-history-isearch-message-overlay
|
|
|
|
|
'display (isearch-message-prefix c-q-hack ellipsis))
|
|
|
|
|
;; And clear any previous isearch message.
|
|
|
|
|
(message "")))
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-isearch-wrap ()
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Wrap the minibuffer history search when search fails.
|
2007-07-23 20:29:55 +00:00
|
|
|
|
Move point to the first history element for a forward search,
|
|
|
|
|
or to the last history element for a backward search."
|
2012-05-29 12:09:38 +03:00
|
|
|
|
;; When `minibuffer-history-isearch-search' fails on reaching the
|
|
|
|
|
;; beginning/end of the history, wrap the search to the first/last
|
|
|
|
|
;; minibuffer history element.
|
|
|
|
|
(if isearch-forward
|
|
|
|
|
(goto-history-element (length (symbol-value minibuffer-history-variable)))
|
|
|
|
|
(goto-history-element 0))
|
|
|
|
|
(setq isearch-success t)
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(goto-char (if isearch-forward (minibuffer-prompt-end) (point-max))))
|
|
|
|
|
|
|
|
|
|
(defun minibuffer-history-isearch-push-state ()
|
|
|
|
|
"Save a function restoring the state of minibuffer history search.
|
|
|
|
|
Save `minibuffer-history-position' to the additional state parameter
|
|
|
|
|
in the search status stack."
|
2013-01-08 15:15:15 -05:00
|
|
|
|
(let ((pos minibuffer-history-position))
|
|
|
|
|
(lambda (cmd)
|
|
|
|
|
(minibuffer-history-isearch-pop-state cmd pos))))
|
2007-07-23 20:29:55 +00:00
|
|
|
|
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun minibuffer-history-isearch-pop-state (_cmd hist-pos)
|
2007-07-23 20:29:55 +00:00
|
|
|
|
"Restore the minibuffer history search state.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
Go to the history element by the absolute history position HIST-POS."
|
2007-07-23 20:29:55 +00:00
|
|
|
|
(goto-history-element hist-pos))
|
|
|
|
|
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;Put this on C-x u, so we can force that rather than C-_ into startup msg
|
2009-09-11 00:58:59 +00:00
|
|
|
|
(define-obsolete-function-alias 'advertised-undo 'undo "23.2")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(defconst undo-equiv-table (make-hash-table :test 'eq :weakness t)
|
2005-04-11 18:09:59 +00:00
|
|
|
|
"Table mapping redo records to the corresponding undo one.
|
|
|
|
|
A redo record for undo-in-region maps to t.
|
|
|
|
|
A redo record for ordinary undo maps to the following (earlier) undo.")
|
2003-05-13 19:45:01 +00:00
|
|
|
|
|
|
|
|
|
(defvar undo-in-region nil
|
|
|
|
|
"Non-nil if `pending-undo-list' is not just a tail of `buffer-undo-list'.")
|
|
|
|
|
|
|
|
|
|
(defvar undo-no-redo nil
|
|
|
|
|
"If t, `undo' doesn't go through redo entries.")
|
|
|
|
|
|
2005-01-29 17:24:41 +00:00
|
|
|
|
(defvar pending-undo-list nil
|
|
|
|
|
"Within a run of consecutive undo commands, list remaining to be undone.
|
2005-06-16 14:31:44 +00:00
|
|
|
|
If t, we undid all the way to the end of it.")
|
2005-01-29 17:24:41 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun undo (&optional arg)
|
|
|
|
|
"Undo some previous changes.
|
|
|
|
|
Repeat this command to undo more changes.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
A numeric ARG serves as a repeat count.
|
1998-03-14 08:19:27 +00:00
|
|
|
|
|
2000-10-26 07:44:46 +00:00
|
|
|
|
In Transient Mark mode when the mark is active, only undo changes within
|
2003-05-13 19:45:01 +00:00
|
|
|
|
the current region. Similarly, when not in Transient Mark mode, just \\[universal-argument]
|
2000-10-26 07:44:46 +00:00
|
|
|
|
as an argument limits undo to changes within the current region."
|
1998-03-14 08:19:27 +00:00
|
|
|
|
(interactive "*P")
|
2001-12-13 07:43:28 +00:00
|
|
|
|
;; Make last-command indicate for the next command that this was an undo.
|
|
|
|
|
;; That way, another undo will undo more.
|
|
|
|
|
;; If we get to the end of the undo history and get an error,
|
|
|
|
|
;; another undo command will find the undo history empty
|
|
|
|
|
;; and will get another error. To begin undoing the undos,
|
|
|
|
|
;; you must type some other command.
|
2012-09-22 11:07:39 +08:00
|
|
|
|
(let* ((modified (buffer-modified-p))
|
|
|
|
|
;; For an indirect buffer, look in the base buffer for the
|
|
|
|
|
;; auto-save data.
|
|
|
|
|
(base-buffer (or (buffer-base-buffer) (current-buffer)))
|
|
|
|
|
(recent-save (with-current-buffer base-buffer
|
|
|
|
|
(recent-auto-save-p)))
|
|
|
|
|
message)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; If we get an error in undo-start,
|
|
|
|
|
;; the next command should not be a "consecutive undo".
|
|
|
|
|
;; So set `this-command' to something other than `undo'.
|
|
|
|
|
(setq this-command 'undo-start)
|
|
|
|
|
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(unless (and (eq last-command 'undo)
|
2005-01-29 17:24:41 +00:00
|
|
|
|
(or (eq pending-undo-list t)
|
|
|
|
|
;; If something (a timer or filter?) changed the buffer
|
|
|
|
|
;; since the previous command, don't continue the undo seq.
|
|
|
|
|
(let ((list buffer-undo-list))
|
|
|
|
|
(while (eq (car list) nil)
|
|
|
|
|
(setq list (cdr list)))
|
|
|
|
|
;; If the last undo record made was made by undo
|
|
|
|
|
;; it shows nothing else happened in between.
|
|
|
|
|
(gethash list undo-equiv-table))))
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(setq undo-in-region
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(or (region-active-p) (and arg (not (numberp arg)))))
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(if undo-in-region
|
2000-10-26 07:44:46 +00:00
|
|
|
|
(undo-start (region-beginning) (region-end))
|
|
|
|
|
(undo-start))
|
|
|
|
|
;; get rid of initial undo boundary
|
|
|
|
|
(undo-more 1))
|
2004-04-16 08:45:40 +00:00
|
|
|
|
;; If we got this far, the next command should be a consecutive undo.
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(setq this-command 'undo)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
;; Check to see whether we're hitting a redo record, and if
|
|
|
|
|
;; so, ask the user whether she wants to skip the redo/undo pair.
|
|
|
|
|
(let ((equiv (gethash pending-undo-list undo-equiv-table)))
|
|
|
|
|
(or (eq (selected-window) (minibuffer-window))
|
2012-09-01 17:56:03 -07:00
|
|
|
|
(setq message (format "%s%s!"
|
|
|
|
|
(if (or undo-no-redo (not equiv))
|
|
|
|
|
"Undo" "Redo")
|
|
|
|
|
(if undo-in-region " in region" ""))))
|
2005-04-13 17:40:53 +00:00
|
|
|
|
(when (and (consp equiv) undo-no-redo)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
;; The equiv entry might point to another redo record if we have done
|
|
|
|
|
;; undo-redo-undo-redo-... so skip to the very last equiv.
|
|
|
|
|
(while (let ((next (gethash equiv undo-equiv-table)))
|
|
|
|
|
(if next (setq equiv next))))
|
|
|
|
|
(setq pending-undo-list equiv)))
|
2000-10-26 07:44:46 +00:00
|
|
|
|
(undo-more
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(if (numberp arg)
|
2000-10-26 07:44:46 +00:00
|
|
|
|
(prefix-numeric-value arg)
|
|
|
|
|
1))
|
2003-05-13 19:45:01 +00:00
|
|
|
|
;; Record the fact that the just-generated undo records come from an
|
2005-04-11 18:09:59 +00:00
|
|
|
|
;; undo operation--that is, they are redo records.
|
|
|
|
|
;; In the ordinary case (not within a region), map the redo
|
|
|
|
|
;; record to the following undos.
|
2003-05-13 19:45:01 +00:00
|
|
|
|
;; I don't know how to do that in the undo-in-region case.
|
2009-03-14 01:51:34 +00:00
|
|
|
|
(let ((list buffer-undo-list))
|
|
|
|
|
;; Strip any leading undo boundaries there might be, like we do
|
|
|
|
|
;; above when checking.
|
|
|
|
|
(while (eq (car list) nil)
|
|
|
|
|
(setq list (cdr list)))
|
2014-04-12 15:20:44 -04:00
|
|
|
|
(puthash list
|
|
|
|
|
;; Prevent identity mapping. This can happen if
|
|
|
|
|
;; consecutive nils are erroneously in undo list.
|
|
|
|
|
(if (or undo-in-region (eq list pending-undo-list))
|
|
|
|
|
t
|
|
|
|
|
pending-undo-list)
|
2009-03-14 01:51:34 +00:00
|
|
|
|
undo-equiv-table))
|
1994-03-16 23:41:32 +00:00
|
|
|
|
;; Don't specify a position in the undo record for the undo command.
|
|
|
|
|
;; Instead, undoing this should move point to where the change is.
|
|
|
|
|
(let ((tail buffer-undo-list)
|
2001-09-06 08:49:34 +00:00
|
|
|
|
(prev nil))
|
|
|
|
|
(while (car tail)
|
|
|
|
|
(when (integerp (car tail))
|
|
|
|
|
(let ((pos (car tail)))
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(if prev
|
|
|
|
|
(setcdr prev (cdr tail))
|
|
|
|
|
(setq buffer-undo-list (cdr tail)))
|
2001-09-06 08:49:34 +00:00
|
|
|
|
(setq tail (cdr tail))
|
|
|
|
|
(while (car tail)
|
|
|
|
|
(if (eq pos (car tail))
|
|
|
|
|
(if prev
|
|
|
|
|
(setcdr prev (cdr tail))
|
|
|
|
|
(setq buffer-undo-list (cdr tail)))
|
|
|
|
|
(setq prev tail))
|
|
|
|
|
(setq tail (cdr tail)))
|
|
|
|
|
(setq tail nil)))
|
|
|
|
|
(setq prev tail tail (cdr tail))))
|
2004-12-27 16:34:43 +00:00
|
|
|
|
;; Record what the current undo list says,
|
|
|
|
|
;; so the next command can tell if the buffer was modified in between.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(and modified (not (buffer-modified-p))
|
2012-09-22 11:07:39 +08:00
|
|
|
|
(with-current-buffer base-buffer
|
|
|
|
|
(delete-auto-save-file-if-necessary recent-save)))
|
2005-10-29 19:48:22 +00:00
|
|
|
|
;; Display a message announcing success.
|
|
|
|
|
(if message
|
2007-12-06 00:17:56 +00:00
|
|
|
|
(message "%s" message))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2004-12-27 16:34:43 +00:00
|
|
|
|
(defun buffer-disable-undo (&optional buffer)
|
|
|
|
|
"Make BUFFER stop keeping undo information.
|
|
|
|
|
No argument or nil as argument means do this for the current buffer."
|
|
|
|
|
(interactive)
|
2004-12-28 05:11:26 +00:00
|
|
|
|
(with-current-buffer (if buffer (get-buffer buffer) (current-buffer))
|
2004-12-31 15:13:00 +00:00
|
|
|
|
(setq buffer-undo-list t)))
|
2004-12-27 16:34:43 +00:00
|
|
|
|
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(defun undo-only (&optional arg)
|
|
|
|
|
"Undo some previous changes.
|
|
|
|
|
Repeat this command to undo more changes.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
A numeric ARG serves as a repeat count.
|
2003-05-13 19:45:01 +00:00
|
|
|
|
Contrary to `undo', this will not redo a previous undo."
|
|
|
|
|
(interactive "*p")
|
|
|
|
|
(let ((undo-no-redo t)) (undo arg)))
|
|
|
|
|
|
1998-07-09 04:49:24 +00:00
|
|
|
|
(defvar undo-in-progress nil
|
|
|
|
|
"Non-nil while performing an undo.
|
|
|
|
|
Some change-hooks test this variable to do something different.")
|
|
|
|
|
|
2005-06-16 14:31:44 +00:00
|
|
|
|
(defun undo-more (n)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Undo back N undo-boundaries beyond what was already undone recently.
|
1992-08-21 07:18:16 +00:00
|
|
|
|
Call `undo-start' to get ready to undo recent changes,
|
|
|
|
|
then call `undo-more' one or more times to undo them."
|
2005-01-29 17:24:41 +00:00
|
|
|
|
(or (listp pending-undo-list)
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error (concat "No further undo information"
|
|
|
|
|
(and undo-in-region " for region"))))
|
1998-07-09 04:49:24 +00:00
|
|
|
|
(let ((undo-in-progress t))
|
2008-10-21 21:14:04 +00:00
|
|
|
|
;; Note: The following, while pulling elements off
|
|
|
|
|
;; `pending-undo-list' will call primitive change functions which
|
|
|
|
|
;; will push more elements onto `buffer-undo-list'.
|
2005-06-16 14:31:44 +00:00
|
|
|
|
(setq pending-undo-list (primitive-undo n pending-undo-list))
|
2005-01-29 17:24:41 +00:00
|
|
|
|
(if (null pending-undo-list)
|
|
|
|
|
(setq pending-undo-list t))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2013-01-08 14:13:31 -05:00
|
|
|
|
(defun primitive-undo (n list)
|
|
|
|
|
"Undo N records from the front of the list LIST.
|
|
|
|
|
Return what remains of the list."
|
|
|
|
|
|
|
|
|
|
;; This is a good feature, but would make undo-start
|
|
|
|
|
;; unable to do what is expected.
|
|
|
|
|
;;(when (null (car (list)))
|
|
|
|
|
;; ;; If the head of the list is a boundary, it is the boundary
|
|
|
|
|
;; ;; preceding this command. Get rid of it and don't count it.
|
|
|
|
|
;; (setq list (cdr list))))
|
|
|
|
|
|
|
|
|
|
(let ((arg n)
|
|
|
|
|
;; In a writable buffer, enable undoing read-only text that is
|
|
|
|
|
;; so because of text properties.
|
|
|
|
|
(inhibit-read-only t)
|
|
|
|
|
;; Don't let `intangible' properties interfere with undo.
|
|
|
|
|
(inhibit-point-motion-hooks t)
|
|
|
|
|
;; We use oldlist only to check for EQ. ++kfs
|
|
|
|
|
(oldlist buffer-undo-list)
|
|
|
|
|
(did-apply nil)
|
|
|
|
|
(next nil))
|
|
|
|
|
(while (> arg 0)
|
2013-01-08 15:15:15 -05:00
|
|
|
|
(while (setq next (pop list)) ;Exit inner loop at undo boundary.
|
2013-01-08 14:13:31 -05:00
|
|
|
|
;; Handle an integer by setting point to that value.
|
2013-01-08 15:15:15 -05:00
|
|
|
|
(pcase next
|
|
|
|
|
((pred integerp) (goto-char next))
|
|
|
|
|
;; Element (t . TIME) records previous modtime.
|
|
|
|
|
;; Preserve any flag of NONEXISTENT_MODTIME_NSECS or
|
|
|
|
|
;; UNKNOWN_MODTIME_NSECS.
|
|
|
|
|
(`(t . ,time)
|
|
|
|
|
;; If this records an obsolete save
|
|
|
|
|
;; (not matching the actual disk file)
|
|
|
|
|
;; then don't mark unmodified.
|
|
|
|
|
(when (or (equal time (visited-file-modtime))
|
|
|
|
|
(and (consp time)
|
|
|
|
|
(equal (list (car time) (cdr time))
|
|
|
|
|
(visited-file-modtime))))
|
|
|
|
|
(when (fboundp 'unlock-buffer)
|
|
|
|
|
(unlock-buffer))
|
|
|
|
|
(set-buffer-modified-p nil)))
|
|
|
|
|
;; Element (nil PROP VAL BEG . END) is property change.
|
|
|
|
|
(`(nil . ,(or `(,prop ,val ,beg . ,end) pcase--dontcare))
|
|
|
|
|
(when (or (> (point-min) beg) (< (point-max) end))
|
|
|
|
|
(error "Changes to be undone are outside visible portion of buffer"))
|
|
|
|
|
(put-text-property beg end prop val))
|
|
|
|
|
;; Element (BEG . END) means range was inserted.
|
|
|
|
|
(`(,(and beg (pred integerp)) . ,(and end (pred integerp)))
|
|
|
|
|
;; (and `(,beg . ,end) `(,(pred integerp) . ,(pred integerp)))
|
|
|
|
|
;; Ideally: `(,(pred integerp beg) . ,(pred integerp end))
|
|
|
|
|
(when (or (> (point-min) beg) (< (point-max) end))
|
|
|
|
|
(error "Changes to be undone are outside visible portion of buffer"))
|
|
|
|
|
;; Set point first thing, so that undoing this undo
|
|
|
|
|
;; does not send point back to where it is now.
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(delete-region beg end))
|
|
|
|
|
;; Element (apply FUN . ARGS) means call FUN to undo.
|
|
|
|
|
(`(apply . ,fun-args)
|
|
|
|
|
(let ((currbuff (current-buffer)))
|
|
|
|
|
(if (integerp (car fun-args))
|
|
|
|
|
;; Long format: (apply DELTA START END FUN . ARGS).
|
|
|
|
|
(pcase-let* ((`(,delta ,start ,end ,fun . ,args) fun-args)
|
|
|
|
|
(start-mark (copy-marker start nil))
|
|
|
|
|
(end-mark (copy-marker end t)))
|
|
|
|
|
(when (or (> (point-min) start) (< (point-max) end))
|
|
|
|
|
(error "Changes to be undone are outside visible portion of buffer"))
|
|
|
|
|
(apply fun args) ;; Use `save-current-buffer'?
|
|
|
|
|
;; Check that the function did what the entry
|
|
|
|
|
;; said it would do.
|
|
|
|
|
(unless (and (= start start-mark)
|
|
|
|
|
(= (+ delta end) end-mark))
|
|
|
|
|
(error "Changes to be undone by function different than announced"))
|
|
|
|
|
(set-marker start-mark nil)
|
|
|
|
|
(set-marker end-mark nil))
|
|
|
|
|
(apply fun-args))
|
|
|
|
|
(unless (eq currbuff (current-buffer))
|
|
|
|
|
(error "Undo function switched buffer"))
|
|
|
|
|
(setq did-apply t)))
|
|
|
|
|
;; Element (STRING . POS) means STRING was deleted.
|
|
|
|
|
(`(,(and string (pred stringp)) . ,(and pos (pred integerp)))
|
2017-11-15 07:03:23 -05:00
|
|
|
|
(let ((valid-marker-adjustments nil)
|
|
|
|
|
(apos (abs pos)))
|
|
|
|
|
(when (or (< apos (point-min)) (> apos (point-max)))
|
|
|
|
|
(error "Changes to be undone are outside visible portion of buffer"))
|
2014-03-24 22:47:39 -04:00
|
|
|
|
;; Check that marker adjustments which were recorded
|
|
|
|
|
;; with the (STRING . POS) record are still valid, ie
|
|
|
|
|
;; the markers haven't moved. We check their validity
|
|
|
|
|
;; before reinserting the string so as we don't need to
|
|
|
|
|
;; mind marker insertion-type.
|
|
|
|
|
(while (and (markerp (car-safe (car list)))
|
|
|
|
|
(integerp (cdr-safe (car list))))
|
|
|
|
|
(let* ((marker-adj (pop list))
|
|
|
|
|
(m (car marker-adj)))
|
|
|
|
|
(and (eq (marker-buffer m) (current-buffer))
|
2017-11-15 07:03:23 -05:00
|
|
|
|
(= apos m)
|
2014-03-24 22:47:39 -04:00
|
|
|
|
(push marker-adj valid-marker-adjustments))))
|
|
|
|
|
;; Insert string and adjust point
|
|
|
|
|
(if (< pos 0)
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (- pos))
|
|
|
|
|
(insert string))
|
|
|
|
|
(goto-char pos)
|
|
|
|
|
(insert string)
|
|
|
|
|
(goto-char pos))
|
|
|
|
|
;; Adjust the valid marker adjustments
|
|
|
|
|
(dolist (adj valid-marker-adjustments)
|
2017-06-17 03:46:12 +03:00
|
|
|
|
;; Insert might have invalidated some of the markers
|
|
|
|
|
;; via modification hooks. Update only the currently
|
|
|
|
|
;; valid ones (bug#25599).
|
|
|
|
|
(if (marker-buffer (car adj))
|
|
|
|
|
(set-marker (car adj)
|
|
|
|
|
(- (car adj) (cdr adj)))))))
|
2013-01-08 15:15:15 -05:00
|
|
|
|
;; (MARKER . OFFSET) means a marker MARKER was adjusted by OFFSET.
|
|
|
|
|
(`(,(and marker (pred markerp)) . ,(and offset (pred integerp)))
|
2014-03-24 22:47:39 -04:00
|
|
|
|
(warn "Encountered %S entry in undo list with no matching (TEXT . POS) entry"
|
|
|
|
|
next)
|
|
|
|
|
;; Even though these elements are not expected in the undo
|
|
|
|
|
;; list, adjust them to be conservative for the 24.4
|
|
|
|
|
;; release. (Bug#16818)
|
2013-01-08 15:15:15 -05:00
|
|
|
|
(when (marker-buffer marker)
|
|
|
|
|
(set-marker marker
|
|
|
|
|
(- marker offset)
|
|
|
|
|
(marker-buffer marker))))
|
|
|
|
|
(_ (error "Unrecognized entry in undo list %S" next))))
|
2013-01-08 14:13:31 -05:00
|
|
|
|
(setq arg (1- arg)))
|
|
|
|
|
;; Make sure an apply entry produces at least one undo entry,
|
|
|
|
|
;; so the test in `undo' for continuing an undo series
|
|
|
|
|
;; will work right.
|
|
|
|
|
(if (and did-apply
|
|
|
|
|
(eq oldlist buffer-undo-list))
|
|
|
|
|
(setq buffer-undo-list
|
|
|
|
|
(cons (list 'apply 'cdr nil) buffer-undo-list))))
|
|
|
|
|
list)
|
|
|
|
|
|
1998-03-14 08:19:27 +00:00
|
|
|
|
;; Deep copy of a list
|
|
|
|
|
(defun undo-copy-list (list)
|
|
|
|
|
"Make a copy of undo list LIST."
|
|
|
|
|
(mapcar 'undo-copy-list-1 list))
|
|
|
|
|
|
|
|
|
|
(defun undo-copy-list-1 (elt)
|
|
|
|
|
(if (consp elt)
|
|
|
|
|
(cons (car elt) (undo-copy-list-1 (cdr elt)))
|
|
|
|
|
elt))
|
|
|
|
|
|
|
|
|
|
(defun undo-start (&optional beg end)
|
|
|
|
|
"Set `pending-undo-list' to the front of the undo list.
|
|
|
|
|
The next call to `undo-more' will undo the most recently made change.
|
|
|
|
|
If BEG and END are specified, then only undo elements
|
|
|
|
|
that apply to text between BEG and END are used; other undo elements
|
|
|
|
|
are ignored. If BEG and END are nil, all undo elements are used."
|
|
|
|
|
(if (eq buffer-undo-list t)
|
Add new error and function `user-error'.
* lisp/subr.el (user-error): New function.
* lisp/window.el (switch-to-buffer):
* lisp/vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
(smerge-match-conflict):
* lisp/simple.el (previous-matching-history-element)
(next-matching-history-element, goto-history-element, undo-more)
(undo-start):
* lisp/progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
(find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
(next-file, tags-loop-scan, list-tags, complete-tag):
* lisp/progmodes/compile.el (compilation-loop):
* lisp/mouse.el (mouse-minibuffer-check):
* lisp/man.el (Man-bgproc-sentinel, Man-goto-page):
* lisp/info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
(Info-history-forward, Info-follow-reference, Info-menu)
(Info-extract-menu-item, Info-extract-menu-counting)
(Info-forward-node, Info-backward-node, Info-next-menu-item)
(Info-last-menu-item, Info-next-preorder, Info-last-preorder)
(Info-next-reference, Info-prev-reference, Info-index)
(Info-index-next, Info-follow-nearest-node)
(Info-copy-current-node-name):
* lisp/imenu.el (imenu--make-index-alist)
(imenu-default-create-index-function, imenu-add-to-menubar):
* lisp/files.el (basic-save-buffer, recover-file):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* lisp/emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
(checkdoc-message-text, checkdoc-defun):
* lisp/dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
* lisp/cus-edit.el (customize-changed-options, customize-rogue)
(customize-saved, custom-variable-set, custom-variable-mark-to-save)
(custom-variable-mark-to-reset-standard)
(custom-variable-reset-backup, custom-face-mark-to-reset-standard)
(custom-file):
* lisp/completion.el (check-completion-length):
* lisp/comint.el (comint-search-arg)
(comint-previous-matching-input-string-position)
(comint-previous-matching-input)
(comint-replace-by-expanded-history-before-point, comint-send-input)
(comint-copy-old-input, comint-backward-matching-input)
(comint-goto-process-mark, comint-set-process-mark):
* lisp/calendar/calendar.el (calendar-cursor-to-date): Use it.
* lisp/bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
* src/data.c (PUT_ERROR): New macro.
(syms_of_data): Use it. Add new error type `user-error'.
* src/undo.c (user_error): New function.
(Fprimitive_undo): Use it.
* src/print.c (print_error_message): Adjust print style for `user-error'.
* src/keyboard.c (user_error): New function.
(Fexit_recursive_edit, Fabort_recursive_edit): Use it.
2012-05-04 19:16:47 -04:00
|
|
|
|
(user-error "No undo information in this buffer"))
|
1999-11-15 16:11:14 +00:00
|
|
|
|
(setq pending-undo-list
|
1998-03-14 08:19:27 +00:00
|
|
|
|
(if (and beg end (not (= beg end)))
|
|
|
|
|
(undo-make-selective-list (min beg end) (max beg end))
|
|
|
|
|
buffer-undo-list)))
|
|
|
|
|
|
2014-05-01 19:25:28 -04:00
|
|
|
|
;; The positions given in elements of the undo list are the positions
|
|
|
|
|
;; as of the time that element was recorded to undo history. In
|
|
|
|
|
;; general, subsequent buffer edits render those positions invalid in
|
|
|
|
|
;; the current buffer, unless adjusted according to the intervening
|
|
|
|
|
;; undo elements.
|
|
|
|
|
;;
|
|
|
|
|
;; Undo in region is a use case that requires adjustments to undo
|
|
|
|
|
;; elements. It must adjust positions of elements in the region based
|
|
|
|
|
;; on newer elements not in the region so as they may be correctly
|
|
|
|
|
;; applied in the current buffer. undo-make-selective-list
|
|
|
|
|
;; accomplishes this with its undo-deltas list of adjustments. An
|
|
|
|
|
;; example undo history from oldest to newest:
|
|
|
|
|
;;
|
|
|
|
|
;; buf pos:
|
|
|
|
|
;; 123456789 buffer-undo-list undo-deltas
|
|
|
|
|
;; --------- ---------------- -----------
|
|
|
|
|
;; aaa (1 . 4) (1 . -3)
|
|
|
|
|
;; aaba (3 . 4) N/A (in region)
|
|
|
|
|
;; ccaaba (1 . 3) (1 . -2)
|
|
|
|
|
;; ccaabaddd (7 . 10) (7 . -3)
|
|
|
|
|
;; ccaabdd ("ad" . 6) (6 . 2)
|
|
|
|
|
;; ccaabaddd (6 . 8) (6 . -2)
|
|
|
|
|
;; | |<-- region: "caab", from 2 to 6
|
|
|
|
|
;;
|
|
|
|
|
;; When the user starts a run of undos in region,
|
|
|
|
|
;; undo-make-selective-list is called to create the full list of in
|
|
|
|
|
;; region elements. Each element is adjusted forward chronologically
|
|
|
|
|
;; through undo-deltas to determine if it is in the region.
|
|
|
|
|
;;
|
|
|
|
|
;; In the above example, the insertion of "b" is (3 . 4) in the
|
|
|
|
|
;; buffer-undo-list. The undo-delta (1 . -2) causes (3 . 4) to become
|
|
|
|
|
;; (5 . 6). The next three undo-deltas cause no adjustment, so (5
|
|
|
|
|
;; . 6) is assessed as in the region and placed in the selective list.
|
|
|
|
|
;; Notably, the end of region itself adjusts from "2 to 6" to "2 to 5"
|
|
|
|
|
;; due to the selected element. The "b" insertion is the only element
|
|
|
|
|
;; fully in the region, so in this example undo-make-selective-list
|
|
|
|
|
;; returns (nil (5 . 6)).
|
|
|
|
|
;;
|
|
|
|
|
;; The adjustment of the (7 . 10) insertion of "ddd" shows an edge
|
|
|
|
|
;; case. It is adjusted through the undo-deltas: ((6 . 2) (6 . -2)).
|
|
|
|
|
;; Normally an undo-delta of (6 . 2) would cause positions after 6 to
|
|
|
|
|
;; adjust by 2. However, they shouldn't adjust to less than 6, so (7
|
|
|
|
|
;; . 10) adjusts to (6 . 8) due to the first undo delta.
|
|
|
|
|
;;
|
|
|
|
|
;; More interesting is how to adjust the "ddd" insertion due to the
|
|
|
|
|
;; next undo-delta: (6 . -2), corresponding to reinsertion of "ad".
|
|
|
|
|
;; If the reinsertion was a manual retyping of "ad", then the total
|
|
|
|
|
;; adjustment should be (7 . 10) -> (6 . 8) -> (8 . 10). However, if
|
|
|
|
|
;; the reinsertion was due to undo, one might expect the first "d"
|
|
|
|
|
;; character would again be a part of the "ddd" text, meaning its
|
|
|
|
|
;; total adjustment would be (7 . 10) -> (6 . 8) -> (7 . 10).
|
|
|
|
|
;;
|
|
|
|
|
;; undo-make-selective-list assumes in this situation that "ad" was a
|
|
|
|
|
;; new edit, even if it was inserted because of an undo.
|
|
|
|
|
;; Consequently, if the user undos in region "8 to 10" of the
|
|
|
|
|
;; "ccaabaddd" buffer, they could be surprised that it becomes
|
|
|
|
|
;; "ccaabad", as though the first "d" became detached from the
|
|
|
|
|
;; original "ddd" insertion. This quirk is a FIXME.
|
|
|
|
|
|
1998-03-14 08:19:27 +00:00
|
|
|
|
(defun undo-make-selective-list (start end)
|
|
|
|
|
"Return a list of undo elements for the region START to END.
|
2014-05-01 19:25:28 -04:00
|
|
|
|
The elements come from `buffer-undo-list', but we keep only the
|
|
|
|
|
elements inside this region, and discard those outside this
|
|
|
|
|
region. The elements' positions are adjusted so as the returned
|
|
|
|
|
list can be applied to the current buffer."
|
|
|
|
|
(let ((ulist buffer-undo-list)
|
|
|
|
|
;; A list of position adjusted undo elements in the region.
|
|
|
|
|
(selective-list (list nil))
|
|
|
|
|
;; A list of undo-deltas for out of region undo elements.
|
|
|
|
|
undo-deltas
|
|
|
|
|
undo-elt)
|
|
|
|
|
(while ulist
|
2014-05-13 16:34:12 -04:00
|
|
|
|
(when undo-no-redo
|
|
|
|
|
(while (gethash ulist undo-equiv-table)
|
|
|
|
|
(setq ulist (gethash ulist undo-equiv-table))))
|
2014-05-01 19:25:28 -04:00
|
|
|
|
(setq undo-elt (car ulist))
|
|
|
|
|
(cond
|
|
|
|
|
((null undo-elt)
|
|
|
|
|
;; Don't put two nils together in the list
|
|
|
|
|
(when (car selective-list)
|
|
|
|
|
(push nil selective-list)))
|
|
|
|
|
((and (consp undo-elt) (eq (car undo-elt) t))
|
|
|
|
|
;; This is a "was unmodified" element. Keep it
|
|
|
|
|
;; if we have kept everything thus far.
|
|
|
|
|
(when (not undo-deltas)
|
|
|
|
|
(push undo-elt selective-list)))
|
|
|
|
|
;; Skip over marker adjustments, instead relying
|
|
|
|
|
;; on finding them after (TEXT . POS) elements
|
|
|
|
|
((markerp (car-safe undo-elt))
|
|
|
|
|
nil)
|
|
|
|
|
(t
|
|
|
|
|
(let ((adjusted-undo-elt (undo-adjust-elt undo-elt
|
|
|
|
|
undo-deltas)))
|
|
|
|
|
(if (undo-elt-in-region adjusted-undo-elt start end)
|
|
|
|
|
(progn
|
|
|
|
|
(setq end (+ end (cdr (undo-delta adjusted-undo-elt))))
|
|
|
|
|
(push adjusted-undo-elt selective-list)
|
|
|
|
|
;; Keep (MARKER . ADJUSTMENT) if their (TEXT . POS) was
|
|
|
|
|
;; kept. primitive-undo may discard them later.
|
|
|
|
|
(when (and (stringp (car-safe adjusted-undo-elt))
|
|
|
|
|
(integerp (cdr-safe adjusted-undo-elt)))
|
|
|
|
|
(let ((list-i (cdr ulist)))
|
2014-03-24 22:47:39 -04:00
|
|
|
|
(while (markerp (car-safe (car list-i)))
|
2014-05-01 19:25:28 -04:00
|
|
|
|
(push (pop list-i) selective-list)))))
|
|
|
|
|
(let ((delta (undo-delta undo-elt)))
|
|
|
|
|
(when (/= 0 (cdr delta))
|
|
|
|
|
(push delta undo-deltas)))))))
|
|
|
|
|
(pop ulist))
|
|
|
|
|
(nreverse selective-list)))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
|
|
|
|
|
(defun undo-elt-in-region (undo-elt start end)
|
|
|
|
|
"Determine whether UNDO-ELT falls inside the region START ... END.
|
2014-03-24 22:47:39 -04:00
|
|
|
|
If it crosses the edge, we return nil.
|
|
|
|
|
|
|
|
|
|
Generally this function is not useful for determining
|
|
|
|
|
whether (MARKER . ADJUSTMENT) undo elements are in the region,
|
|
|
|
|
because markers can be arbitrarily relocated. Instead, pass the
|
|
|
|
|
marker adjustment's corresponding (TEXT . POS) element."
|
1998-03-14 08:19:27 +00:00
|
|
|
|
(cond ((integerp undo-elt)
|
|
|
|
|
(and (>= undo-elt start)
|
2002-09-09 00:27:30 +00:00
|
|
|
|
(<= undo-elt end)))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
((eq undo-elt nil)
|
|
|
|
|
t)
|
|
|
|
|
((atom undo-elt)
|
|
|
|
|
nil)
|
|
|
|
|
((stringp (car undo-elt))
|
|
|
|
|
;; (TEXT . POSITION)
|
|
|
|
|
(and (>= (abs (cdr undo-elt)) start)
|
2014-03-02 12:37:32 -05:00
|
|
|
|
(<= (abs (cdr undo-elt)) end)))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
((and (consp undo-elt) (markerp (car undo-elt)))
|
2014-03-24 22:47:39 -04:00
|
|
|
|
;; (MARKER . ADJUSTMENT)
|
|
|
|
|
(<= start (car undo-elt) end))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
((null (car undo-elt))
|
|
|
|
|
;; (nil PROPERTY VALUE BEG . END)
|
|
|
|
|
(let ((tail (nthcdr 3 undo-elt)))
|
|
|
|
|
(and (>= (car tail) start)
|
2002-09-09 00:27:30 +00:00
|
|
|
|
(<= (cdr tail) end))))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
((integerp (car undo-elt))
|
|
|
|
|
;; (BEGIN . END)
|
|
|
|
|
(and (>= (car undo-elt) start)
|
2002-09-09 00:27:30 +00:00
|
|
|
|
(<= (cdr undo-elt) end)))))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
|
|
|
|
|
(defun undo-elt-crosses-region (undo-elt start end)
|
|
|
|
|
"Test whether UNDO-ELT crosses one edge of that region START ... END.
|
|
|
|
|
This assumes we have already decided that UNDO-ELT
|
|
|
|
|
is not *inside* the region START...END."
|
2014-09-29 14:14:08 -04:00
|
|
|
|
(declare (obsolete nil "25.1"))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
(cond ((atom undo-elt) nil)
|
|
|
|
|
((null (car undo-elt))
|
|
|
|
|
;; (nil PROPERTY VALUE BEG . END)
|
|
|
|
|
(let ((tail (nthcdr 3 undo-elt)))
|
2006-10-02 02:30:06 +00:00
|
|
|
|
(and (< (car tail) end)
|
|
|
|
|
(> (cdr tail) start))))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
((integerp (car undo-elt))
|
|
|
|
|
;; (BEGIN . END)
|
2006-10-02 02:30:06 +00:00
|
|
|
|
(and (< (car undo-elt) end)
|
|
|
|
|
(> (cdr undo-elt) start)))))
|
2014-05-01 19:25:28 -04:00
|
|
|
|
|
|
|
|
|
(defun undo-adjust-elt (elt deltas)
|
|
|
|
|
"Return adjustment of undo element ELT by the undo DELTAS
|
|
|
|
|
list."
|
|
|
|
|
(pcase elt
|
|
|
|
|
;; POSITION
|
|
|
|
|
((pred integerp)
|
|
|
|
|
(undo-adjust-pos elt deltas))
|
|
|
|
|
;; (BEG . END)
|
|
|
|
|
(`(,(and beg (pred integerp)) . ,(and end (pred integerp)))
|
|
|
|
|
(undo-adjust-beg-end beg end deltas))
|
|
|
|
|
;; (TEXT . POSITION)
|
|
|
|
|
(`(,(and text (pred stringp)) . ,(and pos (pred integerp)))
|
|
|
|
|
(cons text (* (if (< pos 0) -1 1)
|
|
|
|
|
(undo-adjust-pos (abs pos) deltas))))
|
|
|
|
|
;; (nil PROPERTY VALUE BEG . END)
|
|
|
|
|
(`(nil . ,(or `(,prop ,val ,beg . ,end) pcase--dontcare))
|
|
|
|
|
`(nil ,prop ,val . ,(undo-adjust-beg-end beg end deltas)))
|
|
|
|
|
;; (apply DELTA START END FUN . ARGS)
|
|
|
|
|
;; FIXME
|
|
|
|
|
;; All others return same elt
|
|
|
|
|
(_ elt)))
|
|
|
|
|
|
|
|
|
|
;; (BEG . END) can adjust to the same positions, commonly when an
|
|
|
|
|
;; insertion was undone and they are out of region, for example:
|
|
|
|
|
;;
|
|
|
|
|
;; buf pos:
|
|
|
|
|
;; 123456789 buffer-undo-list undo-deltas
|
|
|
|
|
;; --------- ---------------- -----------
|
|
|
|
|
;; [...]
|
|
|
|
|
;; abbaa (2 . 4) (2 . -2)
|
|
|
|
|
;; aaa ("bb" . 2) (2 . 2)
|
|
|
|
|
;; [...]
|
|
|
|
|
;;
|
|
|
|
|
;; "bb" insertion (2 . 4) adjusts to (2 . 2) because of the subsequent
|
|
|
|
|
;; undo. Further adjustments to such an element should be the same as
|
|
|
|
|
;; for (TEXT . POSITION) elements. The options are:
|
|
|
|
|
;;
|
|
|
|
|
;; 1: POSITION adjusts using <= (use-< nil), resulting in behavior
|
|
|
|
|
;; analogous to marker insertion-type t.
|
|
|
|
|
;;
|
|
|
|
|
;; 2: POSITION adjusts using <, resulting in behavior analogous to
|
|
|
|
|
;; marker insertion-type nil.
|
|
|
|
|
;;
|
|
|
|
|
;; There was no strong reason to prefer one or the other, except that
|
|
|
|
|
;; the first is more consistent with prior undo in region behavior.
|
|
|
|
|
(defun undo-adjust-beg-end (beg end deltas)
|
|
|
|
|
"Return cons of adjustments to BEG and END by the undo DELTAS
|
|
|
|
|
list."
|
|
|
|
|
(let ((adj-beg (undo-adjust-pos beg deltas)))
|
|
|
|
|
;; Note: option 2 above would be like (cons (min ...) adj-end)
|
|
|
|
|
(cons adj-beg
|
|
|
|
|
(max adj-beg (undo-adjust-pos end deltas t)))))
|
|
|
|
|
|
|
|
|
|
(defun undo-adjust-pos (pos deltas &optional use-<)
|
|
|
|
|
"Return adjustment of POS by the undo DELTAS list, comparing
|
|
|
|
|
with < or <= based on USE-<."
|
|
|
|
|
(dolist (d deltas pos)
|
|
|
|
|
(when (if use-<
|
|
|
|
|
(< (car d) pos)
|
|
|
|
|
(<= (car d) pos))
|
|
|
|
|
(setq pos
|
|
|
|
|
;; Don't allow pos to become less than the undo-delta
|
|
|
|
|
;; position. This edge case is described in the overview
|
|
|
|
|
;; comments.
|
|
|
|
|
(max (car d) (- pos (cdr d)))))))
|
1998-03-14 08:19:27 +00:00
|
|
|
|
|
|
|
|
|
;; Return the first affected buffer position and the delta for an undo element
|
|
|
|
|
;; delta is defined as the change in subsequent buffer positions if we *did*
|
|
|
|
|
;; the undo.
|
|
|
|
|
(defun undo-delta (undo-elt)
|
|
|
|
|
(if (consp undo-elt)
|
|
|
|
|
(cond ((stringp (car undo-elt))
|
|
|
|
|
;; (TEXT . POSITION)
|
|
|
|
|
(cons (abs (cdr undo-elt)) (length (car undo-elt))))
|
|
|
|
|
((integerp (car undo-elt))
|
|
|
|
|
;; (BEGIN . END)
|
|
|
|
|
(cons (car undo-elt) (- (car undo-elt) (cdr undo-elt))))
|
|
|
|
|
(t
|
|
|
|
|
'(0 . 0)))
|
|
|
|
|
'(0 . 0)))
|
2004-12-21 11:37:52 +00:00
|
|
|
|
|
2015-08-06 21:33:58 +01:00
|
|
|
|
;;; Default undo-boundary addition
|
|
|
|
|
;;
|
|
|
|
|
;; This section adds a new undo-boundary at either after a command is
|
|
|
|
|
;; called or in some cases on a timer called after a change is made in
|
|
|
|
|
;; any buffer.
|
|
|
|
|
(defvar-local undo-auto--last-boundary-cause nil
|
|
|
|
|
"Describe the cause of the last undo-boundary.
|
|
|
|
|
|
|
|
|
|
If `explicit', the last boundary was caused by an explicit call to
|
|
|
|
|
`undo-boundary', that is one not called by the code in this
|
|
|
|
|
section.
|
|
|
|
|
|
|
|
|
|
If it is equal to `timer', then the last boundary was inserted
|
|
|
|
|
by `undo-auto--boundary-timer'.
|
|
|
|
|
|
|
|
|
|
If it is equal to `command', then the last boundary was inserted
|
|
|
|
|
automatically after a command, that is by the code defined in
|
|
|
|
|
this section.
|
|
|
|
|
|
|
|
|
|
If it is equal to a list, then the last boundary was inserted by
|
|
|
|
|
an amalgamating command. The car of the list is the number of
|
|
|
|
|
times an amalgamating command has been called, and the cdr are the
|
|
|
|
|
buffers that were changed during the last command.")
|
|
|
|
|
|
2015-12-03 21:27:33 +00:00
|
|
|
|
(defvar undo-auto-current-boundary-timer nil
|
2015-08-06 21:33:58 +01:00
|
|
|
|
"Current timer which will run `undo-auto--boundary-timer' or nil.
|
|
|
|
|
|
|
|
|
|
If set to non-nil, this will effectively disable the timer.")
|
|
|
|
|
|
|
|
|
|
(defvar undo-auto--this-command-amalgamating nil
|
|
|
|
|
"Non-nil if `this-command' should be amalgamated.
|
|
|
|
|
This variable is set to nil by `undo-auto--boundaries' and is set
|
2015-12-03 21:27:33 +00:00
|
|
|
|
by `undo-auto-amalgamate'." )
|
2015-08-06 21:33:58 +01:00
|
|
|
|
|
|
|
|
|
(defun undo-auto--needs-boundary-p ()
|
|
|
|
|
"Return non-nil if `buffer-undo-list' needs a boundary at the start."
|
|
|
|
|
(car-safe buffer-undo-list))
|
|
|
|
|
|
|
|
|
|
(defun undo-auto--last-boundary-amalgamating-number ()
|
|
|
|
|
"Return the number of amalgamating last commands or nil.
|
|
|
|
|
Amalgamating commands are, by default, either
|
|
|
|
|
`self-insert-command' and `delete-char', but can be any command
|
2015-12-03 21:27:33 +00:00
|
|
|
|
that calls `undo-auto-amalgamate'."
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(car-safe undo-auto--last-boundary-cause))
|
|
|
|
|
|
|
|
|
|
(defun undo-auto--ensure-boundary (cause)
|
|
|
|
|
"Add an `undo-boundary' to the current buffer if needed.
|
|
|
|
|
REASON describes the reason that the boundary is being added; see
|
2018-04-07 11:21:52 -04:00
|
|
|
|
`undo-auto--last-boundary-cause' for more information."
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(when (and
|
|
|
|
|
(undo-auto--needs-boundary-p))
|
|
|
|
|
(let ((last-amalgamating
|
|
|
|
|
(undo-auto--last-boundary-amalgamating-number)))
|
|
|
|
|
(undo-boundary)
|
|
|
|
|
(setq undo-auto--last-boundary-cause
|
|
|
|
|
(if (eq 'amalgamate cause)
|
|
|
|
|
(cons
|
|
|
|
|
(if last-amalgamating (1+ last-amalgamating) 0)
|
|
|
|
|
undo-auto--undoably-changed-buffers)
|
|
|
|
|
cause)))))
|
|
|
|
|
|
|
|
|
|
(defun undo-auto--boundaries (cause)
|
|
|
|
|
"Check recently changed buffers and add a boundary if necessary.
|
|
|
|
|
REASON describes the reason that the boundary is being added; see
|
|
|
|
|
`undo-last-boundary' for more information."
|
2016-06-17 22:34:50 +01:00
|
|
|
|
;; (Bug #23785) All commands should ensure that there is an undo
|
|
|
|
|
;; boundary whether they have changed the current buffer or not.
|
|
|
|
|
(when (eq cause 'command)
|
|
|
|
|
(add-to-list 'undo-auto--undoably-changed-buffers (current-buffer)))
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(dolist (b undo-auto--undoably-changed-buffers)
|
|
|
|
|
(when (buffer-live-p b)
|
|
|
|
|
(with-current-buffer b
|
2016-06-10 22:30:49 +01:00
|
|
|
|
(undo-auto--ensure-boundary cause))))
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(setq undo-auto--undoably-changed-buffers nil))
|
|
|
|
|
|
|
|
|
|
(defun undo-auto--boundary-timer ()
|
2018-04-05 21:38:07 +03:00
|
|
|
|
"Timer function run by `undo-auto-current-boundary-timer'."
|
2015-12-03 21:27:33 +00:00
|
|
|
|
(setq undo-auto-current-boundary-timer nil)
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(undo-auto--boundaries 'timer))
|
|
|
|
|
|
|
|
|
|
(defun undo-auto--boundary-ensure-timer ()
|
2018-04-05 21:38:07 +03:00
|
|
|
|
"Ensure that the `undo-auto-current-boundary-timer' is set."
|
2015-12-03 21:27:33 +00:00
|
|
|
|
(unless undo-auto-current-boundary-timer
|
|
|
|
|
(setq undo-auto-current-boundary-timer
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(run-at-time 10 nil #'undo-auto--boundary-timer))))
|
|
|
|
|
|
|
|
|
|
(defvar undo-auto--undoably-changed-buffers nil
|
|
|
|
|
"List of buffers that have changed recently.
|
|
|
|
|
|
|
|
|
|
This list is maintained by `undo-auto--undoable-change' and
|
|
|
|
|
`undo-auto--boundaries' and can be affected by changes to their
|
2016-06-06 09:35:17 +01:00
|
|
|
|
default values.")
|
2015-08-06 21:33:58 +01:00
|
|
|
|
|
|
|
|
|
(defun undo-auto--add-boundary ()
|
|
|
|
|
"Add an `undo-boundary' in appropriate buffers."
|
|
|
|
|
(undo-auto--boundaries
|
2015-11-19 15:57:55 +00:00
|
|
|
|
(let ((amal undo-auto--this-command-amalgamating))
|
2018-04-07 11:21:52 -04:00
|
|
|
|
(setq undo-auto--this-command-amalgamating nil)
|
|
|
|
|
(if amal
|
|
|
|
|
'amalgamate
|
|
|
|
|
'command))))
|
2015-08-06 21:33:58 +01:00
|
|
|
|
|
2015-12-03 21:27:33 +00:00
|
|
|
|
(defun undo-auto-amalgamate ()
|
2015-08-06 21:33:58 +01:00
|
|
|
|
"Amalgamate undo if necessary.
|
2015-11-24 23:02:11 +00:00
|
|
|
|
This function can be called before an amalgamating command. It
|
2015-08-06 21:33:58 +01:00
|
|
|
|
removes the previous `undo-boundary' if a series of such calls
|
|
|
|
|
have been made. By default `self-insert-command' and
|
|
|
|
|
`delete-char' are the only amalgamating commands, although this
|
|
|
|
|
function could be called by any command wishing to have this
|
2016-01-25 18:24:09 -05:00
|
|
|
|
behavior."
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(let ((last-amalgamating-count
|
|
|
|
|
(undo-auto--last-boundary-amalgamating-number)))
|
|
|
|
|
(setq undo-auto--this-command-amalgamating t)
|
2018-04-07 11:21:52 -04:00
|
|
|
|
(when last-amalgamating-count
|
|
|
|
|
(if (and (< last-amalgamating-count 20)
|
|
|
|
|
(eq this-command last-command))
|
2015-08-06 21:33:58 +01:00
|
|
|
|
;; Amalgamate all buffers that have changed.
|
2018-04-07 11:21:52 -04:00
|
|
|
|
;; This may be needed for example if some *-change-functions
|
|
|
|
|
;; reflected these changes in some other buffer.
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(dolist (b (cdr undo-auto--last-boundary-cause))
|
|
|
|
|
(when (buffer-live-p b)
|
|
|
|
|
(with-current-buffer
|
|
|
|
|
b
|
2018-04-07 11:21:52 -04:00
|
|
|
|
(when (and (consp buffer-undo-list)
|
|
|
|
|
;; `car-safe' doesn't work because
|
|
|
|
|
;; `buffer-undo-list' need not be a list!
|
|
|
|
|
(null (car buffer-undo-list)))
|
|
|
|
|
;; The head of `buffer-undo-list' is nil.
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(setq buffer-undo-list
|
|
|
|
|
(cdr buffer-undo-list))))))
|
|
|
|
|
(setq undo-auto--last-boundary-cause 0)))))
|
|
|
|
|
|
|
|
|
|
(defun undo-auto--undoable-change ()
|
|
|
|
|
"Called after every undoable buffer change."
|
2018-04-07 11:21:52 -04:00
|
|
|
|
(unless (memq (current-buffer) undo-auto--undoably-changed-buffers)
|
|
|
|
|
(let ((bufs undo-auto--undoably-changed-buffers))
|
|
|
|
|
;; Drop dead buffers from the list, to avoid memory leak in
|
|
|
|
|
;; (while t (with-temp-buffer (setq buffer-undo-list nil) (insert "a")))
|
|
|
|
|
(while bufs
|
|
|
|
|
(let ((next (cdr bufs)))
|
|
|
|
|
(if (or (buffer-live-p (car bufs)) (null next))
|
|
|
|
|
(setq bufs next)
|
|
|
|
|
(setcar bufs (car next))
|
|
|
|
|
(setcdr bufs (cdr next))))))
|
|
|
|
|
(push (current-buffer) undo-auto--undoably-changed-buffers))
|
2015-08-06 21:33:58 +01:00
|
|
|
|
(undo-auto--boundary-ensure-timer))
|
|
|
|
|
;; End auto-boundary section
|
|
|
|
|
|
2016-07-18 21:04:39 -04:00
|
|
|
|
(defun undo-amalgamate-change-group (handle)
|
|
|
|
|
"Amalgamate changes in change-group since HANDLE.
|
|
|
|
|
Remove all undo boundaries between the state of HANDLE and now.
|
|
|
|
|
HANDLE is as returned by `prepare-change-group'."
|
|
|
|
|
(dolist (elt handle)
|
|
|
|
|
(with-current-buffer (car elt)
|
|
|
|
|
(setq elt (cdr elt))
|
|
|
|
|
(when (consp buffer-undo-list)
|
|
|
|
|
(let ((old-car (car-safe elt))
|
|
|
|
|
(old-cdr (cdr-safe elt)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
;; Temporarily truncate the undo log at ELT.
|
|
|
|
|
(when (consp elt)
|
|
|
|
|
(setcar elt t) (setcdr elt nil))
|
|
|
|
|
(when
|
|
|
|
|
(or (null elt) ;The undo-log was empty.
|
|
|
|
|
;; `elt' is still in the log: normal case.
|
|
|
|
|
(eq elt (last buffer-undo-list))
|
|
|
|
|
;; `elt' is not in the log any more, but that's because
|
|
|
|
|
;; the log is "all new", so we should remove all
|
|
|
|
|
;; boundaries from it.
|
|
|
|
|
(not (eq (last buffer-undo-list) (last old-cdr))))
|
|
|
|
|
(cl-callf (lambda (x) (delq nil x))
|
|
|
|
|
(if (car buffer-undo-list)
|
|
|
|
|
buffer-undo-list
|
|
|
|
|
;; Preserve the undo-boundaries at either ends of the
|
|
|
|
|
;; change-groups.
|
|
|
|
|
(cdr buffer-undo-list)))))
|
|
|
|
|
;; Reset the modified cons cell ELT to its original content.
|
|
|
|
|
(when (consp elt)
|
|
|
|
|
(setcar elt old-car)
|
|
|
|
|
(setcdr elt old-cdr))))))))
|
|
|
|
|
|
|
|
|
|
|
2006-07-11 19:15:33 +00:00
|
|
|
|
(defcustom undo-ask-before-discard nil
|
2005-01-30 00:32:39 +00:00
|
|
|
|
"If non-nil ask about discarding undo info for the current command.
|
|
|
|
|
Normally, Emacs discards the undo info for the current command if
|
|
|
|
|
it exceeds `undo-outer-limit'. But if you set this option
|
|
|
|
|
non-nil, it asks in the echo area whether to discard the info.
|
2006-10-11 06:27:08 +00:00
|
|
|
|
If you answer no, there is a slight risk that Emacs might crash, so
|
2005-01-30 00:32:39 +00:00
|
|
|
|
only do it if you really want to undo the command.
|
|
|
|
|
|
|
|
|
|
This option is mainly intended for debugging. You have to be
|
|
|
|
|
careful if you use it for other purposes. Garbage collection is
|
|
|
|
|
inhibited while the question is asked, meaning that Emacs might
|
|
|
|
|
leak memory. So you should make sure that you do not wait
|
|
|
|
|
excessively long before answering the question."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'undo
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1")
|
2005-01-30 00:32:39 +00:00
|
|
|
|
|
2004-12-29 01:33:04 +00:00
|
|
|
|
(defvar undo-extra-outer-limit nil
|
|
|
|
|
"If non-nil, an extra level of size that's ok in an undo item.
|
|
|
|
|
We don't ask the user about truncating the undo list until the
|
2005-01-30 00:32:39 +00:00
|
|
|
|
current item gets bigger than this amount.
|
|
|
|
|
|
|
|
|
|
This variable only matters if `undo-ask-before-discard' is non-nil.")
|
2004-12-29 01:33:04 +00:00
|
|
|
|
(make-variable-buffer-local 'undo-extra-outer-limit)
|
|
|
|
|
|
2005-01-30 00:32:39 +00:00
|
|
|
|
;; When the first undo batch in an undo list is longer than
|
|
|
|
|
;; undo-outer-limit, this function gets called to warn the user that
|
|
|
|
|
;; the undo info for the current command was discarded. Garbage
|
|
|
|
|
;; collection is inhibited around the call, so it had better not do a
|
|
|
|
|
;; lot of consing.
|
2004-12-21 11:37:52 +00:00
|
|
|
|
(setq undo-outer-limit-function 'undo-outer-limit-truncate)
|
|
|
|
|
(defun undo-outer-limit-truncate (size)
|
2005-01-30 00:32:39 +00:00
|
|
|
|
(if undo-ask-before-discard
|
|
|
|
|
(when (or (null undo-extra-outer-limit)
|
|
|
|
|
(> size undo-extra-outer-limit))
|
|
|
|
|
;; Don't ask the question again unless it gets even bigger.
|
|
|
|
|
;; This applies, in particular, if the user quits from the question.
|
|
|
|
|
;; Such a quit quits out of GC, but something else will call GC
|
|
|
|
|
;; again momentarily. It will call this function again,
|
|
|
|
|
;; but we don't want to ask the question again.
|
|
|
|
|
(setq undo-extra-outer-limit (+ size 50000))
|
|
|
|
|
(if (let (use-dialog-box track-mouse executing-kbd-macro )
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(yes-or-no-p (format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"Buffer `%s' undo info is %d bytes long; discard it? "
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(buffer-name) size)))
|
2005-01-30 00:32:39 +00:00
|
|
|
|
(progn (setq buffer-undo-list nil)
|
|
|
|
|
(setq undo-extra-outer-limit nil)
|
|
|
|
|
t)
|
|
|
|
|
nil))
|
|
|
|
|
(display-warning '(undo discard-info)
|
|
|
|
|
(concat
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"Buffer `%s' undo info was %d bytes long.\n"
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(buffer-name) size)
|
2005-01-30 00:32:39 +00:00
|
|
|
|
"The undo info was discarded because it exceeded \
|
|
|
|
|
`undo-outer-limit'.
|
|
|
|
|
|
|
|
|
|
This is normal if you executed a command that made a huge change
|
|
|
|
|
to the buffer. In that case, to prevent similar problems in the
|
|
|
|
|
future, set `undo-outer-limit' to a value that is large enough to
|
|
|
|
|
cover the maximum size of normal changes you expect a single
|
|
|
|
|
command to make, but not so large that it might exceed the
|
|
|
|
|
maximum memory allotted to Emacs.
|
|
|
|
|
|
|
|
|
|
If you did not execute any such command, the situation is
|
|
|
|
|
probably due to a bug and you should report it.
|
|
|
|
|
|
|
|
|
|
You can disable the popping up of this buffer by adding the entry
|
2009-03-14 17:43:16 +00:00
|
|
|
|
\(undo discard-info) to the user option `warning-suppress-types',
|
|
|
|
|
which is defined in the `warnings' library.\n")
|
2005-01-30 00:32:39 +00:00
|
|
|
|
:warning)
|
|
|
|
|
(setq buffer-undo-list nil)
|
|
|
|
|
t))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
|
1993-07-31 06:10:44 +00:00
|
|
|
|
(defvar shell-command-history nil
|
2007-12-22 17:12:30 +00:00
|
|
|
|
"History list for some commands that read shell commands.
|
|
|
|
|
|
|
|
|
|
Maximum length of the history list is determined by the value
|
|
|
|
|
of `history-length', which see.")
|
1993-07-31 06:10:44 +00:00
|
|
|
|
|
2009-11-12 06:55:39 +00:00
|
|
|
|
(defvar shell-command-switch (purecopy "-c")
|
1994-11-01 05:50:57 +00:00
|
|
|
|
"Switch used to have the shell execute its command line argument.")
|
|
|
|
|
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(defvar shell-command-default-error-buffer nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Buffer name for `shell-command' and `shell-command-on-region' error output.
|
2002-06-29 18:16:27 +00:00
|
|
|
|
This buffer is used when `shell-command' or `shell-command-on-region'
|
1999-03-01 03:19:32 +00:00
|
|
|
|
is run interactively. A value of nil means that output to stderr and
|
|
|
|
|
stdout will be intermixed in the output stream.")
|
|
|
|
|
|
2008-04-22 19:50:11 +00:00
|
|
|
|
(declare-function mailcap-file-default-commands "mailcap" (files))
|
2009-11-11 00:11:40 +00:00
|
|
|
|
(declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep))
|
2008-04-22 19:50:11 +00:00
|
|
|
|
|
|
|
|
|
(defun minibuffer-default-add-shell-commands ()
|
2009-01-01 09:14:42 +00:00
|
|
|
|
"Return a list of all commands associated with the current file.
|
2008-10-19 15:01:46 +00:00
|
|
|
|
This function is used to add all related commands retrieved by `mailcap'
|
2008-04-22 19:50:11 +00:00
|
|
|
|
to the end of the list of defaults just after the default value."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((filename (if (listp minibuffer-default)
|
|
|
|
|
(car minibuffer-default)
|
|
|
|
|
minibuffer-default))
|
|
|
|
|
(commands (and filename (require 'mailcap nil t)
|
|
|
|
|
(mailcap-file-default-commands (list filename)))))
|
|
|
|
|
(setq commands (mapcar (lambda (command)
|
|
|
|
|
(concat command " " filename))
|
|
|
|
|
commands))
|
|
|
|
|
(if (listp minibuffer-default)
|
|
|
|
|
(append minibuffer-default commands)
|
|
|
|
|
(cons minibuffer-default commands))))
|
|
|
|
|
|
2011-05-12 09:55:10 -03:00
|
|
|
|
(declare-function shell-completion-vars "shell" ())
|
2008-10-12 22:45:27 +00:00
|
|
|
|
|
2008-03-20 19:48:07 +00:00
|
|
|
|
(defvar minibuffer-local-shell-command-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(set-keymap-parent map minibuffer-local-map)
|
2011-05-02 22:52:52 -03:00
|
|
|
|
(define-key map "\t" 'completion-at-point)
|
2008-03-20 19:48:07 +00:00
|
|
|
|
map)
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Keymap used for completing shell commands in minibuffer.")
|
2008-03-20 19:48:07 +00:00
|
|
|
|
|
|
|
|
|
(defun read-shell-command (prompt &optional initial-contents hist &rest args)
|
|
|
|
|
"Read a shell command from the minibuffer.
|
|
|
|
|
The arguments are the same as the ones of `read-from-minibuffer',
|
|
|
|
|
except READ and KEYMAP are missing and HIST defaults
|
|
|
|
|
to `shell-command-history'."
|
2011-05-02 22:52:52 -03:00
|
|
|
|
(require 'shell)
|
2008-07-31 16:51:21 +00:00
|
|
|
|
(minibuffer-with-setup-hook
|
|
|
|
|
(lambda ()
|
2011-05-12 09:55:10 -03:00
|
|
|
|
(shell-completion-vars)
|
2008-07-31 16:51:21 +00:00
|
|
|
|
(set (make-local-variable 'minibuffer-default-add-function)
|
|
|
|
|
'minibuffer-default-add-shell-commands))
|
|
|
|
|
(apply 'read-from-minibuffer prompt initial-contents
|
|
|
|
|
minibuffer-local-shell-command-map
|
|
|
|
|
nil
|
|
|
|
|
(or hist 'shell-command-history)
|
|
|
|
|
args)))
|
2008-03-20 19:48:07 +00:00
|
|
|
|
|
2012-07-29 03:03:26 +03:00
|
|
|
|
(defcustom async-shell-command-buffer 'confirm-new-buffer
|
|
|
|
|
"What to do when the output buffer is used by another shell command.
|
|
|
|
|
This option specifies how to resolve the conflict where a new command
|
|
|
|
|
wants to direct its output to the buffer `*Async Shell Command*',
|
|
|
|
|
but this buffer is already taken by another running shell command.
|
|
|
|
|
|
|
|
|
|
The value `confirm-kill-process' is used to ask for confirmation before
|
|
|
|
|
killing the already running process and running a new process
|
|
|
|
|
in the same buffer, `confirm-new-buffer' for confirmation before running
|
|
|
|
|
the command in a new buffer with a name other than the default buffer name,
|
|
|
|
|
`new-buffer' for doing the same without confirmation,
|
|
|
|
|
`confirm-rename-buffer' for confirmation before renaming the existing
|
|
|
|
|
output buffer and running a new command in the default buffer,
|
|
|
|
|
`rename-buffer' for doing the same without confirmation."
|
|
|
|
|
:type '(choice (const :tag "Confirm killing of running command"
|
|
|
|
|
confirm-kill-process)
|
|
|
|
|
(const :tag "Confirm creation of a new buffer"
|
|
|
|
|
confirm-new-buffer)
|
|
|
|
|
(const :tag "Create a new buffer"
|
|
|
|
|
new-buffer)
|
|
|
|
|
(const :tag "Confirm renaming of existing buffer"
|
|
|
|
|
confirm-rename-buffer)
|
|
|
|
|
(const :tag "Rename the existing buffer"
|
|
|
|
|
rename-buffer))
|
|
|
|
|
:group 'shell
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3")
|
2012-07-29 03:03:26 +03:00
|
|
|
|
|
2017-06-28 22:40:33 +01:00
|
|
|
|
(defcustom async-shell-command-display-buffer t
|
|
|
|
|
"Whether to display the command buffer immediately.
|
|
|
|
|
If t, display the buffer immediately; if nil, wait until there
|
|
|
|
|
is output."
|
|
|
|
|
:type '(choice (const :tag "Display buffer immediately"
|
|
|
|
|
t)
|
|
|
|
|
(const :tag "Display buffer on output"
|
|
|
|
|
nil))
|
|
|
|
|
:group 'shell
|
|
|
|
|
:version "26.1")
|
|
|
|
|
|
2018-01-28 23:59:02 +02:00
|
|
|
|
(defcustom shell-command-dont-erase-buffer nil
|
|
|
|
|
"If non-nil, output buffer is not erased between shell commands.
|
|
|
|
|
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)
|
|
|
|
|
(const :tag "Set point to end of last output" end-last-out)
|
|
|
|
|
(const :tag "Save point" save-point))
|
|
|
|
|
:group 'shell
|
|
|
|
|
:version "26.1")
|
|
|
|
|
|
|
|
|
|
(defvar shell-command-saved-pos nil
|
|
|
|
|
"Record of point positions in output buffers after command completion.
|
|
|
|
|
The value is an alist whose elements are of the form (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.")
|
|
|
|
|
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(defun shell-command--save-pos-or-erase ()
|
|
|
|
|
"Store a buffer position or erase the buffer.
|
2016-08-26 15:27:37 +09:00
|
|
|
|
See `shell-command-dont-erase-buffer'."
|
|
|
|
|
(let ((sym shell-command-dont-erase-buffer)
|
2016-08-16 18:18:44 +09:00
|
|
|
|
pos)
|
|
|
|
|
(setq buffer-read-only nil)
|
|
|
|
|
;; Setting buffer-read-only to nil doesn't suffice
|
|
|
|
|
;; if some text has a non-nil read-only property,
|
|
|
|
|
;; which comint sometimes adds for prompts.
|
|
|
|
|
(setq pos
|
|
|
|
|
(cond ((eq sym 'save-point) (point))
|
|
|
|
|
((eq sym 'beg-last-out) (point-max))
|
|
|
|
|
((not sym)
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(erase-buffer) nil))))
|
|
|
|
|
(when pos
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(push (cons (current-buffer) pos)
|
|
|
|
|
shell-command-saved-pos))))
|
|
|
|
|
|
|
|
|
|
(defun shell-command--set-point-after-cmd (&optional buffer)
|
|
|
|
|
"Set point in BUFFER after command complete.
|
|
|
|
|
BUFFER is the output buffer of the command; if nil, then defaults
|
|
|
|
|
to the current BUFFER.
|
|
|
|
|
Set point to the `cdr' of the element in `shell-command-saved-pos'
|
|
|
|
|
whose `car' is BUFFER."
|
2016-08-26 15:27:37 +09:00
|
|
|
|
(when shell-command-dont-erase-buffer
|
|
|
|
|
(let* ((sym shell-command-dont-erase-buffer)
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(buf (or buffer (current-buffer)))
|
|
|
|
|
(pos (alist-get buf shell-command-saved-pos)))
|
|
|
|
|
(setq shell-command-saved-pos
|
|
|
|
|
(assq-delete-all buf shell-command-saved-pos))
|
|
|
|
|
(when (buffer-live-p buf)
|
|
|
|
|
(let ((win (car (get-buffer-window-list buf)))
|
|
|
|
|
(pmax (with-current-buffer buf (point-max))))
|
|
|
|
|
(unless (and pos (memq sym '(save-point beg-last-out)))
|
|
|
|
|
(setq pos pmax))
|
|
|
|
|
;; Set point in the window displaying buf, if any; otherwise
|
|
|
|
|
;; display buf temporary in selected frame and set the point.
|
|
|
|
|
(if win
|
|
|
|
|
(set-window-point win pos)
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(let ((win (display-buffer
|
|
|
|
|
buf
|
|
|
|
|
'(nil (inhibit-switch-frame . t)))))
|
|
|
|
|
(set-window-point win pos)))))))))
|
|
|
|
|
|
2009-07-02 22:47:52 +00:00
|
|
|
|
(defun async-shell-command (command &optional output-buffer error-buffer)
|
|
|
|
|
"Execute string COMMAND asynchronously in background.
|
|
|
|
|
|
2012-07-17 21:40:15 +03:00
|
|
|
|
Like `shell-command', but adds `&' at the end of COMMAND
|
|
|
|
|
to execute it asynchronously.
|
|
|
|
|
|
2010-05-17 15:27:26 -04:00
|
|
|
|
The output appears in the buffer `*Async Shell Command*'.
|
2012-07-17 21:40:15 +03:00
|
|
|
|
That buffer is in shell mode.
|
2010-05-17 15:27:26 -04:00
|
|
|
|
|
2018-02-03 23:27:13 +02:00
|
|
|
|
You can configure `async-shell-command-buffer' to specify what to do
|
|
|
|
|
when the `*Async Shell Command*' buffer is already taken by another
|
2013-12-03 03:19:24 +02:00
|
|
|
|
running shell command. To run COMMAND without displaying the output
|
|
|
|
|
in a window you can configure `display-buffer-alist' to use the action
|
|
|
|
|
`display-buffer-no-window' for the buffer `*Async Shell Command*'.
|
|
|
|
|
|
2010-05-17 15:27:26 -04:00
|
|
|
|
In Elisp, you will often be better served by calling `start-process'
|
2018-02-03 23:27:13 +02:00
|
|
|
|
directly, since it offers more control and does not impose the use of
|
|
|
|
|
a shell (with its need to quote arguments)."
|
2009-07-02 22:47:52 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list
|
|
|
|
|
(read-shell-command "Async shell command: " nil nil
|
2012-07-17 21:40:15 +03:00
|
|
|
|
(let ((filename
|
|
|
|
|
(cond
|
|
|
|
|
(buffer-file-name)
|
|
|
|
|
((eq major-mode 'dired-mode)
|
|
|
|
|
(dired-get-filename nil t)))))
|
|
|
|
|
(and filename (file-relative-name filename))))
|
2009-07-02 22:47:52 +00:00
|
|
|
|
current-prefix-arg
|
|
|
|
|
shell-command-default-error-buffer))
|
|
|
|
|
(unless (string-match "&[ \t]*\\'" command)
|
|
|
|
|
(setq command (concat command " &")))
|
|
|
|
|
(shell-command command output-buffer error-buffer))
|
|
|
|
|
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(declare-function comint-output-filter "comint" (process string))
|
|
|
|
|
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(defun shell-command (command &optional output-buffer error-buffer)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Execute string COMMAND in inferior shell; display output, if any.
|
2000-11-25 08:48:13 +00:00
|
|
|
|
With prefix argument, insert the COMMAND's output at point.
|
1995-03-21 05:14:38 +00:00
|
|
|
|
|
2016-03-06 19:36:57 +02:00
|
|
|
|
Interactively, prompt for COMMAND in the minibuffer.
|
|
|
|
|
|
2012-07-17 21:40:15 +03:00
|
|
|
|
If COMMAND ends in `&', execute it asynchronously.
|
1995-03-21 05:14:38 +00:00
|
|
|
|
The output appears in the buffer `*Async Shell Command*'.
|
2012-07-17 21:40:15 +03:00
|
|
|
|
That buffer is in shell mode. You can also use
|
|
|
|
|
`async-shell-command' that automatically adds `&'.
|
1995-03-21 05:14:38 +00:00
|
|
|
|
|
2000-11-08 17:35:57 +00:00
|
|
|
|
Otherwise, COMMAND is executed synchronously. The output appears in
|
|
|
|
|
the buffer `*Shell Command Output*'. If the output is short enough to
|
|
|
|
|
display in the echo area (which is determined by the variables
|
|
|
|
|
`resize-mini-windows' and `max-mini-window-height'), it is shown
|
|
|
|
|
there, but it is nonetheless available in buffer `*Shell Command
|
2001-10-31 00:57:04 +00:00
|
|
|
|
Output*' even though that buffer is not automatically displayed.
|
1994-10-15 10:16:09 +00:00
|
|
|
|
|
1997-08-04 00:51:07 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
in the shell command output, use \\[universal-coding-system-argument] \
|
1997-08-04 00:51:07 +00:00
|
|
|
|
before this command.
|
|
|
|
|
|
|
|
|
|
Noninteractive callers can specify coding systems by binding
|
|
|
|
|
`coding-system-for-read' and `coding-system-for-write'.
|
|
|
|
|
|
1994-10-15 10:16:09 +00:00
|
|
|
|
The optional second argument OUTPUT-BUFFER, if non-nil,
|
|
|
|
|
says to put the output in some other buffer.
|
2016-07-11 02:47:28 +09:00
|
|
|
|
If OUTPUT-BUFFER is a buffer or buffer name, erase that buffer
|
2016-08-16 18:18:44 +09:00
|
|
|
|
and insert the output there; a non-nil value of
|
2017-11-15 20:35:18 +01:00
|
|
|
|
`shell-command-dont-erase-buffer' prevents the buffer from being
|
|
|
|
|
erased. If OUTPUT-BUFFER is not a buffer and not nil, insert the
|
|
|
|
|
output in current buffer after point leaving mark after it. This
|
|
|
|
|
cannot be done asynchronously.
|
1999-03-01 03:19:32 +00:00
|
|
|
|
|
2001-12-13 07:43:28 +00:00
|
|
|
|
If the command terminates without error, but generates output,
|
|
|
|
|
and you did not specify \"insert it in the current buffer\",
|
|
|
|
|
the output can be displayed in the echo area or in its buffer.
|
|
|
|
|
If the output is short enough to display in the echo area
|
|
|
|
|
\(determined by the variable `max-mini-window-height' if
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
`resize-mini-windows' is non-nil), it is shown there.
|
2017-11-15 20:35:18 +01:00
|
|
|
|
Otherwise, the buffer containing the output is displayed.
|
2001-12-13 07:43:28 +00:00
|
|
|
|
|
|
|
|
|
If there is output and an error, and you did not specify \"insert it
|
|
|
|
|
in the current buffer\", a message about the error goes at the end
|
|
|
|
|
of the output.
|
|
|
|
|
|
1999-03-01 03:19:32 +00:00
|
|
|
|
If the optional third argument ERROR-BUFFER is non-nil, it is a buffer
|
|
|
|
|
or buffer name to which to direct the command's standard error output.
|
|
|
|
|
If it is nil, error output is mingled with regular output.
|
|
|
|
|
In an interactive call, the variable `shell-command-default-error-buffer'
|
2010-05-17 15:27:26 -04:00
|
|
|
|
specifies the value of ERROR-BUFFER.
|
|
|
|
|
|
|
|
|
|
In Elisp, you will often be better served by calling `call-process' or
|
2018-02-03 23:27:13 +02:00
|
|
|
|
`start-process' directly, since they offer more control and do not
|
|
|
|
|
impose the use of a shell (with its need to quote arguments)."
|
1999-03-01 03:19:32 +00:00
|
|
|
|
|
2008-04-22 19:50:11 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list
|
2008-07-31 16:51:21 +00:00
|
|
|
|
(read-shell-command "Shell command: " nil nil
|
2009-11-11 00:11:40 +00:00
|
|
|
|
(let ((filename
|
|
|
|
|
(cond
|
|
|
|
|
(buffer-file-name)
|
|
|
|
|
((eq major-mode 'dired-mode)
|
|
|
|
|
(dired-get-filename nil t)))))
|
|
|
|
|
(and filename (file-relative-name filename))))
|
2008-04-22 19:50:11 +00:00
|
|
|
|
current-prefix-arg
|
|
|
|
|
shell-command-default-error-buffer))
|
1996-02-21 21:25:30 +00:00
|
|
|
|
;; Look for a handler in case default-directory is a remote file name.
|
|
|
|
|
(let ((handler
|
|
|
|
|
(find-file-name-handler (directory-file-name default-directory)
|
|
|
|
|
'shell-command)))
|
|
|
|
|
(if handler
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(funcall handler 'shell-command command output-buffer error-buffer)
|
1996-02-21 21:25:30 +00:00
|
|
|
|
(if (and output-buffer
|
|
|
|
|
(not (or (bufferp output-buffer) (stringp output-buffer))))
|
2001-12-13 07:43:28 +00:00
|
|
|
|
;; Output goes in current buffer.
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(let ((error-file
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(and error-buffer
|
|
|
|
|
(make-temp-file
|
|
|
|
|
(expand-file-name "scor"
|
|
|
|
|
(or small-temporary-file-directory
|
|
|
|
|
temporary-file-directory))))))
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(barf-if-buffer-read-only)
|
1999-06-10 01:19:33 +00:00
|
|
|
|
(push-mark nil t)
|
1999-03-01 03:19:32 +00:00
|
|
|
|
;; We do not use -f for csh; we will not support broken use of
|
|
|
|
|
;; .cshrcs. Even the BSD csh manual says to use
|
|
|
|
|
;; "if ($?prompt) exit" before things which are not useful
|
|
|
|
|
;; non-interactively. Besides, if someone wants their other
|
|
|
|
|
;; aliases for shell commands then they can still have them.
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(call-process-shell-command command nil (if error-file
|
|
|
|
|
(list t error-file)
|
|
|
|
|
t))
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(when (and error-file (file-exists-p error-file))
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(when (< 0 (file-attribute-size (file-attributes error-file)))
|
|
|
|
|
(with-current-buffer (get-buffer-create error-buffer)
|
|
|
|
|
(let ((pos-from-end (- (point-max) (point))))
|
|
|
|
|
(or (bobp)
|
|
|
|
|
(insert "\f\n"))
|
|
|
|
|
;; Do no formatting while reading error file,
|
|
|
|
|
;; because that can run a shell command, and we
|
|
|
|
|
;; don't want that to cause an infinite recursion.
|
|
|
|
|
(format-insert-file error-file nil)
|
|
|
|
|
;; Put point after the inserted errors.
|
|
|
|
|
(goto-char (- (point-max) pos-from-end)))
|
|
|
|
|
(display-buffer (current-buffer))))
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(delete-file error-file))
|
|
|
|
|
;; This is like exchange-point-and-mark, but doesn't
|
|
|
|
|
;; activate the mark. It is cleaner to avoid activation,
|
|
|
|
|
;; even though the command loop would deactivate the mark
|
|
|
|
|
;; because we inserted text.
|
|
|
|
|
(goto-char (prog1 (mark t)
|
|
|
|
|
(set-marker (mark-marker) (point)
|
|
|
|
|
(current-buffer)))))
|
2001-12-13 07:43:28 +00:00
|
|
|
|
;; Output goes in a separate buffer.
|
1996-02-21 21:25:30 +00:00
|
|
|
|
;; Preserve the match data in case called from a program.
|
2016-07-14 09:45:05 -04:00
|
|
|
|
;; FIXME: It'd be ridiculous for an Elisp function to call
|
|
|
|
|
;; shell-command and assume that it won't mess the match-data!
|
1996-02-21 21:25:30 +00:00
|
|
|
|
(save-match-data
|
2002-06-26 08:59:32 +00:00
|
|
|
|
(if (string-match "[ \t]*&[ \t]*\\'" command)
|
1996-02-21 21:25:30 +00:00
|
|
|
|
;; Command ending with ampersand means asynchronous.
|
2017-11-03 11:50:13 +02:00
|
|
|
|
(let* ((buffer (get-buffer-create
|
|
|
|
|
(or output-buffer "*Async Shell Command*")))
|
|
|
|
|
(bname (buffer-name buffer))
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(proc (get-buffer-process buffer))
|
|
|
|
|
(directory default-directory))
|
1996-02-21 21:25:30 +00:00
|
|
|
|
;; Remove the ampersand.
|
|
|
|
|
(setq command (substring command 0 (match-beginning 0)))
|
2012-07-29 03:03:26 +03:00
|
|
|
|
;; Ask the user what to do with already running process.
|
|
|
|
|
(when proc
|
|
|
|
|
(cond
|
|
|
|
|
((eq async-shell-command-buffer 'confirm-kill-process)
|
|
|
|
|
;; If will kill a process, query first.
|
|
|
|
|
(if (yes-or-no-p "A command is running in the default buffer. Kill it? ")
|
1996-02-21 21:25:30 +00:00
|
|
|
|
(kill-process proc)
|
|
|
|
|
(error "Shell command in progress")))
|
2012-07-29 03:03:26 +03:00
|
|
|
|
((eq async-shell-command-buffer 'confirm-new-buffer)
|
|
|
|
|
;; If will create a new buffer, query first.
|
|
|
|
|
(if (yes-or-no-p "A command is running in the default buffer. Use a new buffer? ")
|
2017-11-03 11:50:13 +02:00
|
|
|
|
(setq buffer (generate-new-buffer bname))
|
2012-07-29 03:03:26 +03:00
|
|
|
|
(error "Shell command in progress")))
|
|
|
|
|
((eq async-shell-command-buffer 'new-buffer)
|
|
|
|
|
;; It will create a new buffer.
|
2017-11-03 11:50:13 +02:00
|
|
|
|
(setq buffer (generate-new-buffer bname)))
|
2012-07-29 03:03:26 +03:00
|
|
|
|
((eq async-shell-command-buffer 'confirm-rename-buffer)
|
|
|
|
|
;; If will rename the buffer, query first.
|
|
|
|
|
(if (yes-or-no-p "A command is running in the default buffer. Rename it? ")
|
|
|
|
|
(progn
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(rename-uniquely))
|
2017-11-03 11:50:13 +02:00
|
|
|
|
(setq buffer (get-buffer-create bname)))
|
2012-07-29 03:03:26 +03:00
|
|
|
|
(error "Shell command in progress")))
|
|
|
|
|
((eq async-shell-command-buffer 'rename-buffer)
|
|
|
|
|
;; It will rename the buffer.
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(rename-uniquely))
|
2017-11-03 11:50:13 +02:00
|
|
|
|
(setq buffer (get-buffer-create bname)))))
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(with-current-buffer buffer
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(shell-command--save-pos-or-erase)
|
1996-02-21 21:25:30 +00:00
|
|
|
|
(setq default-directory directory)
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(setq proc
|
|
|
|
|
(start-process-shell-command "Shell" buffer command))
|
1996-02-21 21:25:30 +00:00
|
|
|
|
(setq mode-line-process '(":%s"))
|
2003-05-16 21:17:52 +00:00
|
|
|
|
(require 'shell) (shell-mode)
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(set-process-sentinel proc #'shell-command-sentinel)
|
2017-11-03 11:50:13 +02:00
|
|
|
|
;; Use the comint filter for proper handling of
|
|
|
|
|
;; carriage motion (see comint-inhibit-carriage-motion).
|
2018-05-15 01:23:35 +09:00
|
|
|
|
(set-process-filter proc #'comint-output-filter)
|
2017-06-28 22:40:33 +01:00
|
|
|
|
(if async-shell-command-display-buffer
|
2018-02-03 23:22:51 +02:00
|
|
|
|
;; Display buffer immediately.
|
2017-06-28 22:40:33 +01:00
|
|
|
|
(display-buffer buffer '(nil (allow-no-window . t)))
|
2018-02-03 23:22:51 +02:00
|
|
|
|
;; Defer displaying buffer until first process output.
|
|
|
|
|
;; Use disposable named advice so that the buffer is
|
|
|
|
|
;; displayed at most once per process lifetime.
|
|
|
|
|
(let ((nonce (make-symbol "nonce")))
|
|
|
|
|
(add-function :before (process-filter proc)
|
|
|
|
|
(lambda (proc _string)
|
|
|
|
|
(let ((buf (process-buffer proc)))
|
|
|
|
|
(when (buffer-live-p buf)
|
|
|
|
|
(remove-function (process-filter proc)
|
|
|
|
|
nonce)
|
|
|
|
|
(display-buffer buf))))
|
|
|
|
|
`((name . ,nonce)))))))
|
2009-09-10 00:54:36 +00:00
|
|
|
|
;; Otherwise, command is executed synchronously.
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(shell-command-on-region (point) (point) command
|
|
|
|
|
output-buffer nil error-buffer)))))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2015-12-19 13:34:34 +02:00
|
|
|
|
(defun display-message-or-buffer (message &optional buffer-name action frame)
|
2000-10-06 11:35:56 +00:00
|
|
|
|
"Display MESSAGE in the echo area if possible, otherwise in a pop-up buffer.
|
|
|
|
|
MESSAGE may be either a string or a buffer.
|
|
|
|
|
|
2015-12-19 13:34:34 +02:00
|
|
|
|
A pop-up buffer is displayed using `display-buffer' if MESSAGE is too long
|
|
|
|
|
for maximum height of the echo area, as defined by `max-mini-window-height'
|
2000-11-08 17:35:57 +00:00
|
|
|
|
if `resize-mini-windows' is non-nil.
|
2000-10-06 11:35:56 +00:00
|
|
|
|
|
2000-10-08 01:37:42 +00:00
|
|
|
|
Returns either the string shown in the echo area, or when a pop-up
|
|
|
|
|
buffer is used, the window used to display it.
|
|
|
|
|
|
2000-10-06 11:35:56 +00:00
|
|
|
|
If MESSAGE is a string, then the optional argument BUFFER-NAME is the
|
|
|
|
|
name of the buffer used to display it in the case where a pop-up buffer
|
|
|
|
|
is used, defaulting to `*Message*'. In the case where MESSAGE is a
|
|
|
|
|
string and it is displayed in the echo area, it is not specified whether
|
|
|
|
|
the contents are inserted into the buffer anyway.
|
|
|
|
|
|
2015-12-19 13:34:34 +02:00
|
|
|
|
Optional arguments ACTION and FRAME are as for `display-buffer',
|
|
|
|
|
and are only used if a pop-up buffer is displayed."
|
2007-03-19 18:28:31 +00:00
|
|
|
|
(cond ((and (stringp message) (not (string-match "\n" message)))
|
2000-10-06 11:35:56 +00:00
|
|
|
|
;; Trivial case where we can use the echo area
|
|
|
|
|
(message "%s" message))
|
|
|
|
|
((and (stringp message)
|
2007-03-19 18:28:31 +00:00
|
|
|
|
(= (string-match "\n" message) (1- (length message))))
|
2000-10-06 11:35:56 +00:00
|
|
|
|
;; Trivial case where we can just remove single trailing newline
|
|
|
|
|
(message "%s" (substring message 0 (1- (length message)))))
|
|
|
|
|
(t
|
|
|
|
|
;; General case
|
|
|
|
|
(with-current-buffer
|
|
|
|
|
(if (bufferp message)
|
|
|
|
|
message
|
|
|
|
|
(get-buffer-create (or buffer-name "*Message*")))
|
|
|
|
|
|
|
|
|
|
(unless (bufferp message)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert message))
|
|
|
|
|
|
|
|
|
|
(let ((lines
|
|
|
|
|
(if (= (buffer-size) 0)
|
|
|
|
|
0
|
2006-02-04 12:19:27 +00:00
|
|
|
|
(count-screen-lines nil nil nil (minibuffer-window)))))
|
2002-10-26 22:40:31 +00:00
|
|
|
|
(cond ((= lines 0))
|
|
|
|
|
((and (or (<= lines 1)
|
2002-06-26 08:59:32 +00:00
|
|
|
|
(<= lines
|
|
|
|
|
(if resize-mini-windows
|
|
|
|
|
(cond ((floatp max-mini-window-height)
|
|
|
|
|
(* (frame-height)
|
|
|
|
|
max-mini-window-height))
|
|
|
|
|
((integerp max-mini-window-height)
|
|
|
|
|
max-mini-window-height)
|
|
|
|
|
(t
|
|
|
|
|
1))
|
|
|
|
|
1)))
|
|
|
|
|
;; Don't use the echo area if the output buffer is
|
2011-11-17 01:09:20 -08:00
|
|
|
|
;; already displayed in the selected frame.
|
2002-06-29 18:13:06 +00:00
|
|
|
|
(not (get-buffer-window (current-buffer))))
|
2000-10-06 11:35:56 +00:00
|
|
|
|
;; Echo area
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(when (bolp)
|
|
|
|
|
(backward-char 1))
|
|
|
|
|
(message "%s" (buffer-substring (point-min) (point))))
|
|
|
|
|
(t
|
|
|
|
|
;; Buffer
|
|
|
|
|
(goto-char (point-min))
|
2015-12-22 09:19:21 +01:00
|
|
|
|
(display-buffer (current-buffer) action frame))))))))
|
2000-10-06 11:35:56 +00:00
|
|
|
|
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; We have a sentinel to prevent insertion of a termination message
|
2016-08-16 18:18:44 +09:00
|
|
|
|
;; in the buffer itself, and to set the point in the buffer when
|
2016-08-26 15:27:37 +09:00
|
|
|
|
;; `shell-command-dont-erase-buffer' is non-nil.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun shell-command-sentinel (process signal)
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(when (memq (process-status process) '(exit signal))
|
|
|
|
|
(shell-command--set-point-after-cmd (process-buffer process))
|
|
|
|
|
(message "%s: %s."
|
|
|
|
|
(car (cdr (cdr (process-command process))))
|
|
|
|
|
(substring signal 0 -1))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1994-10-15 10:16:09 +00:00
|
|
|
|
(defun shell-command-on-region (start end command
|
1997-08-15 23:41:50 +00:00
|
|
|
|
&optional output-buffer replace
|
2015-11-14 01:28:03 +02:00
|
|
|
|
error-buffer display-error-buffer
|
|
|
|
|
region-noncontiguous-p)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Execute string COMMAND in inferior shell with region as input.
|
|
|
|
|
Normally display output (if any) in temp buffer `*Shell Command Output*';
|
1999-01-23 21:50:18 +00:00
|
|
|
|
Prefix arg means replace the region with it. Return the exit code of
|
|
|
|
|
COMMAND.
|
1995-02-28 18:04:57 +00:00
|
|
|
|
|
1997-08-04 00:51:07 +00:00
|
|
|
|
To specify a coding system for converting non-ASCII characters
|
|
|
|
|
in the input and output to the shell command, use \\[universal-coding-system-argument]
|
|
|
|
|
before this command. By default, the input (from the current buffer)
|
2012-04-09 19:56:35 +03:00
|
|
|
|
is encoded using coding-system specified by `process-coding-system-alist',
|
|
|
|
|
falling back to `default-process-coding-system' if no match for COMMAND
|
|
|
|
|
is found in `process-coding-system-alist'.
|
1997-08-04 00:51:07 +00:00
|
|
|
|
|
2004-08-22 16:59:57 +00:00
|
|
|
|
Noninteractive callers can specify coding systems by binding
|
|
|
|
|
`coding-system-for-read' and `coding-system-for-write'.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2001-12-13 07:43:28 +00:00
|
|
|
|
If the command generates output, the output may be displayed
|
|
|
|
|
in the echo area or in a buffer.
|
|
|
|
|
If the output is short enough to display in the echo area
|
|
|
|
|
\(determined by the variable `max-mini-window-height' if
|
2012-09-22 23:24:26 +08:00
|
|
|
|
`resize-mini-windows' is non-nil), it is shown there.
|
|
|
|
|
Otherwise it is displayed in the buffer `*Shell Command Output*'.
|
|
|
|
|
The output is available in that buffer in both cases.
|
2001-12-13 07:43:28 +00:00
|
|
|
|
|
|
|
|
|
If there is output and an error, a message about the error
|
2016-07-22 14:47:43 +09:00
|
|
|
|
appears at the end of the output.
|
2012-09-22 23:24:26 +08:00
|
|
|
|
|
|
|
|
|
Optional fourth arg OUTPUT-BUFFER specifies where to put the
|
2013-06-18 23:24:44 +03:00
|
|
|
|
command's output. If the value is a buffer or buffer name,
|
2016-08-16 18:18:44 +09:00
|
|
|
|
erase that buffer and insert the output there; a non-nil value of
|
2016-08-26 15:27:37 +09:00
|
|
|
|
`shell-command-dont-erase-buffer' prevent to erase the buffer.
|
2016-07-11 02:47:28 +09:00
|
|
|
|
If the value is nil, use the buffer `*Shell Command Output*'.
|
|
|
|
|
Any other non-nil value means to insert the output in the
|
|
|
|
|
current buffer after START.
|
2012-09-22 23:24:26 +08:00
|
|
|
|
|
|
|
|
|
Optional fifth arg REPLACE, if non-nil, means to insert the
|
|
|
|
|
output in place of text from START to END, putting point and mark
|
1998-10-16 18:07:03 +00:00
|
|
|
|
around it.
|
|
|
|
|
|
2012-09-22 23:24:26 +08:00
|
|
|
|
Optional sixth arg ERROR-BUFFER, if non-nil, specifies a buffer
|
|
|
|
|
or buffer name to which to direct the command's standard error
|
|
|
|
|
output. If nil, error output is mingled with regular output.
|
|
|
|
|
When called interactively, `shell-command-default-error-buffer'
|
|
|
|
|
is used for ERROR-BUFFER.
|
|
|
|
|
|
|
|
|
|
Optional seventh arg DISPLAY-ERROR-BUFFER, if non-nil, means to
|
|
|
|
|
display the error buffer if there were any errors. When called
|
|
|
|
|
interactively, this is t."
|
2002-02-01 04:20:02 +00:00
|
|
|
|
(interactive (let (string)
|
|
|
|
|
(unless (mark)
|
2015-06-23 01:45:33 +03:00
|
|
|
|
(user-error "The mark is not set now, so there is no region"))
|
2002-02-01 04:20:02 +00:00
|
|
|
|
;; Do this before calling region-beginning
|
|
|
|
|
;; and region-end, in case subprocess output
|
|
|
|
|
;; relocates them while we are in the minibuffer.
|
2008-03-20 19:48:07 +00:00
|
|
|
|
(setq string (read-shell-command "Shell command on region: "))
|
1995-11-10 17:33:26 +00:00
|
|
|
|
;; call-interactively recognizes region-beginning and
|
|
|
|
|
;; region-end specially, leaving them in the history.
|
|
|
|
|
(list (region-beginning) (region-end)
|
1995-02-23 05:02:54 +00:00
|
|
|
|
string
|
|
|
|
|
current-prefix-arg
|
1999-01-18 00:25:23 +00:00
|
|
|
|
current-prefix-arg
|
2004-08-22 16:59:57 +00:00
|
|
|
|
shell-command-default-error-buffer
|
2015-11-14 01:28:03 +02:00
|
|
|
|
t
|
|
|
|
|
(region-noncontiguous-p))))
|
1997-08-15 23:41:50 +00:00
|
|
|
|
(let ((error-file
|
1999-09-02 12:05:07 +00:00
|
|
|
|
(if error-buffer
|
1999-10-13 00:48:17 +00:00
|
|
|
|
(make-temp-file
|
1999-09-02 12:05:07 +00:00
|
|
|
|
(expand-file-name "scor"
|
|
|
|
|
(or small-temporary-file-directory
|
|
|
|
|
temporary-file-directory)))
|
1999-01-23 21:50:18 +00:00
|
|
|
|
nil))
|
|
|
|
|
exit-status)
|
2015-11-14 01:28:03 +02:00
|
|
|
|
;; Unless a single contiguous chunk is selected, operate on multiple chunks.
|
|
|
|
|
(if region-noncontiguous-p
|
|
|
|
|
(let ((input (concat (funcall region-extract-function 'delete) "\n"))
|
|
|
|
|
output)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert input)
|
|
|
|
|
(call-process-region (point-min) (point-max)
|
|
|
|
|
shell-file-name t t
|
|
|
|
|
nil shell-command-switch
|
|
|
|
|
command)
|
|
|
|
|
(setq output (split-string (buffer-string) "\n")))
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(funcall region-insert-function output))
|
|
|
|
|
(if (or replace
|
|
|
|
|
(and output-buffer
|
|
|
|
|
(not (or (bufferp output-buffer) (stringp output-buffer)))))
|
|
|
|
|
;; Replace specified region with output from command.
|
|
|
|
|
(let ((swap (and replace (< start end))))
|
|
|
|
|
;; Don't muck with mark unless REPLACE says we should.
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(and replace (push-mark (point) 'nomsg))
|
|
|
|
|
(setq exit-status
|
2016-08-25 22:17:56 +09:00
|
|
|
|
(call-shell-region start end command replace
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(if error-file
|
|
|
|
|
(list t error-file)
|
2016-08-25 22:17:56 +09:00
|
|
|
|
t)))
|
2015-11-14 01:28:03 +02:00
|
|
|
|
;; It is rude to delete a buffer which the command is not using.
|
|
|
|
|
;; (let ((shell-buffer (get-buffer "*Shell Command Output*")))
|
|
|
|
|
;; (and shell-buffer (not (eq shell-buffer (current-buffer)))
|
|
|
|
|
;; (kill-buffer shell-buffer)))
|
|
|
|
|
;; Don't muck with mark unless REPLACE says we should.
|
|
|
|
|
(and replace swap (exchange-point-and-mark)))
|
|
|
|
|
;; No prefix argument: put the output in a temp buffer,
|
|
|
|
|
;; replacing its entire contents.
|
|
|
|
|
(let ((buffer (get-buffer-create
|
|
|
|
|
(or output-buffer "*Shell Command Output*"))))
|
|
|
|
|
(unwind-protect
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(if (and (eq buffer (current-buffer))
|
2016-08-26 15:27:37 +09:00
|
|
|
|
(or (not shell-command-dont-erase-buffer)
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(and (not (eq buffer (get-buffer "*Shell Command Output*")))
|
|
|
|
|
(not (region-active-p)))))
|
2015-11-14 01:28:03 +02:00
|
|
|
|
;; If the input is the same buffer as the output,
|
|
|
|
|
;; delete everything but the specified region,
|
|
|
|
|
;; then replace that region with the output.
|
|
|
|
|
(progn (setq buffer-read-only nil)
|
|
|
|
|
(delete-region (max start end) (point-max))
|
|
|
|
|
(delete-region (point-min) (min start end))
|
|
|
|
|
(setq exit-status
|
|
|
|
|
(call-process-region (point-min) (point-max)
|
|
|
|
|
shell-file-name t
|
|
|
|
|
(if error-file
|
|
|
|
|
(list t error-file)
|
|
|
|
|
t)
|
|
|
|
|
nil shell-command-switch
|
|
|
|
|
command)))
|
|
|
|
|
;; Clear the output buffer, then run the command with
|
|
|
|
|
;; output there.
|
|
|
|
|
(let ((directory default-directory))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(if (not output-buffer)
|
|
|
|
|
(setq default-directory directory))
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(shell-command--save-pos-or-erase)))
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(setq exit-status
|
2016-08-25 22:17:56 +09:00
|
|
|
|
(call-shell-region start end command nil
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(if error-file
|
|
|
|
|
(list buffer error-file)
|
2016-08-25 22:17:56 +09:00
|
|
|
|
buffer))))
|
2015-11-14 01:28:03 +02:00
|
|
|
|
;; Report the output.
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(setq mode-line-process
|
|
|
|
|
(cond ((null exit-status)
|
|
|
|
|
" - Error")
|
|
|
|
|
((stringp exit-status)
|
|
|
|
|
(format " - Signal [%s]" exit-status))
|
|
|
|
|
((not (equal 0 exit-status))
|
|
|
|
|
(format " - Exit [%d]" exit-status)))))
|
|
|
|
|
(if (with-current-buffer buffer (> (point-max) (point-min)))
|
|
|
|
|
;; There's some output, display it
|
2016-08-16 18:18:44 +09:00
|
|
|
|
(progn
|
|
|
|
|
(display-message-or-buffer buffer)
|
|
|
|
|
(shell-command--set-point-after-cmd buffer))
|
|
|
|
|
;; No output; error?
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(let ((output
|
|
|
|
|
(if (and error-file
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-23 18:30:46 -07:00
|
|
|
|
(< 0 (file-attribute-size
|
|
|
|
|
(file-attributes error-file))))
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(format "some error output%s"
|
|
|
|
|
(if shell-command-default-error-buffer
|
|
|
|
|
(format " to the \"%s\" buffer"
|
|
|
|
|
shell-command-default-error-buffer)
|
|
|
|
|
""))
|
|
|
|
|
"no output")))
|
|
|
|
|
(cond ((null exit-status)
|
|
|
|
|
(message "(Shell command failed with error)"))
|
|
|
|
|
((equal 0 exit-status)
|
|
|
|
|
(message "(Shell command succeeded with %s)"
|
|
|
|
|
output))
|
|
|
|
|
((stringp exit-status)
|
|
|
|
|
(message "(Shell command killed by signal %s)"
|
|
|
|
|
exit-status))
|
|
|
|
|
(t
|
|
|
|
|
(message "(Shell command failed with code %d and %s)"
|
|
|
|
|
exit-status output))))
|
|
|
|
|
;; Don't kill: there might be useful info in the undo-log.
|
|
|
|
|
;; (kill-buffer buffer)
|
|
|
|
|
)))))
|
2000-10-06 11:35:56 +00:00
|
|
|
|
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(when (and error-file (file-exists-p error-file))
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-23 18:30:46 -07:00
|
|
|
|
(if (< 0 (file-attribute-size (file-attributes error-file)))
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create error-buffer)
|
|
|
|
|
(let ((pos-from-end (- (point-max) (point))))
|
|
|
|
|
(or (bobp)
|
|
|
|
|
(insert "\f\n"))
|
|
|
|
|
;; Do no formatting while reading error file,
|
|
|
|
|
;; because that can run a shell command, and we
|
|
|
|
|
;; don't want that to cause an infinite recursion.
|
|
|
|
|
(format-insert-file error-file nil)
|
|
|
|
|
;; Put point after the inserted errors.
|
|
|
|
|
(goto-char (- (point-max) pos-from-end)))
|
2004-08-22 16:59:57 +00:00
|
|
|
|
(and display-error-buffer
|
|
|
|
|
(display-buffer (current-buffer)))))
|
1999-03-01 03:19:32 +00:00
|
|
|
|
(delete-file error-file))
|
1999-01-23 21:50:18 +00:00
|
|
|
|
exit-status))
|
1999-11-15 16:11:14 +00:00
|
|
|
|
|
1996-09-24 20:04:48 +00:00
|
|
|
|
(defun shell-command-to-string (command)
|
|
|
|
|
"Execute shell command COMMAND and return its output as a string."
|
|
|
|
|
(with-output-to-string
|
1996-09-24 23:54:08 +00:00
|
|
|
|
(with-current-buffer
|
|
|
|
|
standard-output
|
2018-01-25 15:29:38 +01:00
|
|
|
|
(shell-command command t))))
|
2004-10-23 19:52:18 +00:00
|
|
|
|
|
|
|
|
|
(defun process-file (program &optional infile buffer display &rest args)
|
|
|
|
|
"Process files synchronously in a separate process.
|
|
|
|
|
Similar to `call-process', but may invoke a file handler based on
|
|
|
|
|
`default-directory'. The current working directory of the
|
|
|
|
|
subprocess is `default-directory'.
|
|
|
|
|
|
|
|
|
|
File names in INFILE and BUFFER are handled normally, but file
|
|
|
|
|
names in ARGS should be relative to `default-directory', as they
|
2014-02-21 14:22:14 +01:00
|
|
|
|
are passed to the process verbatim. (This is a difference to
|
2004-10-23 19:52:18 +00:00
|
|
|
|
`call-process' which does not support file handlers for INFILE
|
2014-02-21 14:22:14 +01:00
|
|
|
|
and BUFFER.)
|
2004-10-23 19:52:18 +00:00
|
|
|
|
|
|
|
|
|
Some file handlers might not support all variants, for example
|
|
|
|
|
they might behave as if DISPLAY was nil, regardless of the actual
|
|
|
|
|
value passed."
|
|
|
|
|
(let ((fh (find-file-name-handler default-directory 'process-file))
|
|
|
|
|
lc stderr-file)
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(if fh (apply fh 'process-file program infile buffer display args)
|
2004-10-24 09:06:05 +00:00
|
|
|
|
(when infile (setq lc (file-local-copy infile)))
|
2004-10-23 19:52:18 +00:00
|
|
|
|
(setq stderr-file (when (and (consp buffer) (stringp (cadr buffer)))
|
2004-10-25 08:31:52 +00:00
|
|
|
|
(make-temp-file "emacs")))
|
|
|
|
|
(prog1
|
|
|
|
|
(apply 'call-process program
|
|
|
|
|
(or lc infile)
|
|
|
|
|
(if stderr-file (list (car buffer) stderr-file) buffer)
|
|
|
|
|
display args)
|
2012-12-21 09:10:26 +01:00
|
|
|
|
(when stderr-file (copy-file stderr-file (cadr buffer) t))))
|
2004-10-23 19:52:18 +00:00
|
|
|
|
(when stderr-file (delete-file stderr-file))
|
|
|
|
|
(when lc (delete-file lc)))))
|
|
|
|
|
|
2009-08-25 08:45:41 +00:00
|
|
|
|
(defvar process-file-side-effects t
|
|
|
|
|
"Whether a call of `process-file' changes remote files.
|
|
|
|
|
|
2015-05-21 10:04:45 -07:00
|
|
|
|
By default, this variable is always set to t, meaning that a
|
2009-08-25 08:45:41 +00:00
|
|
|
|
call of `process-file' could potentially change any file on a
|
2015-05-21 10:04:45 -07:00
|
|
|
|
remote host. When set to nil, a file handler could optimize
|
2012-04-14 18:37:16 -07:00
|
|
|
|
its behavior with respect to remote file attribute caching.
|
2009-08-25 08:45:41 +00:00
|
|
|
|
|
2012-04-14 18:37:16 -07:00
|
|
|
|
You should only ever change this variable with a let-binding;
|
|
|
|
|
never with `setq'.")
|
2009-08-25 08:45:41 +00:00
|
|
|
|
|
2007-07-07 11:17:51 +00:00
|
|
|
|
(defun start-file-process (name buffer program &rest program-args)
|
|
|
|
|
"Start a program in a subprocess. Return the process object for it.
|
2008-05-09 17:39:33 +00:00
|
|
|
|
|
2007-07-07 11:17:51 +00:00
|
|
|
|
Similar to `start-process', but may invoke a file handler based on
|
2008-05-09 17:39:33 +00:00
|
|
|
|
`default-directory'. See Info node `(elisp)Magic File Names'.
|
|
|
|
|
|
|
|
|
|
This handler ought to run PROGRAM, perhaps on the local host,
|
|
|
|
|
perhaps on a remote host that corresponds to `default-directory'.
|
|
|
|
|
In the latter case, the local part of `default-directory' becomes
|
|
|
|
|
the working directory of the process.
|
2007-07-07 11:17:51 +00:00
|
|
|
|
|
|
|
|
|
PROGRAM and PROGRAM-ARGS might be file names. They are not
|
2009-10-02 13:27:29 +00:00
|
|
|
|
objects of file handler invocation. File handlers might not
|
|
|
|
|
support pty association, if PROGRAM is nil."
|
2007-07-07 11:17:51 +00:00
|
|
|
|
(let ((fh (find-file-name-handler default-directory 'start-file-process)))
|
|
|
|
|
(if fh (apply fh 'start-file-process name buffer program program-args)
|
|
|
|
|
(apply 'start-process name buffer program program-args))))
|
2011-04-06 17:13:17 -04:00
|
|
|
|
|
|
|
|
|
;;;; Process menu
|
|
|
|
|
|
|
|
|
|
(defvar tabulated-list-format)
|
|
|
|
|
(defvar tabulated-list-entries)
|
|
|
|
|
(defvar tabulated-list-sort-key)
|
|
|
|
|
(declare-function tabulated-list-init-header "tabulated-list" ())
|
2011-05-04 23:35:41 -07:00
|
|
|
|
(declare-function tabulated-list-print "tabulated-list"
|
2015-06-16 20:33:48 -04:00
|
|
|
|
(&optional remember-pos update))
|
2011-04-06 17:13:17 -04:00
|
|
|
|
|
|
|
|
|
(defvar process-menu-query-only nil)
|
|
|
|
|
|
2014-03-26 14:01:47 -07:00
|
|
|
|
(defvar process-menu-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map [?d] 'process-menu-delete-process)
|
|
|
|
|
map))
|
|
|
|
|
|
2011-04-06 17:13:17 -04:00
|
|
|
|
(define-derived-mode process-menu-mode tabulated-list-mode "Process Menu"
|
|
|
|
|
"Major mode for listing the processes called by Emacs."
|
|
|
|
|
(setq tabulated-list-format [("Process" 15 t)
|
2016-06-07 15:06:38 -04:00
|
|
|
|
("PID" 7 t)
|
2011-04-06 17:13:17 -04:00
|
|
|
|
("Status" 7 t)
|
2018-01-18 23:43:38 +02:00
|
|
|
|
;; 25 is the length of the long standard buffer
|
|
|
|
|
;; name "*Async Shell Command*<10>" (bug#30016)
|
|
|
|
|
("Buffer" 25 t)
|
2011-04-06 17:13:17 -04:00
|
|
|
|
("TTY" 12 t)
|
2018-10-16 15:58:45 +02:00
|
|
|
|
("Thread" 12 t)
|
2011-04-06 17:13:17 -04:00
|
|
|
|
("Command" 0 t)])
|
|
|
|
|
(make-local-variable 'process-menu-query-only)
|
|
|
|
|
(setq tabulated-list-sort-key (cons "Process" nil))
|
2017-08-19 16:36:31 +03:00
|
|
|
|
(add-hook 'tabulated-list-revert-hook 'list-processes--refresh nil t))
|
2011-04-06 17:13:17 -04:00
|
|
|
|
|
2014-03-26 14:01:47 -07:00
|
|
|
|
(defun process-menu-delete-process ()
|
|
|
|
|
"Kill process at point in a `list-processes' buffer."
|
|
|
|
|
(interactive)
|
2016-02-23 16:24:52 +11:00
|
|
|
|
(let ((pos (point)))
|
|
|
|
|
(delete-process (tabulated-list-get-id))
|
|
|
|
|
(revert-buffer)
|
|
|
|
|
(goto-char (min pos (point-max)))
|
|
|
|
|
(if (eobp)
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(beginning-of-line))))
|
2014-03-26 14:01:47 -07:00
|
|
|
|
|
2011-04-06 17:13:17 -04:00
|
|
|
|
(defun list-processes--refresh ()
|
2012-02-06 22:40:10 +08:00
|
|
|
|
"Recompute the list of processes for the Process List buffer.
|
|
|
|
|
Also, delete any process that is exited or signaled."
|
2011-04-06 17:13:17 -04:00
|
|
|
|
(setq tabulated-list-entries nil)
|
|
|
|
|
(dolist (p (process-list))
|
2012-02-06 22:40:10 +08:00
|
|
|
|
(cond ((memq (process-status p) '(exit signal closed))
|
|
|
|
|
(delete-process p))
|
|
|
|
|
((or (not process-menu-query-only)
|
|
|
|
|
(process-query-on-exit-flag p))
|
|
|
|
|
(let* ((buf (process-buffer p))
|
|
|
|
|
(type (process-type p))
|
2016-06-07 15:06:38 -04:00
|
|
|
|
(pid (if (process-id p) (format "%d" (process-id p)) "--"))
|
2012-02-06 22:40:10 +08:00
|
|
|
|
(name (process-name p))
|
|
|
|
|
(status (symbol-name (process-status p)))
|
|
|
|
|
(buf-label (if (buffer-live-p buf)
|
|
|
|
|
`(,(buffer-name buf)
|
|
|
|
|
face link
|
Top-level elisp files respect ‘text-quoting-style’
In top-level elisp files, use format-message in diagnostic formats,
so that they follow user preference as per ‘text-quoting-style’
rather than being hard-coded to quote `like this'.
* lisp/allout.el (allout-get-configvar-values):
* lisp/apropos.el (apropos-symbols-internal):
* lisp/dired-aux.el (dired-do-shell-command, dired-create-files)
(dired-do-create-files-regexp, dired-create-files-non-directory):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log, dired-dnd-handle-local-file):
* lisp/disp-table.el (standard-display-european):
* lisp/find-dired.el (find-dired):
* lisp/forms.el (forms-mode):
* lisp/ido.el (ido-buffer-internal):
* lisp/info.el (Info-index-next):
* lisp/outline.el (outline-invent-heading):
* lisp/printing.el (pr-ps-outfile-preprint, pr-i-ps-send):
* lisp/proced.el (proced-log):
* lisp/ps-print.el (ps-print-preprint, ps-get-size):
* lisp/recentf.el (recentf-open-files, recentf-save-list):
* lisp/savehist.el (savehist-save):
* lisp/server.el (server-ensure-safe-dir):
* lisp/ses.el (ses-rename-cell):
* lisp/simple.el (list-processes--refresh):
* lisp/startup.el (command-line):
* lisp/strokes.el (strokes-unset-last-stroke)
(strokes-execute-stroke):
Use format-message so that quotes are restyled.
* lisp/cus-edit.el (custom-raised-buttons, customize-browse):
Don’t quote ‘raised’.
* lisp/descr-text.el (describe-char):
* lisp/dirtrack.el (dirtrack-debug-message):
* lisp/hexl.el (hexl-insert-multibyte-char):
Apply substitute-command-keys to help string.
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
Let dired-log do the formatting.
2015-08-26 01:30:29 -07:00
|
|
|
|
help-echo ,(format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"Visit buffer `%s'"
|
Top-level elisp files respect ‘text-quoting-style’
In top-level elisp files, use format-message in diagnostic formats,
so that they follow user preference as per ‘text-quoting-style’
rather than being hard-coded to quote `like this'.
* lisp/allout.el (allout-get-configvar-values):
* lisp/apropos.el (apropos-symbols-internal):
* lisp/dired-aux.el (dired-do-shell-command, dired-create-files)
(dired-do-create-files-regexp, dired-create-files-non-directory):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log, dired-dnd-handle-local-file):
* lisp/disp-table.el (standard-display-european):
* lisp/find-dired.el (find-dired):
* lisp/forms.el (forms-mode):
* lisp/ido.el (ido-buffer-internal):
* lisp/info.el (Info-index-next):
* lisp/outline.el (outline-invent-heading):
* lisp/printing.el (pr-ps-outfile-preprint, pr-i-ps-send):
* lisp/proced.el (proced-log):
* lisp/ps-print.el (ps-print-preprint, ps-get-size):
* lisp/recentf.el (recentf-open-files, recentf-save-list):
* lisp/savehist.el (savehist-save):
* lisp/server.el (server-ensure-safe-dir):
* lisp/ses.el (ses-rename-cell):
* lisp/simple.el (list-processes--refresh):
* lisp/startup.el (command-line):
* lisp/strokes.el (strokes-unset-last-stroke)
(strokes-execute-stroke):
Use format-message so that quotes are restyled.
* lisp/cus-edit.el (custom-raised-buttons, customize-browse):
Don’t quote ‘raised’.
* lisp/descr-text.el (describe-char):
* lisp/dirtrack.el (dirtrack-debug-message):
* lisp/hexl.el (hexl-insert-multibyte-char):
Apply substitute-command-keys to help string.
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
Let dired-log do the formatting.
2015-08-26 01:30:29 -07:00
|
|
|
|
(buffer-name buf))
|
2012-02-06 22:40:10 +08:00
|
|
|
|
follow-link t
|
|
|
|
|
process-buffer ,buf
|
|
|
|
|
action process-menu-visit-buffer)
|
|
|
|
|
"--"))
|
|
|
|
|
(tty (or (process-tty-name p) "--"))
|
2018-10-16 15:58:45 +02:00
|
|
|
|
(thread
|
|
|
|
|
(cond
|
|
|
|
|
((null (process-thread p)) "--")
|
|
|
|
|
((eq (process-thread p) main-thread) "Main")
|
|
|
|
|
((thread-name (process-thread p)))))
|
2012-02-06 22:40:10 +08:00
|
|
|
|
(cmd
|
|
|
|
|
(if (memq type '(network serial))
|
|
|
|
|
(let ((contact (process-contact p t)))
|
|
|
|
|
(if (eq type 'network)
|
|
|
|
|
(format "(%s %s)"
|
|
|
|
|
(if (plist-get contact :type)
|
|
|
|
|
"datagram"
|
|
|
|
|
"network")
|
|
|
|
|
(if (plist-get contact :server)
|
|
|
|
|
(format "server on %s"
|
2012-08-04 10:08:11 +02:00
|
|
|
|
(or
|
|
|
|
|
(plist-get contact :host)
|
|
|
|
|
(plist-get contact :local)))
|
2012-02-06 22:40:10 +08:00
|
|
|
|
(format "connection to %s"
|
|
|
|
|
(plist-get contact :host))))
|
|
|
|
|
(format "(serial port %s%s)"
|
|
|
|
|
(or (plist-get contact :port) "?")
|
|
|
|
|
(let ((speed (plist-get contact :speed)))
|
|
|
|
|
(if speed
|
|
|
|
|
(format " at %s b/s" speed)
|
|
|
|
|
"")))))
|
|
|
|
|
(mapconcat 'identity (process-command p) " "))))
|
2018-10-16 15:58:45 +02:00
|
|
|
|
(push (list p (vector name pid status buf-label tty thread cmd))
|
2017-08-19 16:36:31 +03:00
|
|
|
|
tabulated-list-entries)))))
|
|
|
|
|
(tabulated-list-init-header))
|
2011-04-06 17:13:17 -04:00
|
|
|
|
|
|
|
|
|
(defun process-menu-visit-buffer (button)
|
|
|
|
|
(display-buffer (button-get button 'process-buffer)))
|
|
|
|
|
|
|
|
|
|
(defun list-processes (&optional query-only buffer)
|
2013-07-26 21:48:05 +03:00
|
|
|
|
"Display a list of all processes that are Emacs sub-processes.
|
2011-04-06 17:13:17 -04:00
|
|
|
|
If optional argument QUERY-ONLY is non-nil, only processes with
|
|
|
|
|
the query-on-exit flag set are listed.
|
|
|
|
|
Any process listed as exited or signaled is actually eliminated
|
|
|
|
|
after the listing is made.
|
|
|
|
|
Optional argument BUFFER specifies a buffer to use, instead of
|
2012-08-04 10:09:24 +02:00
|
|
|
|
\"*Process List*\".
|
2013-07-26 21:48:05 +03:00
|
|
|
|
The return value is always nil.
|
|
|
|
|
|
|
|
|
|
This function lists only processes that were launched by Emacs. To
|
|
|
|
|
see other processes running on the system, use `list-system-processes'."
|
2011-04-06 17:13:17 -04:00
|
|
|
|
(interactive)
|
2011-04-08 20:08:17 +03:00
|
|
|
|
(or (fboundp 'process-list)
|
|
|
|
|
(error "Asynchronous subprocesses are not supported on this system"))
|
2011-04-06 17:13:17 -04:00
|
|
|
|
(unless (bufferp buffer)
|
|
|
|
|
(setq buffer (get-buffer-create "*Process List*")))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(process-menu-mode)
|
|
|
|
|
(setq process-menu-query-only query-only)
|
|
|
|
|
(list-processes--refresh)
|
|
|
|
|
(tabulated-list-print))
|
2011-05-06 03:02:49 +02:00
|
|
|
|
(display-buffer buffer)
|
|
|
|
|
nil)
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
;;;; Prefix commands
|
|
|
|
|
|
|
|
|
|
(setq prefix-command--needs-update nil)
|
|
|
|
|
(setq prefix-command--last-echo nil)
|
|
|
|
|
|
|
|
|
|
(defun internal-echo-keystrokes-prefix ()
|
2015-12-11 11:53:53 +02:00
|
|
|
|
;; BEWARE: Called directly from C code.
|
|
|
|
|
;; If the return value is non-nil, it means we are in the middle of
|
|
|
|
|
;; a command with prefix, such as a command invoked with prefix-arg.
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(if (not prefix-command--needs-update)
|
|
|
|
|
prefix-command--last-echo
|
|
|
|
|
(setq prefix-command--last-echo
|
|
|
|
|
(let ((strs nil))
|
|
|
|
|
(run-hook-wrapped 'prefix-command-echo-keystrokes-functions
|
|
|
|
|
(lambda (fun) (push (funcall fun) strs)))
|
|
|
|
|
(setq strs (delq nil strs))
|
|
|
|
|
(when strs (mapconcat #'identity strs " "))))))
|
|
|
|
|
|
|
|
|
|
(defvar prefix-command-echo-keystrokes-functions nil
|
|
|
|
|
"Abnormal hook which constructs the description of the current prefix state.
|
|
|
|
|
Each function is called with no argument, should return a string or nil.")
|
|
|
|
|
|
|
|
|
|
(defun prefix-command-update ()
|
|
|
|
|
"Update state of prefix commands.
|
|
|
|
|
Call it whenever you change the \"prefix command state\"."
|
|
|
|
|
(setq prefix-command--needs-update t))
|
|
|
|
|
|
|
|
|
|
(defvar prefix-command-preserve-state-hook nil
|
|
|
|
|
"Normal hook run when a command needs to preserve the prefix.")
|
|
|
|
|
|
|
|
|
|
(defun prefix-command-preserve-state ()
|
|
|
|
|
"Pass the current prefix command state to the next command.
|
|
|
|
|
Should be called by all prefix commands.
|
|
|
|
|
Runs `prefix-command-preserve-state-hook'."
|
|
|
|
|
(run-hooks 'prefix-command-preserve-state-hook)
|
|
|
|
|
;; If the current command is a prefix command, we don't want the next (real)
|
|
|
|
|
;; command to have `last-command' set to, say, `universal-argument'.
|
|
|
|
|
(setq this-command last-command)
|
|
|
|
|
(setq real-this-command real-last-command)
|
|
|
|
|
(prefix-command-update))
|
|
|
|
|
|
|
|
|
|
(defun reset-this-command-lengths ()
|
|
|
|
|
(declare (obsolete prefix-command-preserve-state "25.1"))
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
;;;;; The main prefix command.
|
|
|
|
|
|
|
|
|
|
;; FIXME: Declaration of `prefix-arg' should be moved here!?
|
|
|
|
|
|
|
|
|
|
(add-hook 'prefix-command-echo-keystrokes-functions
|
|
|
|
|
#'universal-argument--description)
|
|
|
|
|
(defun universal-argument--description ()
|
|
|
|
|
(when prefix-arg
|
|
|
|
|
(concat "C-u"
|
|
|
|
|
(pcase prefix-arg
|
2018-11-05 01:22:15 +01:00
|
|
|
|
('(-) " -")
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(`(,(and (pred integerp) n))
|
|
|
|
|
(let ((str ""))
|
|
|
|
|
(while (and (> n 4) (= (mod n 4) 0))
|
|
|
|
|
(setq str (concat str " C-u"))
|
|
|
|
|
(setq n (/ n 4)))
|
|
|
|
|
(if (= n 4) str (format " %s" prefix-arg))))
|
|
|
|
|
(_ (format " %s" prefix-arg))))))
|
|
|
|
|
|
|
|
|
|
(add-hook 'prefix-command-preserve-state-hook
|
|
|
|
|
#'universal-argument--preserve)
|
|
|
|
|
(defun universal-argument--preserve ()
|
|
|
|
|
(setq prefix-arg current-prefix-arg))
|
|
|
|
|
|
1996-12-16 00:52:56 +00:00
|
|
|
|
(defvar universal-argument-map
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(let ((map (make-sparse-keymap))
|
|
|
|
|
(universal-argument-minus
|
|
|
|
|
;; For backward compatibility, minus with no modifiers is an ordinary
|
|
|
|
|
;; command if digits have already been entered.
|
|
|
|
|
`(menu-item "" negative-argument
|
|
|
|
|
:filter ,(lambda (cmd)
|
|
|
|
|
(if (integerp prefix-arg) nil cmd)))))
|
|
|
|
|
(define-key map [switch-frame]
|
|
|
|
|
(lambda (e) (interactive "e")
|
|
|
|
|
(handle-switch-frame e) (universal-argument--mode)))
|
1995-06-16 06:14:44 +00:00
|
|
|
|
(define-key map [?\C-u] 'universal-argument-more)
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(define-key map [?-] universal-argument-minus)
|
1995-06-16 06:14:44 +00:00
|
|
|
|
(define-key map [?0] 'digit-argument)
|
|
|
|
|
(define-key map [?1] 'digit-argument)
|
|
|
|
|
(define-key map [?2] 'digit-argument)
|
|
|
|
|
(define-key map [?3] 'digit-argument)
|
|
|
|
|
(define-key map [?4] 'digit-argument)
|
|
|
|
|
(define-key map [?5] 'digit-argument)
|
|
|
|
|
(define-key map [?6] 'digit-argument)
|
|
|
|
|
(define-key map [?7] 'digit-argument)
|
|
|
|
|
(define-key map [?8] 'digit-argument)
|
|
|
|
|
(define-key map [?9] 'digit-argument)
|
2000-07-20 20:35:05 +00:00
|
|
|
|
(define-key map [kp-0] 'digit-argument)
|
|
|
|
|
(define-key map [kp-1] 'digit-argument)
|
|
|
|
|
(define-key map [kp-2] 'digit-argument)
|
|
|
|
|
(define-key map [kp-3] 'digit-argument)
|
|
|
|
|
(define-key map [kp-4] 'digit-argument)
|
|
|
|
|
(define-key map [kp-5] 'digit-argument)
|
|
|
|
|
(define-key map [kp-6] 'digit-argument)
|
|
|
|
|
(define-key map [kp-7] 'digit-argument)
|
|
|
|
|
(define-key map [kp-8] 'digit-argument)
|
|
|
|
|
(define-key map [kp-9] 'digit-argument)
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(define-key map [kp-subtract] universal-argument-minus)
|
1995-06-16 06:14:44 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap used while processing \\[universal-argument].")
|
|
|
|
|
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(defun universal-argument--mode ()
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(prefix-command-update)
|
|
|
|
|
(set-transient-map universal-argument-map nil))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
1995-06-14 22:30:41 +00:00
|
|
|
|
(defun universal-argument ()
|
|
|
|
|
"Begin a numeric argument for the following command.
|
|
|
|
|
Digits or minus sign following \\[universal-argument] make up the numeric argument.
|
|
|
|
|
\\[universal-argument] following the digits or minus sign ends the argument.
|
|
|
|
|
\\[universal-argument] without digits or minus sign provides 4 as argument.
|
|
|
|
|
Repeating \\[universal-argument] without digits or minus sign
|
1996-10-08 21:35:03 +00:00
|
|
|
|
multiplies the argument by 4 each time.
|
|
|
|
|
For some commands, just \\[universal-argument] by itself serves as a flag
|
1996-10-15 03:19:56 +00:00
|
|
|
|
which is different in effect from any particular numeric argument.
|
|
|
|
|
These commands include \\[set-mark-command] and \\[start-kbd-macro]."
|
1995-06-16 06:14:44 +00:00
|
|
|
|
(interactive)
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(prefix-command-preserve-state)
|
1995-06-16 06:14:44 +00:00
|
|
|
|
(setq prefix-arg (list 4))
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(universal-argument--mode))
|
1995-06-14 22:30:41 +00:00
|
|
|
|
|
1995-06-16 06:14:44 +00:00
|
|
|
|
(defun universal-argument-more (arg)
|
2013-09-10 13:13:48 -04:00
|
|
|
|
;; A subsequent C-u means to multiply the factor by 4 if we've typed
|
|
|
|
|
;; nothing but C-u's; otherwise it means to terminate the prefix arg.
|
1995-06-14 22:30:41 +00:00
|
|
|
|
(interactive "P")
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(prefix-command-preserve-state)
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(setq prefix-arg (if (consp arg)
|
|
|
|
|
(list (* 4 (car arg)))
|
|
|
|
|
(if (eq arg '-)
|
|
|
|
|
(list -4)
|
|
|
|
|
arg)))
|
|
|
|
|
(when (consp prefix-arg) (universal-argument--mode)))
|
1995-06-14 22:30:41 +00:00
|
|
|
|
|
|
|
|
|
(defun negative-argument (arg)
|
|
|
|
|
"Begin a negative numeric argument for the next command.
|
|
|
|
|
\\[universal-argument] following digits or minus sign ends the argument."
|
|
|
|
|
(interactive "P")
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(prefix-command-preserve-state)
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(setq prefix-arg (cond ((integerp arg) (- arg))
|
|
|
|
|
((eq arg '-) nil)
|
|
|
|
|
(t '-)))
|
|
|
|
|
(universal-argument--mode))
|
1995-06-16 06:14:44 +00:00
|
|
|
|
|
|
|
|
|
(defun digit-argument (arg)
|
|
|
|
|
"Part of the numeric argument for the next command.
|
|
|
|
|
\\[universal-argument] following digits or minus sign ends the argument."
|
|
|
|
|
(interactive "P")
|
Generalize the prefix-command machinery of C-u
* lisp/simple.el (prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): New hooks.
(internal-echo-keystrokes-prefix): New function.
(prefix-command--needs-update, prefix-command--last-echo): New vars.
(prefix-command-update, prefix-command-preserve): New functions.
(reset-this-command-lengths): New compatibility definition.
(universal-argument--mode): Call prefix-command-update.
(universal-argument, universal-argument-more, negative-argument)
(digit-argument): Call prefix-command-preserve-state.
* src/keyboard.c: Call internal-echo-keystrokes-prefix to build
the "prefix argument" to echo.
(this_command_key_count_reset, before_command_key_count)
(before_command_echo_length): Delete variables.
(echo_add_key): Always add a space.
(echo_char): Remove.
(echo_dash): Don't give up when this_command_key_count is 0, since that
is now the case after a prefix command.
(echo_update): New function, extracted from echo_now.
(echo_now): Use it.
(add_command_key, read_char, record_menu_key): Remove old disabled code.
(command_loop_1): Don't refrain from pushing an undo boundary when
prefix-arg is set. Remove other prefix-arg special case, now handled
directly in the prefix commands instead. But call echo_now if there's
a prefix state to echo.
(read_char, record_menu_key): Use echo_update instead of echo_char.
(read_key_sequence): Use echo_now rather than echo_dash/echo_char.
(Freset_this_command_lengths): Delete function.
(syms_of_keyboard): Define Qinternal_echo_keystrokes_prefix.
(syms_of_keyboard): Don't defsubr Sreset_this_command_lengths.
* lisp/simple.el: Use those new hooks for C-u.
(universal-argument--description): New function.
(prefix-command-echo-keystrokes-functions): Use it.
(universal-argument--preserve): New function.
(prefix-command-preserve-state-hook): Use it.
(command-execute): Call prefix-command-update if needed.
* lisp/kmacro.el (kmacro-step-edit-prefix-commands)
(kmacro-step-edit-prefix-index): Delete variables.
(kmacro-step-edit-query, kmacro-step-edit-insert): Remove ad-hoc
support for prefix arg commands.
(kmacro-step-edit-macro): Don't bind kmacro-step-edit-prefix-index.
* lisp/emulation/cua-base.el (cua--prefix-override-replay)
(cua--shift-control-prefix): Use prefix-command-preserve-state.
Remove now unused arg `arg'.
(cua--prefix-override-handler, cua--prefix-repeat-handler)
(cua--shift-control-c-prefix, cua--shift-control-x-prefix):
Update accordingly.
(cua--prefix-override-timeout): Don't call reset-this-command-lengths
any more.
(cua--keep-active, cua-exchange-point-and-mark): Don't set mark-active
if the mark is not set.
2015-09-01 21:14:18 -04:00
|
|
|
|
(prefix-command-preserve-state)
|
2009-01-09 04:44:15 +00:00
|
|
|
|
(let* ((char (if (integerp last-command-event)
|
|
|
|
|
last-command-event
|
|
|
|
|
(get last-command-event 'ascii-character)))
|
2000-07-20 20:35:05 +00:00
|
|
|
|
(digit (- (logand char ?\177) ?0)))
|
2013-09-10 13:13:48 -04:00
|
|
|
|
(setq prefix-arg (cond ((integerp arg)
|
|
|
|
|
(+ (* arg 10)
|
|
|
|
|
(if (< arg 0) (- digit) digit)))
|
|
|
|
|
((eq arg '-)
|
|
|
|
|
;; Treat -0 as just -, so that -01 will work.
|
|
|
|
|
(if (zerop digit) '- (- digit)))
|
|
|
|
|
(t
|
|
|
|
|
digit))))
|
|
|
|
|
(universal-argument--mode))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2010-05-02 01:56:30 -04:00
|
|
|
|
|
|
|
|
|
(defvar filter-buffer-substring-functions nil
|
2016-09-26 19:02:01 +03:00
|
|
|
|
"This variable is a wrapper hook around `buffer-substring--filter'.
|
|
|
|
|
\(See `with-wrapper-hook' for details about wrapper hooks.)")
|
2013-04-17 20:12:33 -04:00
|
|
|
|
(make-obsolete-variable 'filter-buffer-substring-functions
|
|
|
|
|
'filter-buffer-substring-function "24.4")
|
|
|
|
|
|
|
|
|
|
(defvar filter-buffer-substring-function #'buffer-substring--filter
|
|
|
|
|
"Function to perform the filtering in `filter-buffer-substring'.
|
2014-05-26 18:53:45 -07:00
|
|
|
|
The function is called with the same 3 arguments (BEG END DELETE)
|
|
|
|
|
that `filter-buffer-substring' received. It should return the
|
|
|
|
|
buffer substring between BEG and END, after filtering. If DELETE is
|
|
|
|
|
non-nil, it should delete the text between BEG and END from the buffer.")
|
2010-05-02 01:56:30 -04:00
|
|
|
|
|
2005-03-29 20:53:19 +00:00
|
|
|
|
(defvar buffer-substring-filters nil
|
2014-05-26 18:53:45 -07:00
|
|
|
|
"List of filter functions for `buffer-substring--filter'.
|
|
|
|
|
Each function must accept a single argument, a string, and return a string.
|
|
|
|
|
The buffer substring is passed to the first function in the list,
|
|
|
|
|
and the return value of each function is passed to the next.
|
2012-02-04 11:48:06 -08:00
|
|
|
|
As a special convention, point is set to the start of the buffer text
|
2014-05-26 18:53:45 -07:00
|
|
|
|
being operated on (i.e., the first argument of `buffer-substring--filter')
|
2012-02-04 11:48:06 -08:00
|
|
|
|
before these functions are called.")
|
2010-05-02 01:56:30 -04:00
|
|
|
|
(make-obsolete-variable 'buffer-substring-filters
|
2013-04-17 20:12:33 -04:00
|
|
|
|
'filter-buffer-substring-function "24.1")
|
2005-03-29 20:53:19 +00:00
|
|
|
|
|
2010-05-02 01:56:30 -04:00
|
|
|
|
(defun filter-buffer-substring (beg end &optional delete)
|
2005-03-29 20:53:19 +00:00
|
|
|
|
"Return the buffer substring between BEG and END, after filtering.
|
2014-05-26 18:53:45 -07:00
|
|
|
|
If DELETE is non-nil, delete the text between BEG and END from the buffer.
|
|
|
|
|
|
|
|
|
|
This calls the function that `filter-buffer-substring-function' specifies
|
|
|
|
|
\(passing the same three arguments that it received) to do the work,
|
|
|
|
|
and returns whatever it does. The default function does no filtering,
|
|
|
|
|
unless a hook has been set.
|
|
|
|
|
|
|
|
|
|
Use `filter-buffer-substring' instead of `buffer-substring',
|
|
|
|
|
`buffer-substring-no-properties', or `delete-and-extract-region' when
|
|
|
|
|
you want to allow filtering to take place. For example, major or minor
|
2018-10-27 15:27:45 -04:00
|
|
|
|
modes can use `filter-buffer-substring-function' to exclude text properties
|
2014-05-26 18:53:45 -07:00
|
|
|
|
that are special to a buffer, and should not be copied into other buffers."
|
2013-04-17 20:12:33 -04:00
|
|
|
|
(funcall filter-buffer-substring-function beg end delete))
|
|
|
|
|
|
|
|
|
|
(defun buffer-substring--filter (beg end &optional delete)
|
2014-05-26 18:53:45 -07:00
|
|
|
|
"Default function to use for `filter-buffer-substring-function'.
|
|
|
|
|
Its arguments and return value are as specified for `filter-buffer-substring'.
|
2016-09-26 19:02:01 +03:00
|
|
|
|
Also respects the obsolete wrapper hook `filter-buffer-substring-functions'
|
|
|
|
|
\(see `with-wrapper-hook' for details about wrapper hooks),
|
2014-05-26 18:53:45 -07:00
|
|
|
|
and the abnormal hook `buffer-substring-filters'.
|
|
|
|
|
No filtering is done unless a hook says to."
|
2016-05-18 00:12:01 -07:00
|
|
|
|
(subr--with-wrapper-hook-no-warnings
|
|
|
|
|
filter-buffer-substring-functions (beg end delete)
|
2010-05-02 01:56:30 -04:00
|
|
|
|
(cond
|
|
|
|
|
((or delete buffer-substring-filters)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(let ((string (if delete (delete-and-extract-region beg end)
|
|
|
|
|
(buffer-substring beg end))))
|
|
|
|
|
(dolist (filter buffer-substring-filters)
|
|
|
|
|
(setq string (funcall filter string)))
|
|
|
|
|
string)))
|
|
|
|
|
(t
|
|
|
|
|
(buffer-substring beg end)))))
|
2006-04-09 23:03:48 +00:00
|
|
|
|
|
2005-03-29 20:53:19 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
;;;; Window system cut and paste hooks.
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-01 23:19:32 -04:00
|
|
|
|
(defvar interprogram-cut-function #'gui-select-text
|
1992-06-12 22:23:00 +00:00
|
|
|
|
"Function to call to make a killed region available to other programs.
|
2012-07-07 17:33:28 +08:00
|
|
|
|
Most window systems provide a facility for cutting and pasting
|
|
|
|
|
text between different programs, such as the clipboard on X and
|
|
|
|
|
MS-Windows, or the pasteboard on Nextstep/Mac OS.
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
2012-07-07 17:33:28 +08:00
|
|
|
|
This variable holds a function that Emacs calls whenever text is
|
|
|
|
|
put in the kill ring, to make the new kill available to other
|
|
|
|
|
programs. The function takes one argument, TEXT, which is a
|
|
|
|
|
string containing the text which should be made available.")
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
2014-10-02 21:39:49 -04:00
|
|
|
|
(defvar interprogram-paste-function #'gui-selection-value
|
1992-06-12 22:23:00 +00:00
|
|
|
|
"Function to call to get text cut from other programs.
|
2012-07-07 17:33:28 +08:00
|
|
|
|
Most window systems provide a facility for cutting and pasting
|
|
|
|
|
text between different programs, such as the clipboard on X and
|
|
|
|
|
MS-Windows, or the pasteboard on Nextstep/Mac OS.
|
|
|
|
|
|
|
|
|
|
This variable holds a function that Emacs calls to obtain text
|
|
|
|
|
that other programs have provided for pasting. The function is
|
|
|
|
|
called with no arguments. If no other program has provided text
|
|
|
|
|
to paste, the function should return nil (in which case the
|
|
|
|
|
caller, usually `current-kill', should use the top of the Emacs
|
|
|
|
|
kill ring). If another program has provided text to paste, the
|
|
|
|
|
function should return that text as a string (in which case the
|
|
|
|
|
caller should put this string in the kill ring as the latest
|
|
|
|
|
kill).
|
|
|
|
|
|
|
|
|
|
The function may also return a list of strings if the window
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
system supports multiple selections. The first string will be
|
2012-07-07 17:33:28 +08:00
|
|
|
|
used as the pasted text, but the other will be placed in the kill
|
|
|
|
|
ring for easy access via `yank-pop'.
|
|
|
|
|
|
|
|
|
|
Note that the function should return a string only if a program
|
|
|
|
|
other than Emacs has provided a string for pasting; if Emacs
|
|
|
|
|
provided the most recent string, the function should return nil.
|
|
|
|
|
If it is difficult to tell whether Emacs or some other program
|
|
|
|
|
provided the current string, it is probably good enough to return
|
|
|
|
|
nil if the string is equal (according to `string=') to the last
|
|
|
|
|
text Emacs provided.")
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1992-06-12 22:23:00 +00:00
|
|
|
|
;;;; The kill ring data structure.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defvar kill-ring nil
|
1992-06-12 22:23:00 +00:00
|
|
|
|
"List of killed text sequences.
|
|
|
|
|
Since the kill ring is supposed to interact nicely with cut-and-paste
|
|
|
|
|
facilities offered by window systems, use of this variable should
|
|
|
|
|
interact nicely with `interprogram-cut-function' and
|
|
|
|
|
`interprogram-paste-function'. The functions `kill-new',
|
|
|
|
|
`kill-append', and `current-kill' are supposed to implement this
|
|
|
|
|
interaction; you may want to use them instead of manipulating the kill
|
|
|
|
|
ring directly.")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1998-10-19 18:26:28 +00:00
|
|
|
|
(defcustom kill-ring-max 60
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Maximum length of kill ring before oldest elements are thrown away."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'killing)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defvar kill-ring-yank-pointer nil
|
|
|
|
|
"The tail of the kill ring whose car is the last thing yanked.")
|
|
|
|
|
|
2009-08-26 20:55:39 +00:00
|
|
|
|
(defcustom save-interprogram-paste-before-kill nil
|
2018-04-18 18:35:38 +01:00
|
|
|
|
"Save existing clipboard text into kill ring before replacing it.
|
|
|
|
|
A non-nil value ensures that Emacs kill operations do not
|
|
|
|
|
irrevocably overwrite existing clipboard text by saving it to the
|
|
|
|
|
`kill-ring' prior to the kill. Such text can subsequently be
|
2018-09-25 21:29:29 +02:00
|
|
|
|
retrieved via \\[yank] \\[yank-pop]."
|
2009-08-26 20:55:39 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'killing
|
|
|
|
|
:version "23.2")
|
|
|
|
|
|
2009-08-27 14:56:17 +00:00
|
|
|
|
(defcustom kill-do-not-save-duplicates nil
|
2012-03-13 02:21:35 +08:00
|
|
|
|
"Do not add a new string to `kill-ring' if it duplicates the last one.
|
|
|
|
|
The comparison is done using `equal-including-properties'."
|
2009-08-27 14:56:17 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'killing
|
|
|
|
|
:version "23.2")
|
|
|
|
|
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(defun kill-new (string &optional replace)
|
1992-06-12 22:23:00 +00:00
|
|
|
|
"Make STRING the latest kill in the kill ring.
|
2002-03-31 16:28:07 +00:00
|
|
|
|
Set `kill-ring-yank-pointer' to point to it.
|
1994-09-15 21:30:21 +00:00
|
|
|
|
If `interprogram-cut-function' is non-nil, apply it to STRING.
|
|
|
|
|
Optional second argument REPLACE non-nil means that STRING will replace
|
2003-01-18 23:34:14 +00:00
|
|
|
|
the front of the kill ring, rather than being added to the list.
|
|
|
|
|
|
2009-08-26 20:55:39 +00:00
|
|
|
|
When `save-interprogram-paste-before-kill' and `interprogram-paste-function'
|
2018-04-18 18:35:38 +01:00
|
|
|
|
are non-nil, save the interprogram paste string(s) into `kill-ring' before
|
2009-08-26 20:55:39 +00:00
|
|
|
|
STRING.
|
|
|
|
|
|
2003-01-27 21:44:48 +00:00
|
|
|
|
When the yank handler has a non-nil PARAM element, the original STRING
|
|
|
|
|
argument is not used by `insert-for-yank'. However, since Lisp code
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
may access and use elements from the kill ring directly, the STRING
|
2003-01-27 21:44:48 +00:00
|
|
|
|
argument should still be a \"useful\" string for such uses."
|
2010-06-04 21:38:11 +03:00
|
|
|
|
(unless (and kill-do-not-save-duplicates
|
2012-03-13 02:21:35 +08:00
|
|
|
|
;; Due to text properties such as 'yank-handler that
|
|
|
|
|
;; can alter the contents to yank, comparison using
|
|
|
|
|
;; `equal' is unsafe.
|
|
|
|
|
(equal-including-properties string (car kill-ring)))
|
2010-06-04 21:38:11 +03:00
|
|
|
|
(if (fboundp 'menu-bar-update-yank-menu)
|
|
|
|
|
(menu-bar-update-yank-menu string (and replace (car kill-ring)))))
|
2009-08-26 20:55:39 +00:00
|
|
|
|
(when save-interprogram-paste-before-kill
|
|
|
|
|
(let ((interprogram-paste (and interprogram-paste-function
|
|
|
|
|
(funcall interprogram-paste-function))))
|
|
|
|
|
(when interprogram-paste
|
2010-06-04 21:38:11 +03:00
|
|
|
|
(dolist (s (if (listp interprogram-paste)
|
2018-04-13 12:47:30 +01:00
|
|
|
|
;; Use `reverse' to avoid modifying external data.
|
|
|
|
|
(reverse interprogram-paste)
|
2010-06-04 21:38:11 +03:00
|
|
|
|
(list interprogram-paste)))
|
|
|
|
|
(unless (and kill-do-not-save-duplicates
|
2012-03-13 02:21:35 +08:00
|
|
|
|
(equal-including-properties s (car kill-ring)))
|
2010-06-04 21:38:11 +03:00
|
|
|
|
(push s kill-ring))))))
|
|
|
|
|
(unless (and kill-do-not-save-duplicates
|
2012-03-13 02:21:35 +08:00
|
|
|
|
(equal-including-properties string (car kill-ring)))
|
2010-06-04 21:38:11 +03:00
|
|
|
|
(if (and replace kill-ring)
|
|
|
|
|
(setcar kill-ring string)
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(let ((history-delete-duplicates nil))
|
|
|
|
|
(add-to-history 'kill-ring string kill-ring-max t))))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(setq kill-ring-yank-pointer kill-ring)
|
|
|
|
|
(if interprogram-cut-function
|
2010-09-02 12:54:43 +02:00
|
|
|
|
(funcall interprogram-cut-function string)))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
2018-04-18 18:35:38 +01:00
|
|
|
|
;; It has been argued that this should work like `self-insert-command'
|
|
|
|
|
;; which merges insertions in `buffer-undo-list' in groups of 20
|
|
|
|
|
;; (hard-coded in `undo-auto-amalgamate').
|
2014-06-23 16:23:33 -04:00
|
|
|
|
(defcustom kill-append-merge-undo nil
|
2018-04-18 18:35:38 +01:00
|
|
|
|
"Amalgamate appending kills with the last kill for undo.
|
|
|
|
|
When non-nil, appending or prepending text to the last kill makes
|
|
|
|
|
\\[undo] restore both pieces of text simultaneously."
|
2014-06-23 16:23:33 -04:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'killing
|
2014-09-29 14:14:08 -04:00
|
|
|
|
:version "25.1")
|
2014-06-23 16:23:33 -04:00
|
|
|
|
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(defun kill-append (string before-p)
|
1992-06-12 22:23:00 +00:00
|
|
|
|
"Append STRING to the end of the latest kill in the kill ring.
|
2018-04-18 18:35:38 +01:00
|
|
|
|
If BEFORE-P is non-nil, prepend STRING to the kill instead.
|
|
|
|
|
If `interprogram-cut-function' is non-nil, call it with the
|
|
|
|
|
resulting kill.
|
|
|
|
|
If `kill-append-merge-undo' is non-nil, remove the last undo
|
|
|
|
|
boundary in the current buffer."
|
2018-04-30 00:58:32 +01:00
|
|
|
|
(let ((cur (car kill-ring)))
|
2003-01-18 23:34:14 +00:00
|
|
|
|
(kill-new (if before-p (concat string cur) (concat cur string))
|
2018-04-30 00:58:32 +01:00
|
|
|
|
(or (string= cur "")
|
|
|
|
|
(null (get-text-property 0 'yank-handler cur)))))
|
|
|
|
|
(when (and kill-append-merge-undo (not buffer-read-only))
|
|
|
|
|
(let ((prev buffer-undo-list)
|
|
|
|
|
(next (cdr buffer-undo-list)))
|
|
|
|
|
;; Find the next undo boundary.
|
|
|
|
|
(while (car next)
|
|
|
|
|
(pop next)
|
|
|
|
|
(pop prev))
|
|
|
|
|
;; Remove this undo boundary.
|
|
|
|
|
(when prev
|
|
|
|
|
(setcdr prev (cdr next))))))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
2007-12-25 20:19:13 +00:00
|
|
|
|
(defcustom yank-pop-change-selection nil
|
2012-07-07 17:33:28 +08:00
|
|
|
|
"Whether rotating the kill ring changes the window system selection.
|
|
|
|
|
If non-nil, whenever the kill ring is rotated (usually via the
|
|
|
|
|
`yank-pop' command), Emacs also calls `interprogram-cut-function'
|
|
|
|
|
to copy the new kill to the window system selection."
|
2007-12-25 20:19:13 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'killing
|
|
|
|
|
:version "23.1")
|
|
|
|
|
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(defun current-kill (n &optional do-not-move)
|
|
|
|
|
"Rotate the yanking point by N places, and then return that kill.
|
2011-07-16 20:39:01 +02:00
|
|
|
|
If N is zero and `interprogram-paste-function' is set to a
|
|
|
|
|
function that returns a string or a list of strings, and if that
|
|
|
|
|
function doesn't return nil, then that string (or list) is added
|
|
|
|
|
to the front of the kill ring and the string (or first string in
|
|
|
|
|
the list) is returned as the latest kill.
|
2007-12-25 20:19:13 +00:00
|
|
|
|
|
|
|
|
|
If N is not zero, and if `yank-pop-change-selection' is
|
|
|
|
|
non-nil, use `interprogram-cut-function' to transfer the
|
|
|
|
|
kill at the new yank point into the window system selection.
|
|
|
|
|
|
|
|
|
|
If optional arg DO-NOT-MOVE is non-nil, then don't actually
|
|
|
|
|
move the yanking point; just return the Nth kill forward."
|
|
|
|
|
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(let ((interprogram-paste (and (= n 0)
|
|
|
|
|
interprogram-paste-function
|
|
|
|
|
(funcall interprogram-paste-function))))
|
|
|
|
|
(if interprogram-paste
|
|
|
|
|
(progn
|
|
|
|
|
;; Disable the interprogram cut function when we add the new
|
|
|
|
|
;; text to the kill ring, so Emacs doesn't try to own the
|
|
|
|
|
;; selection, with identical text.
|
2018-04-12 17:46:37 +01:00
|
|
|
|
;; Also disable the interprogram paste function, so that
|
|
|
|
|
;; `kill-new' doesn't call it repeatedly.
|
|
|
|
|
(let ((interprogram-cut-function nil)
|
|
|
|
|
(interprogram-paste-function nil))
|
2007-10-18 04:52:15 +00:00
|
|
|
|
(if (listp interprogram-paste)
|
2018-04-13 12:47:30 +01:00
|
|
|
|
;; Use `reverse' to avoid modifying external data.
|
|
|
|
|
(mapc #'kill-new (reverse interprogram-paste))
|
2007-10-18 04:52:15 +00:00
|
|
|
|
(kill-new interprogram-paste)))
|
|
|
|
|
(car kill-ring))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(or kill-ring (error "Kill ring is empty"))
|
1993-08-10 04:14:17 +00:00
|
|
|
|
(let ((ARGth-kill-element
|
|
|
|
|
(nthcdr (mod (- n (length kill-ring-yank-pointer))
|
|
|
|
|
(length kill-ring))
|
|
|
|
|
kill-ring)))
|
2007-12-25 20:19:13 +00:00
|
|
|
|
(unless do-not-move
|
|
|
|
|
(setq kill-ring-yank-pointer ARGth-kill-element)
|
|
|
|
|
(when (and yank-pop-change-selection
|
|
|
|
|
(> n 0)
|
|
|
|
|
interprogram-cut-function)
|
|
|
|
|
(funcall interprogram-cut-function (car ARGth-kill-element))))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(car ARGth-kill-element)))))
|
1992-05-30 21:11:25 +00:00
|
|
|
|
|
|
|
|
|
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1992-06-12 22:23:00 +00:00
|
|
|
|
;;;; Commands for manipulating the kill ring.
|
1992-05-30 21:11:25 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom kill-read-only-ok nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Non-nil means don't signal an error for killing read-only text."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'killing)
|
1994-04-24 05:44:23 +00:00
|
|
|
|
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(defun kill-region (beg end &optional region)
|
2006-03-11 15:09:48 +00:00
|
|
|
|
"Kill (\"cut\") text between point and mark.
|
|
|
|
|
This deletes the text from the buffer and saves it in the kill ring.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
The command \\[yank] can retrieve it from there.
|
2008-05-28 17:36:04 +00:00
|
|
|
|
\(If you want to save the region without killing it, use \\[kill-ring-save].)
|
2001-02-16 12:09:39 +00:00
|
|
|
|
|
|
|
|
|
If you want to append the killed region to the last killed text,
|
|
|
|
|
use \\[append-next-kill] before \\[kill-region].
|
|
|
|
|
|
2015-12-07 18:20:43 +02:00
|
|
|
|
Any command that calls this function is a \"kill command\".
|
|
|
|
|
If the previous command was also a kill command,
|
|
|
|
|
the text killed this time appends to the text killed last time
|
|
|
|
|
to make one entry in the kill ring.
|
|
|
|
|
|
|
|
|
|
The killed text is filtered by `filter-buffer-substring' before it is
|
|
|
|
|
saved in the kill ring, so the actual saved text might be different
|
|
|
|
|
from what was killed.
|
|
|
|
|
|
1993-02-01 22:31:17 +00:00
|
|
|
|
If the buffer is read-only, Emacs will beep and refrain from deleting
|
|
|
|
|
the text, but put the text in the kill ring anyway. This means that
|
|
|
|
|
you can use the killing commands to copy text from a read-only buffer.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2010-08-14 19:21:40 -04:00
|
|
|
|
Lisp programs should use this function for killing text.
|
|
|
|
|
(To delete text, use `delete-region'.)
|
2015-12-07 18:20:43 +02:00
|
|
|
|
Supply two arguments, character positions BEG and END indicating the
|
|
|
|
|
stretch of text to be killed. If the optional argument REGION is
|
|
|
|
|
non-nil, the function ignores BEG and END, and kills the current
|
|
|
|
|
region instead."
|
2013-12-17 23:48:26 +08:00
|
|
|
|
;; Pass mark first, then point, because the order matters when
|
|
|
|
|
;; calling `kill-append'.
|
|
|
|
|
(interactive (list (mark) (point) 'region))
|
2006-09-04 15:03:26 +00:00
|
|
|
|
(unless (and beg end)
|
2015-06-12 02:17:23 +03:00
|
|
|
|
(user-error "The mark is not set now, so there is no region"))
|
1997-11-19 21:36:56 +00:00
|
|
|
|
(condition-case nil
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(let ((string (if region
|
|
|
|
|
(funcall region-extract-function 'delete)
|
|
|
|
|
(filter-buffer-substring beg end 'delete))))
|
1999-12-07 06:30:44 +00:00
|
|
|
|
(when string ;STRING is nil if BEG = END
|
|
|
|
|
;; Add that string to the kill ring, one way or another.
|
|
|
|
|
(if (eq last-command 'kill-region)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(kill-append string (< end beg))
|
2014-06-13 11:50:38 -04:00
|
|
|
|
(kill-new string)))
|
2003-05-28 20:07:10 +00:00
|
|
|
|
(when (or string (eq last-command 'kill-region))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(setq this-command 'kill-region))
|
2012-12-21 11:49:28 +08:00
|
|
|
|
(setq deactivate-mark t)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
nil)
|
1997-11-19 21:36:56 +00:00
|
|
|
|
((buffer-read-only text-read-only)
|
|
|
|
|
;; The code above failed because the buffer, or some of the characters
|
|
|
|
|
;; in the region, are read-only.
|
|
|
|
|
;; We should beep, in case the user just isn't aware of this.
|
|
|
|
|
;; However, there's no harm in putting
|
|
|
|
|
;; the region's text in the kill ring, anyway.
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(copy-region-as-kill beg end region)
|
1998-05-19 05:22:50 +00:00
|
|
|
|
;; Set this-command now, so it will be set even if we get an error.
|
|
|
|
|
(setq this-command 'kill-region)
|
|
|
|
|
;; This should barf, if appropriate, and give us the correct error.
|
1997-11-19 21:36:56 +00:00
|
|
|
|
(if kill-read-only-ok
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(progn (message "Read only text copied to kill ring") nil)
|
1997-11-19 21:36:56 +00:00
|
|
|
|
;; Signal an error if the buffer is read-only.
|
|
|
|
|
(barf-if-buffer-read-only)
|
|
|
|
|
;; If the buffer isn't read-only, the text is.
|
|
|
|
|
(signal 'text-read-only (list (current-buffer)))))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1994-11-09 22:10:55 +00:00
|
|
|
|
;; copy-region-as-kill no longer sets this-command, because it's confusing
|
|
|
|
|
;; to get two copies of the text when the user accidentally types M-w and
|
|
|
|
|
;; then corrects it with the intended C-w.
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(defun copy-region-as-kill (beg end &optional region)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Save the region as if killed, but don't kill it.
|
1997-12-21 01:52:31 +00:00
|
|
|
|
In Transient Mark mode, deactivate the mark.
|
1992-04-19 08:53:55 +00:00
|
|
|
|
If `interprogram-cut-function' is non-nil, also save the text for a window
|
2007-09-23 15:22:47 +00:00
|
|
|
|
system cut and paste.
|
|
|
|
|
|
2015-12-07 18:20:43 +02:00
|
|
|
|
The copied text is filtered by `filter-buffer-substring' before it is
|
|
|
|
|
saved in the kill ring, so the actual saved text might be different
|
|
|
|
|
from what was in the buffer.
|
|
|
|
|
|
|
|
|
|
When called from Lisp, save in the kill ring the stretch of text
|
|
|
|
|
between BEG and END, unless the optional argument REGION is
|
|
|
|
|
non-nil, in which case ignore BEG and END, and save the current
|
|
|
|
|
region instead.
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
|
2013-08-16 16:27:49 +08:00
|
|
|
|
This command's old key binding has been given to `kill-ring-save'."
|
2013-12-17 23:48:26 +08:00
|
|
|
|
;; Pass mark first, then point, because the order matters when
|
|
|
|
|
;; calling `kill-append'.
|
|
|
|
|
(interactive (list (mark) (point)
|
|
|
|
|
(prefix-numeric-value current-prefix-arg)))
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(let ((str (if region
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-29 22:45:53 -04:00
|
|
|
|
(funcall region-extract-function nil)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(filter-buffer-substring beg end))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (eq last-command 'kill-region)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(kill-append str (< end beg))
|
|
|
|
|
(kill-new str)))
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(setq deactivate-mark t)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(defun kill-ring-save (beg end &optional region)
|
1993-03-11 07:07:17 +00:00
|
|
|
|
"Save the region as if killed, but don't kill it.
|
1997-12-21 01:52:31 +00:00
|
|
|
|
In Transient Mark mode, deactivate the mark.
|
1993-03-11 07:07:17 +00:00
|
|
|
|
If `interprogram-cut-function' is non-nil, also save the text for a window
|
1997-12-21 01:52:31 +00:00
|
|
|
|
system cut and paste.
|
|
|
|
|
|
2001-02-16 12:09:39 +00:00
|
|
|
|
If you want to append the killed line to the last killed text,
|
|
|
|
|
use \\[append-next-kill] before \\[kill-ring-save].
|
|
|
|
|
|
2015-12-07 18:20:43 +02:00
|
|
|
|
The copied text is filtered by `filter-buffer-substring' before it is
|
|
|
|
|
saved in the kill ring, so the actual saved text might be different
|
|
|
|
|
from what was in the buffer.
|
|
|
|
|
|
|
|
|
|
When called from Lisp, save in the kill ring the stretch of text
|
|
|
|
|
between BEG and END, unless the optional argument REGION is
|
|
|
|
|
non-nil, in which case ignore BEG and END, and save the current
|
|
|
|
|
region instead.
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
|
1997-12-21 01:52:31 +00:00
|
|
|
|
This command is similar to `copy-region-as-kill', except that it gives
|
2013-08-16 16:27:49 +08:00
|
|
|
|
visual feedback indicating the extent of the region being copied."
|
2013-12-17 23:48:26 +08:00
|
|
|
|
;; Pass mark first, then point, because the order matters when
|
|
|
|
|
;; calling `kill-append'.
|
|
|
|
|
(interactive (list (mark) (point)
|
|
|
|
|
(prefix-numeric-value current-prefix-arg)))
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(copy-region-as-kill beg end region)
|
2012-07-29 12:45:48 +08:00
|
|
|
|
;; This use of called-interactively-p is correct because the code it
|
|
|
|
|
;; controls just gives the user visual feedback.
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2012-07-29 12:45:48 +08:00
|
|
|
|
(indicate-copied-region)))
|
|
|
|
|
|
|
|
|
|
(defun indicate-copied-region (&optional message-len)
|
|
|
|
|
"Indicate that the region text has been copied interactively.
|
|
|
|
|
If the mark is visible in the selected window, blink the cursor
|
|
|
|
|
between point and mark if there is currently no active region
|
|
|
|
|
highlighting.
|
|
|
|
|
|
|
|
|
|
If the mark lies outside the selected window, display an
|
|
|
|
|
informative message containing a sample of the copied text. The
|
|
|
|
|
optional argument MESSAGE-LEN, if non-nil, specifies the length
|
|
|
|
|
of this sample text; it defaults to 40."
|
|
|
|
|
(let ((mark (mark t))
|
|
|
|
|
(point (point))
|
|
|
|
|
;; Inhibit quitting so we can make a quit here
|
|
|
|
|
;; look like a C-g typed as a command.
|
|
|
|
|
(inhibit-quit t))
|
|
|
|
|
(if (pos-visible-in-window-p mark (selected-window))
|
|
|
|
|
;; Swap point-and-mark quickly so as to show the region that
|
|
|
|
|
;; was selected. Don't do it if the region is highlighted.
|
|
|
|
|
(unless (and (region-active-p)
|
|
|
|
|
(face-background 'region))
|
|
|
|
|
;; Swap point and mark.
|
|
|
|
|
(set-marker (mark-marker) (point) (current-buffer))
|
|
|
|
|
(goto-char mark)
|
|
|
|
|
(sit-for blink-matching-delay)
|
|
|
|
|
;; Swap back.
|
|
|
|
|
(set-marker (mark-marker) mark (current-buffer))
|
|
|
|
|
(goto-char point)
|
|
|
|
|
;; If user quit, deactivate the mark
|
|
|
|
|
;; as C-g would as a command.
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(and quit-flag (region-active-p)
|
2012-07-29 12:45:48 +08:00
|
|
|
|
(deactivate-mark)))
|
|
|
|
|
(let ((len (min (abs (- mark point))
|
|
|
|
|
(or message-len 40))))
|
|
|
|
|
(if (< point mark)
|
|
|
|
|
;; Don't say "killed"; that is misleading.
|
|
|
|
|
(message "Saved text until \"%s\""
|
|
|
|
|
(buffer-substring-no-properties (- mark len) mark))
|
|
|
|
|
(message "Saved text from \"%s\""
|
|
|
|
|
(buffer-substring-no-properties mark (+ mark len))))))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1999-05-31 18:06:22 +00:00
|
|
|
|
(defun append-next-kill (&optional interactive)
|
2013-12-18 10:43:47 +08:00
|
|
|
|
"Cause following command, if it kills, to add to previous kill.
|
|
|
|
|
If the next command kills forward from point, the kill is
|
|
|
|
|
appended to the previous killed text. If the command kills
|
|
|
|
|
backward, the kill is prepended. Kill commands that act on the
|
|
|
|
|
region, such as `kill-region', are regarded as killing forward if
|
|
|
|
|
point is after mark, and killing backward if point is before
|
|
|
|
|
mark.
|
|
|
|
|
|
|
|
|
|
If the next command is not a kill command, `append-next-kill' has
|
|
|
|
|
no effect.
|
|
|
|
|
|
1999-05-31 18:06:22 +00:00
|
|
|
|
The argument is used for internal purposes; do not supply one."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
;; We don't use (interactive-p), since that breaks kbd macros.
|
|
|
|
|
(if interactive
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(progn
|
|
|
|
|
(setq this-command 'kill-region)
|
|
|
|
|
(message "If the next command is a kill, it will append"))
|
|
|
|
|
(setq last-command 'kill-region)))
|
2014-12-04 11:31:33 +02:00
|
|
|
|
|
|
|
|
|
(defvar bidi-directional-controls-chars "\x202a-\x202e\x2066-\x2069"
|
|
|
|
|
"Character set that matches bidirectional formatting control characters.")
|
|
|
|
|
|
|
|
|
|
(defvar bidi-directional-non-controls-chars "^\x202a-\x202e\x2066-\x2069"
|
|
|
|
|
"Character set that matches any character except bidirectional controls.")
|
|
|
|
|
|
|
|
|
|
(defun squeeze-bidi-context-1 (from to category replacement)
|
|
|
|
|
"A subroutine of `squeeze-bidi-context'.
|
|
|
|
|
FROM and TO should be markers, CATEGORY and REPLACEMENT should be strings."
|
|
|
|
|
(let ((pt (copy-marker from))
|
|
|
|
|
(limit (copy-marker to))
|
|
|
|
|
(old-pt 0)
|
|
|
|
|
lim1)
|
|
|
|
|
(setq lim1 limit)
|
|
|
|
|
(goto-char pt)
|
|
|
|
|
(while (< pt limit)
|
|
|
|
|
(if (> pt old-pt)
|
|
|
|
|
(move-marker lim1
|
|
|
|
|
(save-excursion
|
|
|
|
|
;; L and R categories include embedding and
|
|
|
|
|
;; override controls, but we don't want to
|
|
|
|
|
;; replace them, because that might change
|
|
|
|
|
;; the visual order. Likewise with PDF and
|
|
|
|
|
;; isolate controls.
|
|
|
|
|
(+ pt (skip-chars-forward
|
|
|
|
|
bidi-directional-non-controls-chars
|
|
|
|
|
limit)))))
|
|
|
|
|
;; Replace any run of non-RTL characters by a single LRM.
|
|
|
|
|
(if (null (re-search-forward category lim1 t))
|
|
|
|
|
;; No more characters of CATEGORY, we are done.
|
|
|
|
|
(setq pt limit)
|
|
|
|
|
(replace-match replacement nil t)
|
|
|
|
|
(move-marker pt (point)))
|
|
|
|
|
(setq old-pt pt)
|
|
|
|
|
;; Skip directional controls, if any.
|
|
|
|
|
(move-marker
|
|
|
|
|
pt (+ pt (skip-chars-forward bidi-directional-controls-chars limit))))))
|
|
|
|
|
|
|
|
|
|
(defun squeeze-bidi-context (from to)
|
|
|
|
|
"Replace characters between FROM and TO while keeping bidi context.
|
|
|
|
|
|
|
|
|
|
This function replaces the region of text with as few characters
|
|
|
|
|
as possible, while preserving the effect that region will have on
|
|
|
|
|
bidirectional display before and after the region."
|
|
|
|
|
(let ((start (set-marker (make-marker)
|
|
|
|
|
(if (> from 0) from (+ (point-max) from))))
|
|
|
|
|
(end (set-marker (make-marker) to))
|
|
|
|
|
;; This is for when they copy text with read-only text
|
|
|
|
|
;; properties.
|
|
|
|
|
(inhibit-read-only t))
|
|
|
|
|
(if (null (marker-position end))
|
|
|
|
|
(setq end (point-max-marker)))
|
|
|
|
|
;; Replace each run of non-RTL characters with a single LRM.
|
|
|
|
|
(squeeze-bidi-context-1 start end "\\CR+" "\x200e")
|
|
|
|
|
;; Replace each run of non-LTR characters with a single RLM. Note
|
|
|
|
|
;; that the \cR category includes both the Arabic Letter (AL) and
|
|
|
|
|
;; R characters; here we ignore the distinction between them,
|
|
|
|
|
;; because that distinction only affects Arabic Number (AN)
|
|
|
|
|
;; characters, which are weak and don't affect the reordering.
|
|
|
|
|
(squeeze-bidi-context-1 start end "\\CL+" "\x200f")))
|
|
|
|
|
|
|
|
|
|
(defun line-substring-with-bidi-context (start end &optional no-properties)
|
|
|
|
|
"Return buffer text between START and END with its bidi context.
|
|
|
|
|
|
|
|
|
|
START and END are assumed to belong to the same physical line
|
|
|
|
|
of buffer text. This function prepends and appends to the text
|
|
|
|
|
between START and END bidi control characters that preserve the
|
|
|
|
|
visual order of that text when it is inserted at some other place."
|
|
|
|
|
(if (or (< start (point-min))
|
|
|
|
|
(> end (point-max)))
|
|
|
|
|
(signal 'args-out-of-range (list (current-buffer) start end)))
|
|
|
|
|
(let ((buf (current-buffer))
|
|
|
|
|
substr para-dir from to)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(setq para-dir (current-bidi-paragraph-direction))
|
|
|
|
|
(setq from (line-beginning-position)
|
|
|
|
|
to (line-end-position))
|
|
|
|
|
(goto-char from)
|
|
|
|
|
;; If we don't have any mixed directional characters in the
|
|
|
|
|
;; entire line, we can just copy the substring without adding
|
|
|
|
|
;; any context.
|
|
|
|
|
(if (or (looking-at-p "\\CR*$")
|
|
|
|
|
(looking-at-p "\\CL*$"))
|
|
|
|
|
(setq substr (if no-properties
|
|
|
|
|
(buffer-substring-no-properties start end)
|
|
|
|
|
(buffer-substring start end)))
|
|
|
|
|
(setq substr
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(if no-properties
|
|
|
|
|
(insert-buffer-substring-no-properties buf from to)
|
|
|
|
|
(insert-buffer-substring buf from to))
|
|
|
|
|
(squeeze-bidi-context 1 (1+ (- start from)))
|
|
|
|
|
(squeeze-bidi-context (- end to) nil)
|
|
|
|
|
(buffer-substring 1 (point-max)))))
|
|
|
|
|
|
|
|
|
|
;; Wrap the string in LRI/RLI..PDI pair to achieve 2 effects:
|
|
|
|
|
;; (1) force the string to have the same base embedding
|
|
|
|
|
;; direction as the paragraph direction at the source, no matter
|
|
|
|
|
;; what is the paragraph direction at destination; and (2) avoid
|
|
|
|
|
;; affecting the visual order of the surrounding text at
|
|
|
|
|
;; destination if there are characters of different
|
|
|
|
|
;; directionality there.
|
|
|
|
|
(concat (if (eq para-dir 'left-to-right) "\x2066" "\x2067")
|
|
|
|
|
substr "\x2069"))))
|
|
|
|
|
|
|
|
|
|
(defun buffer-substring-with-bidi-context (start end &optional no-properties)
|
|
|
|
|
"Return portion of current buffer between START and END with bidi context.
|
|
|
|
|
|
|
|
|
|
This function works similar to `buffer-substring', but it prepends and
|
|
|
|
|
appends to the text bidi directional control characters necessary to
|
|
|
|
|
preserve the visual appearance of the text if it is inserted at another
|
|
|
|
|
place. This is useful when the buffer substring includes bidirectional
|
|
|
|
|
text and control characters that cause non-trivial reordering on display.
|
|
|
|
|
If copied verbatim, such text can have a very different visual appearance,
|
|
|
|
|
and can also change the visual appearance of the surrounding text at the
|
|
|
|
|
destination of the copy.
|
|
|
|
|
|
|
|
|
|
Optional argument NO-PROPERTIES, if non-nil, means copy the text without
|
|
|
|
|
the text properties."
|
|
|
|
|
(let (line-end substr)
|
|
|
|
|
(if (or (< start (point-min))
|
|
|
|
|
(> end (point-max)))
|
|
|
|
|
(signal 'args-out-of-range (list (current-buffer) start end)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(setq line-end (min end (line-end-position)))
|
|
|
|
|
(while (< start end)
|
|
|
|
|
(setq substr
|
|
|
|
|
(concat substr
|
|
|
|
|
(if substr "\n" "")
|
|
|
|
|
(line-substring-with-bidi-context start line-end
|
|
|
|
|
no-properties)))
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(setq start (point))
|
|
|
|
|
(setq line-end (min end (line-end-position))))
|
|
|
|
|
substr)))
|
2002-04-19 00:05:22 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
;; Yanking.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2012-08-18 13:11:38 +08:00
|
|
|
|
(defcustom yank-handled-properties
|
|
|
|
|
'((font-lock-face . yank-handle-font-lock-face-property)
|
|
|
|
|
(category . yank-handle-category-property))
|
|
|
|
|
"List of special text property handling conditions for yanking.
|
|
|
|
|
Each element should have the form (PROP . FUN), where PROP is a
|
|
|
|
|
property symbol and FUN is a function. When the `yank' command
|
|
|
|
|
inserts text into the buffer, it scans the inserted text for
|
|
|
|
|
stretches of text that have `eq' values of the text property
|
|
|
|
|
PROP; for each such stretch of text, FUN is called with three
|
|
|
|
|
arguments: the property's value in that text, and the start and
|
|
|
|
|
end positions of the text.
|
|
|
|
|
|
|
|
|
|
This is done prior to removing the properties specified by
|
|
|
|
|
`yank-excluded-properties'."
|
|
|
|
|
:group 'killing
|
2013-12-28 00:21:33 -08:00
|
|
|
|
:type '(repeat (cons (symbol :tag "property symbol")
|
|
|
|
|
function))
|
2012-08-18 13:11:38 +08:00
|
|
|
|
:version "24.3")
|
|
|
|
|
|
2002-04-19 00:05:22 +00:00
|
|
|
|
;; This is actually used in subr.el but defcustom does not work there.
|
|
|
|
|
(defcustom yank-excluded-properties
|
2012-08-18 13:11:38 +08:00
|
|
|
|
'(category field follow-link fontified font-lock-face help-echo
|
|
|
|
|
intangible invisible keymap local-map mouse-face read-only
|
|
|
|
|
yank-handler)
|
2007-09-16 22:11:33 +00:00
|
|
|
|
"Text properties to discard when yanking.
|
2003-06-04 21:13:41 +00:00
|
|
|
|
The value should be a list of text properties to discard or t,
|
2012-08-18 13:11:38 +08:00
|
|
|
|
which means to discard all text properties.
|
|
|
|
|
|
|
|
|
|
See also `yank-handled-properties'."
|
2002-04-19 00:05:22 +00:00
|
|
|
|
:type '(choice (const :tag "All" t) (repeat symbol))
|
2004-06-10 04:20:02 +00:00
|
|
|
|
:group 'killing
|
2012-08-18 13:11:38 +08:00
|
|
|
|
:version "24.3")
|
2002-04-19 00:05:22 +00:00
|
|
|
|
|
2002-11-29 15:09:37 +00:00
|
|
|
|
(defvar yank-window-start nil)
|
2003-01-18 23:34:14 +00:00
|
|
|
|
(defvar yank-undo-function nil
|
2003-01-21 21:11:12 +00:00
|
|
|
|
"If non-nil, function used by `yank-pop' to delete last stretch of yanked text.
|
|
|
|
|
Function is called with two parameters, START and END corresponding to
|
|
|
|
|
the value of the mark and point; it is guaranteed that START <= END.
|
|
|
|
|
Normally set from the UNDO element of a yank-handler; see `insert-for-yank'.")
|
2002-11-29 15:09:37 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defun yank-pop (&optional arg)
|
1992-08-21 07:18:16 +00:00
|
|
|
|
"Replace just-yanked stretch of killed text with a different stretch.
|
|
|
|
|
This command is allowed only immediately after a `yank' or a `yank-pop'.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
At such a time, the region contains a stretch of reinserted
|
1992-08-21 07:18:16 +00:00
|
|
|
|
previously-killed text. `yank-pop' deletes that text and inserts in its
|
1991-12-21 09:29:41 +00:00
|
|
|
|
place a different stretch of killed text.
|
|
|
|
|
|
|
|
|
|
With no argument, the previous kill is inserted.
|
1992-08-21 07:18:16 +00:00
|
|
|
|
With argument N, insert the Nth previous kill.
|
|
|
|
|
If N is negative, this is a more recent kill.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
The sequence of kills wraps around, so that after the oldest one
|
2005-05-22 20:58:52 +00:00
|
|
|
|
comes the newest one.
|
|
|
|
|
|
2016-10-02 19:47:27 -05:00
|
|
|
|
This command honors the `yank-handled-properties' and
|
|
|
|
|
`yank-excluded-properties' variables, and the `yank-handler' text
|
|
|
|
|
property, in the way that `yank' does."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*p")
|
|
|
|
|
(if (not (eq last-command 'yank))
|
2015-02-18 07:35:49 +00:00
|
|
|
|
(user-error "Previous command was not a yank"))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(setq this-command 'yank)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(unless arg (setq arg 1))
|
1996-02-06 23:56:47 +00:00
|
|
|
|
(let ((inhibit-read-only t)
|
|
|
|
|
(before (< (point) (mark t))))
|
2003-01-18 23:59:12 +00:00
|
|
|
|
(if before
|
|
|
|
|
(funcall (or yank-undo-function 'delete-region) (point) (mark t))
|
|
|
|
|
(funcall (or yank-undo-function 'delete-region) (mark t) (point)))
|
2003-01-18 23:34:14 +00:00
|
|
|
|
(setq yank-undo-function nil)
|
1993-05-16 15:39:39 +00:00
|
|
|
|
(set-marker (mark-marker) (point) (current-buffer))
|
2002-04-19 00:05:22 +00:00
|
|
|
|
(insert-for-yank (current-kill arg))
|
2002-11-29 15:09:37 +00:00
|
|
|
|
;; Set the window start back where it was in the yank command,
|
|
|
|
|
;; if possible.
|
|
|
|
|
(set-window-start (selected-window) yank-window-start t)
|
1993-05-16 15:39:39 +00:00
|
|
|
|
(if before
|
|
|
|
|
;; This is like exchange-point-and-mark, but doesn't activate the mark.
|
|
|
|
|
;; It is cleaner to avoid activation, even though the command
|
|
|
|
|
;; loop would deactivate the mark because we inserted text.
|
|
|
|
|
(goto-char (prog1 (mark t)
|
|
|
|
|
(set-marker (mark-marker) (point) (current-buffer))))))
|
1993-03-11 07:07:17 +00:00
|
|
|
|
nil)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun yank (&optional arg)
|
2006-03-11 17:01:47 +00:00
|
|
|
|
"Reinsert (\"paste\") the last stretch of killed text.
|
2012-08-18 13:11:38 +08:00
|
|
|
|
More precisely, reinsert the most recent kill, which is the
|
|
|
|
|
stretch of killed text most recently killed OR yanked. Put point
|
|
|
|
|
at the end, and set mark at the beginning without activating it.
|
|
|
|
|
With just \\[universal-argument] as argument, put point at beginning, and mark at end.
|
|
|
|
|
With argument N, reinsert the Nth most recent kill.
|
|
|
|
|
|
2016-10-02 19:47:27 -05:00
|
|
|
|
This command honors the `yank-handled-properties' and
|
|
|
|
|
`yank-excluded-properties' variables, and the `yank-handler' text
|
|
|
|
|
property, as described below.
|
|
|
|
|
|
|
|
|
|
Properties listed in `yank-handled-properties' are processed,
|
|
|
|
|
then those listed in `yank-excluded-properties' are discarded.
|
|
|
|
|
|
|
|
|
|
If STRING has a non-nil `yank-handler' property anywhere, the
|
|
|
|
|
normal insert behavior is altered, and instead, for each contiguous
|
|
|
|
|
segment of STRING that has a given value of the `yank-handler'
|
|
|
|
|
property, that value is used as follows:
|
|
|
|
|
|
|
|
|
|
The value of a `yank-handler' property must be a list of one to four
|
|
|
|
|
elements, of the form (FUNCTION PARAM NOEXCLUDE UNDO).
|
|
|
|
|
FUNCTION, if non-nil, should be a function of one argument (the
|
|
|
|
|
object to insert); FUNCTION is called instead of `insert'.
|
|
|
|
|
PARAM, if present and non-nil, is passed to FUNCTION (to be handled
|
|
|
|
|
in whatever way is appropriate; e.g. if FUNCTION is `yank-rectangle',
|
|
|
|
|
PARAM may be a list of strings to insert as a rectangle). If PARAM
|
|
|
|
|
is nil, then the current segment of STRING is used.
|
|
|
|
|
If NOEXCLUDE is present and non-nil, the normal removal of
|
|
|
|
|
`yank-excluded-properties' is not performed; instead FUNCTION is
|
|
|
|
|
responsible for the removal. This may be necessary if FUNCTION
|
|
|
|
|
adjusts point before or after inserting the object.
|
|
|
|
|
UNDO, if present and non-nil, should be a function to be called
|
|
|
|
|
by `yank-pop' to undo the insertion of the current PARAM. It is
|
|
|
|
|
given two arguments, the start and end of the region. FUNCTION
|
|
|
|
|
may set `yank-undo-function' to override UNDO.
|
2005-05-22 20:58:52 +00:00
|
|
|
|
|
2006-11-01 23:11:08 +00:00
|
|
|
|
See also the command `yank-pop' (\\[yank-pop])."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*P")
|
2002-11-29 15:09:37 +00:00
|
|
|
|
(setq yank-window-start (window-start))
|
1994-02-13 00:16:23 +00:00
|
|
|
|
;; If we don't get all the way thru, make last-command indicate that
|
|
|
|
|
;; for the following command.
|
|
|
|
|
(setq this-command t)
|
2017-04-28 11:25:26 +03:00
|
|
|
|
(push-mark)
|
2002-04-19 00:05:22 +00:00
|
|
|
|
(insert-for-yank (current-kill (cond
|
|
|
|
|
((listp arg) 0)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
((eq arg '-) -2)
|
2002-04-19 00:05:22 +00:00
|
|
|
|
(t (1- arg)))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (consp arg)
|
1993-05-16 15:39:39 +00:00
|
|
|
|
;; This is like exchange-point-and-mark, but doesn't activate the mark.
|
|
|
|
|
;; It is cleaner to avoid activation, even though the command
|
|
|
|
|
;; loop would deactivate the mark because we inserted text.
|
|
|
|
|
(goto-char (prog1 (mark t)
|
|
|
|
|
(set-marker (mark-marker) (point) (current-buffer)))))
|
1994-02-13 00:16:23 +00:00
|
|
|
|
;; If we do get all the way thru, make this-command indicate that.
|
2003-01-18 23:34:14 +00:00
|
|
|
|
(if (eq this-command t)
|
|
|
|
|
(setq this-command 'yank))
|
1993-03-11 07:07:17 +00:00
|
|
|
|
nil)
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
|
|
|
|
(defun rotate-yank-pointer (arg)
|
|
|
|
|
"Rotate the yanking point in the kill ring.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With ARG, rotate that many kills forward (or backward, if negative)."
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(interactive "p")
|
|
|
|
|
(current-kill arg))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
;; Some kill commands.
|
|
|
|
|
|
|
|
|
|
;; Internal subroutine of delete-char
|
|
|
|
|
(defun kill-forward-chars (arg)
|
|
|
|
|
(if (listp arg) (setq arg (car arg)))
|
|
|
|
|
(if (eq arg '-) (setq arg -1))
|
2009-03-19 14:45:02 +00:00
|
|
|
|
(kill-region (point) (+ (point) arg)))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
|
|
|
|
;; Internal subroutine of backward-delete-char
|
|
|
|
|
(defun kill-backward-chars (arg)
|
|
|
|
|
(if (listp arg) (setq arg (car arg)))
|
|
|
|
|
(if (eq arg '-) (setq arg -1))
|
2009-03-19 14:45:02 +00:00
|
|
|
|
(kill-region (point) (- (point) arg)))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
|
|
|
|
(defcustom backward-delete-char-untabify-method 'untabify
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"The method for untabifying when deleting backward.
|
1999-11-15 16:11:14 +00:00
|
|
|
|
Can be `untabify' -- turn a tab to many spaces, then delete one space;
|
|
|
|
|
`hungry' -- delete all whitespace, both tabs and spaces;
|
|
|
|
|
`all' -- delete all whitespace, including tabs, spaces and newlines;
|
1999-08-16 20:42:38 +00:00
|
|
|
|
nil -- just delete one character."
|
1999-11-15 16:11:14 +00:00
|
|
|
|
:type '(choice (const untabify) (const hungry) (const all) (const nil))
|
2001-01-16 10:51:35 +00:00
|
|
|
|
:version "20.3"
|
1999-08-16 20:42:38 +00:00
|
|
|
|
:group 'killing)
|
|
|
|
|
|
|
|
|
|
(defun backward-delete-char-untabify (arg &optional killp)
|
|
|
|
|
"Delete characters backward, changing tabs into spaces.
|
|
|
|
|
The exact behavior depends on `backward-delete-char-untabify-method'.
|
|
|
|
|
Delete ARG chars, and kill (save in kill ring) if KILLP is non-nil.
|
|
|
|
|
Interactively, ARG is the prefix arg (default 1)
|
|
|
|
|
and KILLP is t if a prefix arg was specified."
|
|
|
|
|
(interactive "*p\nP")
|
|
|
|
|
(when (eq backward-delete-char-untabify-method 'untabify)
|
|
|
|
|
(let ((count arg))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (and (> count 0) (not (bobp)))
|
|
|
|
|
(if (= (preceding-char) ?\t)
|
|
|
|
|
(let ((col (current-column)))
|
|
|
|
|
(forward-char -1)
|
|
|
|
|
(setq col (- col (current-column)))
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
(insert-char ?\s col)
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(delete-char 1)))
|
|
|
|
|
(forward-char -1)
|
|
|
|
|
(setq count (1- count))))))
|
2011-03-22 16:15:21 +01:00
|
|
|
|
(let* ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t")
|
1999-11-15 16:11:14 +00:00
|
|
|
|
((eq backward-delete-char-untabify-method 'all)
|
2011-03-22 16:15:21 +01:00
|
|
|
|
" \t\n\r")))
|
|
|
|
|
(n (if skip
|
2012-03-05 23:53:34 +08:00
|
|
|
|
(let* ((oldpt (point))
|
|
|
|
|
(wh (- oldpt (save-excursion
|
|
|
|
|
(skip-chars-backward skip)
|
|
|
|
|
(constrain-to-field nil oldpt)))))
|
2011-03-22 16:15:21 +01:00
|
|
|
|
(+ arg (if (zerop wh) 0 (1- wh))))
|
|
|
|
|
arg)))
|
|
|
|
|
;; Avoid warning about delete-backward-char
|
|
|
|
|
(with-no-warnings (delete-backward-char n killp))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
|
|
|
|
(defun zap-to-char (arg char)
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
"Kill up to and including ARGth occurrence of CHAR.
|
1999-08-16 20:42:38 +00:00
|
|
|
|
Case is ignored if `case-fold-search' is non-nil in the current buffer.
|
|
|
|
|
Goes backward if ARG is negative; error if CHAR not found."
|
2012-04-10 04:23:21 +02:00
|
|
|
|
(interactive (list (prefix-numeric-value current-prefix-arg)
|
|
|
|
|
(read-char "Zap to char: " t)))
|
2009-02-14 09:06:30 +00:00
|
|
|
|
;; Avoid "obsolete" warnings for translation-table-for-input.
|
|
|
|
|
(with-no-warnings
|
|
|
|
|
(if (char-table-p translation-table-for-input)
|
|
|
|
|
(setq char (or (aref translation-table-for-input char) char))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(kill-region (point) (progn
|
|
|
|
|
(search-forward (char-to-string char) nil nil arg)
|
|
|
|
|
(point))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
;; kill-line and its subroutines.
|
|
|
|
|
|
|
|
|
|
(defcustom kill-whole-line nil
|
2012-07-02 18:42:45 -04:00
|
|
|
|
"If non-nil, `kill-line' with no arg at start of line kills the whole line."
|
1999-08-16 20:42:38 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'killing)
|
|
|
|
|
|
|
|
|
|
(defun kill-line (&optional arg)
|
|
|
|
|
"Kill the rest of the current line; if no nonblanks there, kill thru newline.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With prefix argument ARG, kill that many lines from point.
|
1999-08-16 20:42:38 +00:00
|
|
|
|
Negative arguments kill lines backward.
|
2000-10-08 06:10:40 +00:00
|
|
|
|
With zero argument, kills the text before point on the current line.
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
|
|
|
|
When calling from a program, nil means \"no arg\",
|
|
|
|
|
a number counts as a prefix arg.
|
|
|
|
|
|
|
|
|
|
To kill a whole line, when point is not at the beginning, type \
|
2007-02-17 23:06:12 +00:00
|
|
|
|
\\[move-beginning-of-line] \\[kill-line] \\[kill-line].
|
1999-08-16 20:42:38 +00:00
|
|
|
|
|
2011-09-23 12:52:23 +02:00
|
|
|
|
If `show-trailing-whitespace' is non-nil, this command will just
|
2016-09-17 13:30:24 -04:00
|
|
|
|
kill the rest of the current line, even if there are no nonblanks
|
|
|
|
|
there.
|
2011-09-23 12:52:23 +02:00
|
|
|
|
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
If option `kill-whole-line' is non-nil, then this command kills the whole line
|
1999-08-16 20:42:38 +00:00
|
|
|
|
including its terminating newline, when used at the beginning of a line
|
|
|
|
|
with no argument. As a consequence, you can always kill a whole line
|
2007-02-17 23:06:12 +00:00
|
|
|
|
by typing \\[move-beginning-of-line] \\[kill-line].
|
2001-02-06 06:54:56 +00:00
|
|
|
|
|
2001-02-16 12:09:39 +00:00
|
|
|
|
If you want to append the killed line to the last killed text,
|
|
|
|
|
use \\[append-next-kill] before \\[kill-line].
|
|
|
|
|
|
2001-02-06 06:54:56 +00:00
|
|
|
|
If the buffer is read-only, Emacs will beep and refrain from deleting
|
|
|
|
|
the line, but put the line in the kill ring anyway. This means that
|
2003-04-21 01:35:20 +00:00
|
|
|
|
you can use this command to copy text from a read-only buffer.
|
|
|
|
|
\(If the variable `kill-read-only-ok' is non-nil, then this won't
|
|
|
|
|
even beep.)"
|
2000-02-23 23:08:02 +00:00
|
|
|
|
(interactive "P")
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(kill-region (point)
|
|
|
|
|
;; It is better to move point to the other end of the kill
|
|
|
|
|
;; before killing. That way, in a read-only buffer, point
|
|
|
|
|
;; moves across the text that is copied to the kill ring.
|
|
|
|
|
;; The choice has no effect on undo now that undo records
|
|
|
|
|
;; the value of point from before the command was run.
|
|
|
|
|
(progn
|
|
|
|
|
(if arg
|
|
|
|
|
(forward-visible-line (prefix-numeric-value arg))
|
|
|
|
|
(if (eobp)
|
|
|
|
|
(signal 'end-of-buffer nil))
|
2002-09-01 13:29:34 +00:00
|
|
|
|
(let ((end
|
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-visible-line) (point))))
|
|
|
|
|
(if (or (save-excursion
|
2004-04-16 12:51:06 +00:00
|
|
|
|
;; If trailing whitespace is visible,
|
|
|
|
|
;; don't treat it as nothing.
|
|
|
|
|
(unless show-trailing-whitespace
|
|
|
|
|
(skip-chars-forward " \t" end))
|
2002-09-01 13:29:34 +00:00
|
|
|
|
(= (point) end))
|
|
|
|
|
(and kill-whole-line (bolp)))
|
|
|
|
|
(forward-visible-line 1)
|
|
|
|
|
(goto-char end))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(point))))
|
|
|
|
|
|
2003-05-19 15:47:14 +00:00
|
|
|
|
(defun kill-whole-line (&optional arg)
|
|
|
|
|
"Kill current line.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With prefix ARG, kill that many lines starting from the current line.
|
|
|
|
|
If ARG is negative, kill backward. Also kill the preceding newline.
|
2014-02-21 14:22:14 +01:00
|
|
|
|
\(This is meant to make \\[repeat] work well with negative arguments.)
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
If ARG is zero, kill current line but exclude the trailing newline."
|
2004-05-01 20:10:19 +00:00
|
|
|
|
(interactive "p")
|
2009-02-06 03:59:15 +00:00
|
|
|
|
(or arg (setq arg 1))
|
2003-05-29 23:29:29 +00:00
|
|
|
|
(if (and (> arg 0) (eobp) (save-excursion (forward-visible-line 0) (eobp)))
|
|
|
|
|
(signal 'end-of-buffer nil))
|
|
|
|
|
(if (and (< arg 0) (bobp) (save-excursion (end-of-visible-line) (bobp)))
|
|
|
|
|
(signal 'beginning-of-buffer nil))
|
|
|
|
|
(unless (eq last-command 'kill-region)
|
|
|
|
|
(kill-new "")
|
|
|
|
|
(setq last-command 'kill-region))
|
2003-05-19 15:47:14 +00:00
|
|
|
|
(cond ((zerop arg)
|
2003-05-29 23:29:29 +00:00
|
|
|
|
;; We need to kill in two steps, because the previous command
|
|
|
|
|
;; could have been a kill command, in which case the text
|
|
|
|
|
;; before point needs to be prepended to the current kill
|
|
|
|
|
;; ring entry and the text after point appended. Also, we
|
|
|
|
|
;; need to use save-excursion to avoid copying the same text
|
|
|
|
|
;; twice to the kill ring in read-only buffers.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(kill-region (point) (progn (forward-visible-line 0) (point))))
|
2003-05-19 15:47:14 +00:00
|
|
|
|
(kill-region (point) (progn (end-of-visible-line) (point))))
|
|
|
|
|
((< arg 0)
|
2003-05-29 23:29:29 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(kill-region (point) (progn (end-of-visible-line) (point))))
|
|
|
|
|
(kill-region (point)
|
|
|
|
|
(progn (forward-visible-line (1+ arg))
|
|
|
|
|
(unless (bobp) (backward-char))
|
|
|
|
|
(point))))
|
2003-05-19 15:47:14 +00:00
|
|
|
|
(t
|
2003-05-29 23:29:29 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(kill-region (point) (progn (forward-visible-line 0) (point))))
|
|
|
|
|
(kill-region (point)
|
|
|
|
|
(progn (forward-visible-line arg) (point))))))
|
2002-09-09 00:27:30 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(defun forward-visible-line (arg)
|
|
|
|
|
"Move forward by ARG lines, ignoring currently invisible newlines only.
|
|
|
|
|
If ARG is negative, move backward -ARG lines.
|
|
|
|
|
If ARG is zero, move to the beginning of the current line."
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(if (> arg 0)
|
2002-09-09 00:27:30 +00:00
|
|
|
|
(progn
|
|
|
|
|
(while (> arg 0)
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(or (zerop (forward-line 1))
|
2002-09-09 00:27:30 +00:00
|
|
|
|
(signal 'end-of-buffer nil))
|
|
|
|
|
;; If the newline we just skipped is invisible,
|
|
|
|
|
;; don't count it.
|
|
|
|
|
(let ((prop
|
|
|
|
|
(get-char-property (1- (point)) 'invisible)))
|
|
|
|
|
(if (if (eq buffer-invisibility-spec t)
|
|
|
|
|
prop
|
|
|
|
|
(or (memq prop buffer-invisibility-spec)
|
|
|
|
|
(assq prop buffer-invisibility-spec)))
|
|
|
|
|
(setq arg (1+ arg))))
|
|
|
|
|
(setq arg (1- arg)))
|
|
|
|
|
;; If invisible text follows, and it is a number of complete lines,
|
|
|
|
|
;; skip it.
|
|
|
|
|
(let ((opoint (point)))
|
|
|
|
|
(while (and (not (eobp))
|
|
|
|
|
(let ((prop
|
|
|
|
|
(get-char-property (point) 'invisible)))
|
|
|
|
|
(if (eq buffer-invisibility-spec t)
|
|
|
|
|
prop
|
|
|
|
|
(or (memq prop buffer-invisibility-spec)
|
|
|
|
|
(assq prop buffer-invisibility-spec)))))
|
|
|
|
|
(goto-char
|
|
|
|
|
(if (get-text-property (point) 'invisible)
|
|
|
|
|
(or (next-single-property-change (point) 'invisible)
|
|
|
|
|
(point-max))
|
|
|
|
|
(next-overlay-change (point)))))
|
|
|
|
|
(unless (bolp)
|
|
|
|
|
(goto-char opoint))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(let ((first t))
|
2003-05-25 01:34:37 +00:00
|
|
|
|
(while (or first (<= arg 0))
|
|
|
|
|
(if first
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(or (zerop (forward-line -1))
|
|
|
|
|
(signal 'beginning-of-buffer nil)))
|
2002-09-09 00:27:30 +00:00
|
|
|
|
;; If the newline we just moved to is invisible,
|
|
|
|
|
;; don't count it.
|
|
|
|
|
(unless (bobp)
|
|
|
|
|
(let ((prop
|
|
|
|
|
(get-char-property (1- (point)) 'invisible)))
|
2003-05-25 01:34:37 +00:00
|
|
|
|
(unless (if (eq buffer-invisibility-spec t)
|
|
|
|
|
prop
|
|
|
|
|
(or (memq prop buffer-invisibility-spec)
|
|
|
|
|
(assq prop buffer-invisibility-spec)))
|
|
|
|
|
(setq arg (1+ arg)))))
|
|
|
|
|
(setq first nil))
|
2002-09-09 00:27:30 +00:00
|
|
|
|
;; If invisible text follows, and it is a number of complete lines,
|
|
|
|
|
;; skip it.
|
|
|
|
|
(let ((opoint (point)))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(while (and (not (bobp))
|
|
|
|
|
(let ((prop
|
|
|
|
|
(get-char-property (1- (point)) 'invisible)))
|
|
|
|
|
(if (eq buffer-invisibility-spec t)
|
|
|
|
|
prop
|
|
|
|
|
(or (memq prop buffer-invisibility-spec)
|
|
|
|
|
(assq prop buffer-invisibility-spec)))))
|
|
|
|
|
(goto-char
|
|
|
|
|
(if (get-text-property (1- (point)) 'invisible)
|
|
|
|
|
(or (previous-single-property-change (point) 'invisible)
|
|
|
|
|
(point-min))
|
2002-09-09 00:27:30 +00:00
|
|
|
|
(previous-overlay-change (point)))))
|
|
|
|
|
(unless (bolp)
|
|
|
|
|
(goto-char opoint)))))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
((beginning-of-buffer end-of-buffer)
|
|
|
|
|
nil)))
|
1992-06-12 22:23:00 +00:00
|
|
|
|
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(defun end-of-visible-line ()
|
|
|
|
|
"Move to end of current visible line."
|
|
|
|
|
(end-of-line)
|
|
|
|
|
;; If the following character is currently invisible,
|
|
|
|
|
;; skip all characters with that same `invisible' property value,
|
|
|
|
|
;; then find the next newline.
|
|
|
|
|
(while (and (not (eobp))
|
2002-09-01 13:29:34 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(skip-chars-forward "^\n")
|
|
|
|
|
(let ((prop
|
|
|
|
|
(get-char-property (point) 'invisible)))
|
|
|
|
|
(if (eq buffer-invisibility-spec t)
|
|
|
|
|
prop
|
|
|
|
|
(or (memq prop buffer-invisibility-spec)
|
|
|
|
|
(assq prop buffer-invisibility-spec))))))
|
|
|
|
|
(skip-chars-forward "^\n")
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(if (get-text-property (point) 'invisible)
|
2012-03-22 15:38:05 +08:00
|
|
|
|
(goto-char (or (next-single-property-change (point) 'invisible)
|
|
|
|
|
(point-max)))
|
1999-08-16 20:42:38 +00:00
|
|
|
|
(goto-char (next-overlay-change (point))))
|
|
|
|
|
(end-of-line)))
|
2017-04-12 23:14:20 +03:00
|
|
|
|
|
|
|
|
|
(defun kill-current-buffer ()
|
|
|
|
|
"Kill the current buffer.
|
|
|
|
|
When called in the minibuffer, get out of the minibuffer
|
|
|
|
|
using `abort-recursive-edit'.
|
|
|
|
|
|
|
|
|
|
This is like `kill-this-buffer', but it doesn't have to be invoked
|
|
|
|
|
via the menu bar, and pays no attention to the menu-bar's frame."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((frame (selected-frame)))
|
|
|
|
|
(if (and (frame-live-p frame)
|
|
|
|
|
(not (window-minibuffer-p (frame-selected-window frame))))
|
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
|
(abort-recursive-edit))))
|
|
|
|
|
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun insert-buffer (buffer)
|
|
|
|
|
"Insert after point the contents of BUFFER.
|
|
|
|
|
Puts mark after the inserted text.
|
Include interactive-only information in describe-function output
* lisp/help-fns.el (help-fns--interactive-only): New function.
(help-fns-describe-function-functions): Add the above function.
* lisp/simple.el (beginning-of-buffer, end-of-buffer, insert-buffer)
(next-line, previous-line): Remove hand-written interactive-only
information from doc strings, it is auto-generated now.
* lisp/bookmark.el (bookmark-write):
* lisp/epa-mail.el (epa-mail-decrypt, epa-mail-verify, epa-mail-sign)
(epa-mail-import-keys): Mark interactive-only,
and remove hand-written interactive-only information from doc strings.
* lisp/epa.el (epa-decrypt-armor-in-region, epa-verify-region)
(epa-verify-cleartext-in-region, epa-sign-region, epa-encrypt-region):
* lisp/files.el (not-modified):
* lisp/simple.el (mark-whole-buffer): Mark interactive-only.
* doc/lispref/commands.texi (Defining Commands):
Mention that interactive-only also affects describe-function.
* etc/NEWS: Mention this.
2014-03-22 15:36:29 -07:00
|
|
|
|
BUFFER may be a buffer or a buffer name."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only insert-buffer-substring))
|
1996-03-18 19:32:24 +00:00
|
|
|
|
(interactive
|
1996-03-18 18:50:25 +00:00
|
|
|
|
(list
|
|
|
|
|
(progn
|
|
|
|
|
(barf-if-buffer-read-only)
|
|
|
|
|
(read-buffer "Insert buffer: "
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 18:26:57 +04:00
|
|
|
|
(if (eq (selected-window) (next-window))
|
1996-03-18 18:50:25 +00:00
|
|
|
|
(other-buffer (current-buffer))
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 18:26:57 +04:00
|
|
|
|
(window-buffer (next-window)))
|
1996-03-18 18:50:25 +00:00
|
|
|
|
t))))
|
2003-05-13 19:45:01 +00:00
|
|
|
|
(push-mark
|
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-buffer-substring (get-buffer buffer))
|
|
|
|
|
(point)))
|
1993-03-02 07:33:17 +00:00
|
|
|
|
nil)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun append-to-buffer (buffer start end)
|
|
|
|
|
"Append to specified buffer the text of the region.
|
|
|
|
|
It is inserted into that buffer before its point.
|
|
|
|
|
|
|
|
|
|
When calling from a program, give three arguments:
|
|
|
|
|
BUFFER (or buffer name), START and END.
|
|
|
|
|
START and END specify the portion of the current buffer to be copied."
|
1992-06-12 22:23:00 +00:00
|
|
|
|
(interactive
|
1994-11-22 19:19:42 +00:00
|
|
|
|
(list (read-buffer "Append to buffer: " (other-buffer (current-buffer) t))
|
1993-06-10 23:06:50 +00:00
|
|
|
|
(region-beginning) (region-end)))
|
2010-03-30 22:53:53 -04:00
|
|
|
|
(let* ((oldbuf (current-buffer))
|
|
|
|
|
(append-to (get-buffer-create buffer))
|
|
|
|
|
(windows (get-buffer-window-list append-to t t))
|
|
|
|
|
point)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(with-current-buffer append-to
|
|
|
|
|
(setq point (point))
|
|
|
|
|
(barf-if-buffer-read-only)
|
|
|
|
|
(insert-buffer-substring oldbuf start end)
|
|
|
|
|
(dolist (window windows)
|
|
|
|
|
(when (= (window-point window) point)
|
|
|
|
|
(set-window-point window (point))))))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun prepend-to-buffer (buffer start end)
|
|
|
|
|
"Prepend to specified buffer the text of the region.
|
|
|
|
|
It is inserted into that buffer after its point.
|
|
|
|
|
|
|
|
|
|
When calling from a program, give three arguments:
|
|
|
|
|
BUFFER (or buffer name), START and END.
|
|
|
|
|
START and END specify the portion of the current buffer to be copied."
|
|
|
|
|
(interactive "BPrepend to buffer: \nr")
|
|
|
|
|
(let ((oldbuf (current-buffer)))
|
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create buffer)
|
1999-07-20 16:09:54 +00:00
|
|
|
|
(barf-if-buffer-read-only)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-buffer-substring oldbuf start end)))))
|
|
|
|
|
|
|
|
|
|
(defun copy-to-buffer (buffer start end)
|
|
|
|
|
"Copy to specified buffer the text of the region.
|
|
|
|
|
It is inserted into that buffer, replacing existing text there.
|
|
|
|
|
|
|
|
|
|
When calling from a program, give three arguments:
|
|
|
|
|
BUFFER (or buffer name), START and END.
|
|
|
|
|
START and END specify the portion of the current buffer to be copied."
|
|
|
|
|
(interactive "BCopy to buffer: \nr")
|
|
|
|
|
(let ((oldbuf (current-buffer)))
|
2005-11-01 07:18:10 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create buffer)
|
1999-07-20 16:09:54 +00:00
|
|
|
|
(barf-if-buffer-read-only)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(insert-buffer-substring oldbuf start end)))))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
* lisp/subr.el (define-error): New function.
* doc/lispref/control.texi (Signaling Errors): Refer to define-error.
(Error Symbols): Add `define-error'.
* doc/lispref/errors.texi (Standard Errors): Don't refer to `error-conditions'.
* lisp/progmodes/ada-xref.el (ada-error-file-not-found): Rename from
error-file-not-found and define with define-error.
* lisp/emacs-lisp/cl-lib.el (cl-assertion-failed): Move here from subr.el
and define with define-error.
* lisp/userlock.el (file-locked, file-supersession):
* lisp/simple.el (mark-inactive):
* lisp/progmodes/js.el (js-moz-bad-rpc, js-js-error):
* lisp/progmodes/ada-mode.el (ada-mode-errors):
* lisp/play/life.el (life-extinct):
* lisp/nxml/xsd-regexp.el (xsdre-invalid-regexp, xsdre-parse-error):
* lisp/nxml/xmltok.el (xmltok-markup-declaration-parse-error):
* lisp/nxml/rng-util.el (rng-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-cmpct.el (rng-c-incorrect-schema):
* lisp/nxml/nxml-util.el (nxml-error, nxml-file-parse-error):
* lisp/nxml/nxml-rap.el (nxml-scan-error):
* lisp/nxml/nxml-outln.el (nxml-outline-error):
* lisp/net/soap-client.el (soap-error):
* lisp/net/gnutls.el (gnutls-error):
* lisp/net/ange-ftp.el (ftp-error):
* lisp/mpc.el (mpc-proc-error):
* lisp/json.el (json-error, json-readtable-error, json-unknown-keyword)
(json-number-format, json-string-escape, json-string-format)
(json-key-format, json-object-format):
* lisp/jka-compr.el (compression-error):
* lisp/international/quail.el (quail-error):
* lisp/international/kkc.el (kkc-error):
* lisp/emacs-lisp/ert.el (ert-test-failed):
* lisp/calc/calc.el (calc-error, inexact-result, math-overflow)
(math-underflow):
* lisp/bookmark.el (bookmark-error-no-filename):
* lisp/epg.el (epg-error): Define with define-error.
2013-08-09 17:22:44 -04:00
|
|
|
|
(define-error 'mark-inactive (purecopy "The mark is not active now"))
|
1993-07-08 21:46:22 +00:00
|
|
|
|
|
2005-03-06 20:16:01 +00:00
|
|
|
|
(defvar activate-mark-hook nil
|
|
|
|
|
"Hook run when the mark becomes active.
|
|
|
|
|
It is also run at the end of a command, if the mark is active and
|
2007-04-03 11:10:09 +00:00
|
|
|
|
it is possible that the region may have changed.")
|
2005-03-06 20:16:01 +00:00
|
|
|
|
|
|
|
|
|
(defvar deactivate-mark-hook nil
|
|
|
|
|
"Hook run when the mark becomes inactive.")
|
|
|
|
|
|
1993-03-09 05:40:33 +00:00
|
|
|
|
(defun mark (&optional force)
|
2006-01-05 15:59:50 +00:00
|
|
|
|
"Return this buffer's mark value as integer, or nil if never set.
|
|
|
|
|
|
|
|
|
|
In Transient Mark mode, this function signals an error if
|
|
|
|
|
the mark is not active. However, if `mark-even-if-inactive' is non-nil,
|
|
|
|
|
or the argument FORCE is non-nil, it disregards whether the mark
|
|
|
|
|
is active, and returns an integer or nil in the usual way.
|
1993-03-09 05:40:33 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
If you are using this in an editing command, you are most likely making
|
|
|
|
|
a mistake; see the documentation of `set-mark'."
|
1995-01-23 22:37:46 +00:00
|
|
|
|
(if (or force (not transient-mark-mode) mark-active mark-even-if-inactive)
|
1993-03-09 05:40:33 +00:00
|
|
|
|
(marker-position (mark-marker))
|
1993-07-08 21:46:22 +00:00
|
|
|
|
(signal 'mark-inactive nil)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2013-09-19 16:31:26 -04:00
|
|
|
|
;; Behind display-selections-p.
|
|
|
|
|
|
2013-04-18 09:15:08 -04:00
|
|
|
|
(defun deactivate-mark (&optional force)
|
2012-01-28 22:29:29 +08:00
|
|
|
|
"Deactivate the mark.
|
|
|
|
|
If Transient Mark mode is disabled, this function normally does
|
|
|
|
|
nothing; but if FORCE is non-nil, it deactivates the mark anyway.
|
|
|
|
|
|
|
|
|
|
Deactivating the mark sets `mark-active' to nil, updates the
|
|
|
|
|
primary selection according to `select-active-regions', and runs
|
|
|
|
|
`deactivate-mark-hook'.
|
|
|
|
|
|
|
|
|
|
If Transient Mark mode was temporarily enabled, reset the value
|
|
|
|
|
of the variable `transient-mark-mode'; if this causes Transient
|
|
|
|
|
Mark mode to be disabled, don't change `mark-active' to nil or
|
|
|
|
|
run `deactivate-mark-hook'."
|
2014-11-03 17:27:26 -05:00
|
|
|
|
(when (or (region-active-p) force)
|
2010-08-15 22:33:17 -04:00
|
|
|
|
(when (and (if (eq select-active-regions 'only)
|
|
|
|
|
(eq (car-safe transient-mark-mode) 'only)
|
|
|
|
|
select-active-regions)
|
2010-08-07 15:39:04 -04:00
|
|
|
|
(region-active-p)
|
|
|
|
|
(display-selections-p))
|
|
|
|
|
;; The var `saved-region-selection', if non-nil, is the text in
|
|
|
|
|
;; the region prior to the last command modifying the buffer.
|
|
|
|
|
;; Set the selection to that, or to the current region.
|
|
|
|
|
(cond (saved-region-selection
|
Replace gui-method macros with cl-generic with &context
* lisp/frame.el (gui-method--name, gui-method, gui-method-define)
(gui-method-declare, gui-call): Remove.
(frame-creation-function): Use cl-defgeneric.
(make-frame): Adjust callers.
* lisp/menu-bar.el (menu-bar-edit-menu):
Use gui-backend-selection-exists-p.
* lisp/select.el (x-get-clipboard): Use gui-backend-get-selection.
(gui-backend-get-selection): New cl-generic to replace
gui-get-selection method.
(gui-backend-set-selection): New cl-generic to replace
gui-set-selection method.
(gui-selection-owner-p): New cl-generic to replace
gui-selection-owner-p method.
(gui-backend-selection-exists-p): New cl-generic to replace
gui-selection-exists-p method. Adjust all callers.
* lisp/server.el (server-create-window-system-frame): Don't ignore
window-system spec even when unsupported.
* lisp/simple.el (deactivate-mark): Use new gui-backend-* functions.
* lisp/startup.el (handle-args-function, window-system-initialization):
Use cl-defgeneric.
(command-line): Adjust calls accordingly.
* lisp/term/ns-win.el (ns-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/pc-win.el (w16-get-selection-value): Turn into
a gui-backend-get-selection method.
(gui-selection-exists-p, gui-selection-owner-p, gui-set-selection):
Use cl-defmethod on the new functions instead.
(msdos-window-system-initialization): Turn into
a window-system-initialization method.
(frame-creation-function, handle-args-function): Use cl-defmethod.
* lisp/term/w32-win.el (w32-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/x-win.el (x-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/xterm.el (xterm--set-selection): Turn into
a gui-backend-set-selection method.
* src/nsselect.m (Fns_selection_exists_p): Remove unused arg `terminal'.
(Fns_selection_owner_p): Remove unused arg `terminal'.
(Fns_get_selection): Remove unused args `time_stamp' and `terminal'.
2015-05-23 11:32:29 -04:00
|
|
|
|
(if (gui-backend-selection-owner-p 'PRIMARY)
|
2015-03-23 10:30:33 -07:00
|
|
|
|
(gui-set-selection 'PRIMARY saved-region-selection))
|
2010-08-07 15:39:04 -04:00
|
|
|
|
(setq saved-region-selection nil))
|
2012-07-08 14:09:21 +08:00
|
|
|
|
;; If another program has acquired the selection, region
|
|
|
|
|
;; deactivation should not clobber it (Bug#11772).
|
|
|
|
|
((and (/= (region-beginning) (region-end))
|
Replace gui-method macros with cl-generic with &context
* lisp/frame.el (gui-method--name, gui-method, gui-method-define)
(gui-method-declare, gui-call): Remove.
(frame-creation-function): Use cl-defgeneric.
(make-frame): Adjust callers.
* lisp/menu-bar.el (menu-bar-edit-menu):
Use gui-backend-selection-exists-p.
* lisp/select.el (x-get-clipboard): Use gui-backend-get-selection.
(gui-backend-get-selection): New cl-generic to replace
gui-get-selection method.
(gui-backend-set-selection): New cl-generic to replace
gui-set-selection method.
(gui-selection-owner-p): New cl-generic to replace
gui-selection-owner-p method.
(gui-backend-selection-exists-p): New cl-generic to replace
gui-selection-exists-p method. Adjust all callers.
* lisp/server.el (server-create-window-system-frame): Don't ignore
window-system spec even when unsupported.
* lisp/simple.el (deactivate-mark): Use new gui-backend-* functions.
* lisp/startup.el (handle-args-function, window-system-initialization):
Use cl-defgeneric.
(command-line): Adjust calls accordingly.
* lisp/term/ns-win.el (ns-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/pc-win.el (w16-get-selection-value): Turn into
a gui-backend-get-selection method.
(gui-selection-exists-p, gui-selection-owner-p, gui-set-selection):
Use cl-defmethod on the new functions instead.
(msdos-window-system-initialization): Turn into
a window-system-initialization method.
(frame-creation-function, handle-args-function): Use cl-defmethod.
* lisp/term/w32-win.el (w32-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/x-win.el (x-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/xterm.el (xterm--set-selection): Turn into
a gui-backend-set-selection method.
* src/nsselect.m (Fns_selection_exists_p): Remove unused arg `terminal'.
(Fns_selection_owner_p): Remove unused arg `terminal'.
(Fns_get_selection): Remove unused args `time_stamp' and `terminal'.
2015-05-23 11:32:29 -04:00
|
|
|
|
(or (gui-backend-selection-owner-p 'PRIMARY)
|
|
|
|
|
(null (gui-backend-selection-exists-p 'PRIMARY))))
|
Consolidate management/ownership of selections.
* lisp/select.el (gui-get-selection-alist): New method.
(gui-get-selection): Use it. Rename from x-get-selection.
(x-get-selection): Define as obsolete alias.
(x-get-clipboard): Mark obsolete.
(gui-get-primary-selection): New function.
(x-get-selection-value): Mark obsolete.
(gui-own-selection-alist, gui-disown-selection-alist)
(gui-selection-owner-p-alist): New methods.
(gui-set-selection): Use them. Rename from x-set-selection.
(x-set-selection): Define as obsolete alias.
(gui--valid-simple-selection-p): Rename from
x-valid-simple-selection-p.
* lisp/w32-common-fns.el (gui-own-selection, gui-disown-selection)
(gui-selection-owner-p, gui-get-selection): Define for w32.
(w32-get-selection-value): Rename from x-get-selection-value.
Use the new gui-last-selected-text.
* lisp/term/x-win.el (x-get-selection-value): Remove.
(x-clipboard-yank): Declare obsolete.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for x.
* lisp/term/w32-win.el (w32-win-suspend-error): Rename from
x-win-suspend-error.
* lisp/term/pc-win.el (w16-get-selection-value): Rename from
x-get-selection-value.
(w16-selection-owner-p): Rename from x-selection-owner-p.
(gui-own-selection, gui-disown-selection, gui-get-selection)
(gui-selection-owner-p): Define for pc.
(w16--select-text): New function.
* lisp/term/ns-win.el (gui-own-selection, gui-disown-selection)
(gui-get-selection, gui-selection-owner-p): Define for ns.
* lisp/term.el (term-mouse-paste):
* lisp/mouse.el (mouse-yank-primary): Use gui-get-primary-selection.
* src/nsselect.m (ns-own-selection-internal, ns-disown-selection-internal):
Rename from the "x-" prefix.
2014-10-01 23:19:32 -04:00
|
|
|
|
(gui-set-selection 'PRIMARY
|
|
|
|
|
(funcall region-extract-function nil)))))
|
2014-01-08 20:59:19 -05:00
|
|
|
|
(when mark-active (force-mode-line-update)) ;Refresh toolbar (bug#16382).
|
2014-05-27 10:59:08 -04:00
|
|
|
|
(cond
|
|
|
|
|
((eq (car-safe transient-mark-mode) 'only)
|
2014-07-01 14:13:28 -04:00
|
|
|
|
(setq transient-mark-mode (cdr transient-mark-mode))
|
|
|
|
|
(if (eq transient-mark-mode (default-value 'transient-mark-mode))
|
|
|
|
|
(kill-local-variable 'transient-mark-mode)))
|
2014-05-27 10:59:08 -04:00
|
|
|
|
((eq transient-mark-mode 'lambda)
|
2014-07-01 14:13:28 -04:00
|
|
|
|
(kill-local-variable 'transient-mark-mode)))
|
2014-05-27 10:59:08 -04:00
|
|
|
|
(setq mark-active nil)
|
|
|
|
|
(run-hooks 'deactivate-mark-hook)
|
2014-03-19 15:12:50 -04:00
|
|
|
|
(redisplay--update-region-highlight (selected-window))))
|
1993-07-08 22:37:42 +00:00
|
|
|
|
|
2014-01-08 20:59:19 -05:00
|
|
|
|
(defun activate-mark (&optional no-tmm)
|
|
|
|
|
"Activate the mark.
|
|
|
|
|
If NO-TMM is non-nil, leave `transient-mark-mode' alone."
|
2008-03-26 03:40:40 +00:00
|
|
|
|
(when (mark t)
|
2014-03-11 13:10:07 -04:00
|
|
|
|
(unless (region-active-p)
|
|
|
|
|
(force-mode-line-update) ;Refresh toolbar (bug#16382).
|
|
|
|
|
(setq mark-active t)
|
|
|
|
|
(unless (or transient-mark-mode no-tmm)
|
2014-06-23 11:32:24 -04:00
|
|
|
|
(setq-local transient-mark-mode 'lambda))
|
2014-03-11 13:10:07 -04:00
|
|
|
|
(run-hooks 'activate-mark-hook))))
|
2007-12-25 20:02:45 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun set-mark (pos)
|
|
|
|
|
"Set this buffer's mark to POS. Don't use this function!
|
|
|
|
|
That is to say, don't use this function unless you want
|
|
|
|
|
the user to see that the mark has moved, and you want the previous
|
|
|
|
|
mark position to be lost.
|
|
|
|
|
|
|
|
|
|
Normally, when a new mark is set, the old one should go on the stack.
|
2005-03-29 23:17:30 +00:00
|
|
|
|
This is why most applications should use `push-mark', not `set-mark'.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1992-08-21 07:18:16 +00:00
|
|
|
|
Novice Emacs Lisp programmers often try to use the mark for the wrong
|
1991-12-21 09:29:41 +00:00
|
|
|
|
purposes. The mark saves a location for the user's convenience.
|
|
|
|
|
Most editing commands should not alter the mark.
|
|
|
|
|
To remember a location for internal use in the Lisp program,
|
|
|
|
|
store it in a Lisp variable. Example:
|
|
|
|
|
|
|
|
|
|
(let ((beg (point))) (forward-line 1) (delete-region beg (point)))."
|
1993-07-26 07:31:11 +00:00
|
|
|
|
(if pos
|
2014-03-11 13:10:07 -04:00
|
|
|
|
(progn
|
|
|
|
|
(set-marker (mark-marker) pos (current-buffer))
|
|
|
|
|
(activate-mark 'no-tmm))
|
1994-08-30 00:36:48 +00:00
|
|
|
|
;; Normally we never clear mark-active except in Transient Mark mode.
|
2009-07-15 01:25:32 +00:00
|
|
|
|
;; But when we actually clear out the mark value too, we must
|
|
|
|
|
;; clear mark-active in any mode.
|
2014-03-11 13:10:07 -04:00
|
|
|
|
(deactivate-mark t)
|
|
|
|
|
;; `deactivate-mark' sometimes leaves mark-active non-nil, but
|
|
|
|
|
;; it should never be nil if the mark is nil.
|
|
|
|
|
(setq mark-active nil)
|
|
|
|
|
(set-marker (mark-marker) nil)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2015-05-04 11:46:12 -07:00
|
|
|
|
(defun save-mark-and-excursion--save ()
|
|
|
|
|
(cons
|
|
|
|
|
(let ((mark (mark-marker)))
|
2015-05-04 15:40:55 -07:00
|
|
|
|
(and (marker-position mark) (copy-marker mark)))
|
2015-05-04 11:46:12 -07:00
|
|
|
|
mark-active))
|
|
|
|
|
|
|
|
|
|
(defun save-mark-and-excursion--restore (saved-mark-info)
|
|
|
|
|
(let ((saved-mark (car saved-mark-info))
|
|
|
|
|
(omark (marker-position (mark-marker)))
|
|
|
|
|
(nmark nil)
|
|
|
|
|
(saved-mark-active (cdr saved-mark-info)))
|
|
|
|
|
;; Mark marker
|
|
|
|
|
(if (null saved-mark)
|
2015-05-04 15:40:55 -07:00
|
|
|
|
(set-marker (mark-marker) nil)
|
2015-05-04 11:46:12 -07:00
|
|
|
|
(setf nmark (marker-position saved-mark))
|
|
|
|
|
(set-marker (mark-marker) nmark)
|
|
|
|
|
(set-marker saved-mark nil))
|
|
|
|
|
;; Mark active
|
|
|
|
|
(let ((cur-mark-active mark-active))
|
2015-05-04 15:40:55 -07:00
|
|
|
|
(setq mark-active saved-mark-active)
|
2015-05-04 11:46:12 -07:00
|
|
|
|
;; If mark is active now, and either was not active or was at a
|
|
|
|
|
;; different place, run the activate hook.
|
|
|
|
|
(if saved-mark-active
|
2015-05-04 15:40:55 -07:00
|
|
|
|
(when (or (not cur-mark-active)
|
|
|
|
|
(not (eq omark nmark)))
|
2015-05-04 11:46:12 -07:00
|
|
|
|
(run-hooks 'activate-mark-hook))
|
|
|
|
|
;; If mark has ceased to be active, run deactivate hook.
|
|
|
|
|
(when cur-mark-active
|
|
|
|
|
(run-hooks 'deactivate-mark-hook))))))
|
|
|
|
|
|
|
|
|
|
(defmacro save-mark-and-excursion (&rest body)
|
|
|
|
|
"Like `save-excursion', but also save and restore the mark state.
|
|
|
|
|
This macro does what `save-excursion' did before Emacs 25.1."
|
2016-07-03 18:53:39 -04:00
|
|
|
|
(declare (indent 0) (debug t))
|
2015-05-04 11:46:12 -07:00
|
|
|
|
(let ((saved-marker-sym (make-symbol "saved-marker")))
|
|
|
|
|
`(let ((,saved-marker-sym (save-mark-and-excursion--save)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(save-excursion ,@body)
|
|
|
|
|
(save-mark-and-excursion--restore ,saved-marker-sym)))))
|
|
|
|
|
|
2007-12-23 21:46:25 +00:00
|
|
|
|
(defcustom use-empty-active-region nil
|
2008-11-27 17:01:50 +00:00
|
|
|
|
"Whether \"region-aware\" commands should act on empty regions.
|
2016-04-29 17:54:55 +02:00
|
|
|
|
If nil, region-aware commands treat the empty region as inactive.
|
2008-11-27 17:01:50 +00:00
|
|
|
|
If non-nil, region-aware commands treat the region as active as
|
|
|
|
|
long as the mark is active, even if the region is empty.
|
|
|
|
|
|
2008-11-27 17:07:25 +00:00
|
|
|
|
Region-aware commands are those that act on the region if it is
|
|
|
|
|
active and Transient Mark mode is enabled, and on the text near
|
|
|
|
|
point otherwise."
|
2007-12-23 21:46:25 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "23.1"
|
|
|
|
|
:group 'editing-basics)
|
|
|
|
|
|
2007-12-25 22:12:56 +00:00
|
|
|
|
(defun use-region-p ()
|
2008-11-27 17:01:50 +00:00
|
|
|
|
"Return t if the region is active and it is appropriate to act on it.
|
|
|
|
|
This is used by commands that act specially on the region under
|
2009-07-18 17:39:35 +00:00
|
|
|
|
Transient Mark mode.
|
2008-11-27 17:01:50 +00:00
|
|
|
|
|
2010-07-10 15:32:53 -04:00
|
|
|
|
The return value is t if Transient Mark mode is enabled and the
|
2010-07-10 18:41:55 -04:00
|
|
|
|
mark is active; furthermore, if `use-empty-active-region' is nil,
|
|
|
|
|
the region must not be empty. Otherwise, the return value is nil.
|
2009-07-18 17:39:35 +00:00
|
|
|
|
|
|
|
|
|
For some commands, it may be appropriate to ignore the value of
|
|
|
|
|
`use-empty-active-region'; in that case, use `region-active-p'."
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(and (region-active-p)
|
2007-12-23 21:46:25 +00:00
|
|
|
|
(or use-empty-active-region (> (region-end) (region-beginning)))))
|
|
|
|
|
|
2007-12-25 22:43:44 +00:00
|
|
|
|
(defun region-active-p ()
|
2015-02-24 22:50:44 -03:00
|
|
|
|
"Return non-nil if Transient Mark mode is enabled and the mark is active.
|
2008-11-27 17:01:50 +00:00
|
|
|
|
|
2009-07-18 17:39:35 +00:00
|
|
|
|
Some commands act specially on the region when Transient Mark
|
|
|
|
|
mode is enabled. Usually, such commands should use
|
|
|
|
|
`use-region-p' instead of this function, because `use-region-p'
|
|
|
|
|
also checks the value of `use-empty-active-region'."
|
2014-04-23 08:52:22 -04:00
|
|
|
|
(and transient-mark-mode mark-active
|
|
|
|
|
;; FIXME: Somehow we sometimes end up with mark-active non-nil but
|
|
|
|
|
;; without the mark being set (e.g. bug#17324). We really should fix
|
|
|
|
|
;; that problem, but in the mean time, let's make sure we don't say the
|
|
|
|
|
;; region is active when there's no mark.
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 15:51:15 -04:00
|
|
|
|
(progn (cl-assert (mark)) t)))
|
2007-12-25 22:43:44 +00:00
|
|
|
|
|
2017-01-22 01:18:53 +02:00
|
|
|
|
(defun region-bounds ()
|
2018-10-27 13:50:34 +03:00
|
|
|
|
"Return the boundaries of the region.
|
|
|
|
|
Value is a list of one or more cons cells of the form (START . END).
|
|
|
|
|
It will have more than one cons cell when the region is non-contiguous,
|
|
|
|
|
see `region-noncontiguous-p' and `extract-rectangle-bounds'."
|
2017-01-22 01:18:53 +02:00
|
|
|
|
(funcall region-extract-function 'bounds))
|
|
|
|
|
|
2015-11-14 01:28:03 +02:00
|
|
|
|
(defun region-noncontiguous-p ()
|
|
|
|
|
"Return non-nil if the region contains several pieces.
|
|
|
|
|
An example is a rectangular region handled as a list of
|
|
|
|
|
separate contiguous regions for each line."
|
2017-01-22 01:18:53 +02:00
|
|
|
|
(> (length (region-bounds)) 1))
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
|
|
|
|
|
(defvar redisplay-unhighlight-region-function
|
|
|
|
|
(lambda (rol) (when (overlayp rol) (delete-overlay rol))))
|
|
|
|
|
|
|
|
|
|
(defvar redisplay-highlight-region-function
|
|
|
|
|
(lambda (start end window rol)
|
|
|
|
|
(if (not (overlayp rol))
|
|
|
|
|
(let ((nrol (make-overlay start end)))
|
|
|
|
|
(funcall redisplay-unhighlight-region-function rol)
|
|
|
|
|
(overlay-put nrol 'window window)
|
|
|
|
|
(overlay-put nrol 'face 'region)
|
2014-03-23 18:30:47 -04:00
|
|
|
|
;; Normal priority so that a large region doesn't hide all the
|
|
|
|
|
;; overlays within it, but high secondary priority so that if it
|
|
|
|
|
;; ends/starts in the middle of a small overlay, that small overlay
|
|
|
|
|
;; won't hide the region's boundaries.
|
|
|
|
|
(overlay-put nrol 'priority '(nil . 100))
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
nrol)
|
|
|
|
|
(unless (and (eq (overlay-buffer rol) (current-buffer))
|
|
|
|
|
(eq (overlay-start rol) start)
|
|
|
|
|
(eq (overlay-end rol) end))
|
|
|
|
|
(move-overlay rol start end (current-buffer)))
|
|
|
|
|
rol)))
|
|
|
|
|
|
|
|
|
|
(defun redisplay--update-region-highlight (window)
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 15:51:15 -04:00
|
|
|
|
(let ((rol (window-parameter window 'internal-region-overlay)))
|
|
|
|
|
(if (not (and (region-active-p)
|
|
|
|
|
(or highlight-nonselected-windows
|
|
|
|
|
(eq window (selected-window))
|
|
|
|
|
(and (window-minibuffer-p)
|
|
|
|
|
(eq window (minibuffer-selected-window))))))
|
|
|
|
|
(funcall redisplay-unhighlight-region-function rol)
|
|
|
|
|
(let* ((pt (window-point window))
|
|
|
|
|
(mark (mark))
|
|
|
|
|
(start (min pt mark))
|
|
|
|
|
(end (max pt mark))
|
|
|
|
|
(new
|
|
|
|
|
(funcall redisplay-highlight-region-function
|
|
|
|
|
start end window rol)))
|
|
|
|
|
(unless (equal new rol)
|
|
|
|
|
(set-window-parameter window 'internal-region-overlay
|
|
|
|
|
new))))))
|
|
|
|
|
|
|
|
|
|
(defvar pre-redisplay-functions (list #'redisplay--update-region-highlight)
|
|
|
|
|
"Hook run just before redisplay.
|
|
|
|
|
It is called in each window that is to be redisplayed. It takes one argument,
|
|
|
|
|
which is the window that will be redisplayed. When run, the `current-buffer'
|
|
|
|
|
is set to the buffer displayed in that window.")
|
|
|
|
|
|
|
|
|
|
(defun redisplay--pre-redisplay-functions (windows)
|
|
|
|
|
(with-demoted-errors "redisplay--pre-redisplay-functions: %S"
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
(if (null windows)
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 15:51:15 -04:00
|
|
|
|
(with-current-buffer (window-buffer (selected-window))
|
|
|
|
|
(run-hook-with-args 'pre-redisplay-functions (selected-window)))
|
|
|
|
|
(dolist (win (if (listp windows) windows (window-list-1 nil nil t)))
|
|
|
|
|
(with-current-buffer (window-buffer win)
|
|
|
|
|
(run-hook-with-args 'pre-redisplay-functions win))))))
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
|
|
|
|
|
(add-function :before pre-redisplay-function
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 15:51:15 -04:00
|
|
|
|
#'redisplay--pre-redisplay-functions)
|
Add pre-redisplay-function and rectangular region
* lisp/rect.el: Use lexical-binding. Add new rectangular region support.
(rectangle-mark): New command.
(rectangle--region): New var.
(deactivate-mark-hook): Reset rectangle--region.
(rectangle--extract-region, rectangle--insert-for-yank)
(rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay): New functions.
(region-extract-function, redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): Use them to handle
rectangular region.
* lisp/simple.el (region-extract-function): New var.
(delete-backward-char, delete-forward-char, deactivate-mark): Use it.
(kill-new, kill-append): Remove obsolete `yank-handler' argument.
(kill-region): Replace obsolete `yank-handler' arg with `region'.
(copy-region-as-kill, kill-ring-save): Add `region' argument.
(redisplay-unhighlight-region-function)
(redisplay-highlight-region-function): New vars.
(redisplay--update-region-highlight): New function.
(pre-redisplay-function): Use it.
(exchange-point-and-mark): Don't deactivate the mark before
reactivate-it anyway.
* lisp/comint.el (comint-kill-region): Remove yank-handler argument.
* lisp/delsel.el (delete-backward-char, backward-delete-char-untabify)
(delete-char): Remove property, since it's now part of their
default behavior.
(self-insert-iso): Remove property since this command doesn't exist.
* src/xdisp.c (prepare_menu_bars): Call Vpre_redisplay_function.
(syms_of_xdisp): Declare pre-redisplay-function.
(markpos_of_region): Remove function.
(init_iterator, compute_stop_pos, handle_face_prop)
(face_before_or_after_it_pos, reseat_to_string)
(get_next_display_element, window_buffer_changed)
(redisplay_internal, try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id, display_line)
(note_mode_line_or_margin_highlight, note_mouse_highlight)
(display_string, mouse_face_from_buffer_pos): Remove region handling.
* src/window.h (struct window): Remove field `region_showing'.
* src/dispextern.h (struct it): Remove region_beg/end_charpos.
(face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Update prototypes.
* src/xfaces.c (face_at_buffer_position, face_for_overlay_string)
(face_at_string_position): Remove `region_beg' and `region_end' args.
* src/fontset.c (Finternal_char_font):
* src/font.c (font_at, font_range): Adjust calls accordingly.
* src/insdel.c (Qregion_extract_function): New var.
(syms_of_insdel): Initialize it.
(prepare_to_modify_buffer_1): Use it.
2013-10-29 12:11:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar-local mark-ring nil
|
1994-09-03 23:33:50 +00:00
|
|
|
|
"The list of former marks of the current buffer, most recent first.")
|
|
|
|
|
(put 'mark-ring 'permanent-local t)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom mark-ring-max 16
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Maximum size of mark ring. Start discarding off end if gets this big."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'editing-basics)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1994-02-07 02:24:01 +00:00
|
|
|
|
(defvar global-mark-ring nil
|
|
|
|
|
"The list of saved global marks, most recent first.")
|
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom global-mark-ring-max 16
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Maximum size of global mark ring. \
|
1997-05-05 11:57:31 +00:00
|
|
|
|
Start discarding off end if gets this big."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'editing-basics)
|
1994-02-07 02:24:01 +00:00
|
|
|
|
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(defun pop-to-mark-command ()
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
"Jump to mark, and pop a new position for mark off the ring.
|
2014-02-21 14:22:14 +01:00
|
|
|
|
\(Does not affect global mark ring)."
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (null (mark t))
|
2015-02-18 07:35:49 +00:00
|
|
|
|
(user-error "No mark set in this buffer")
|
2007-04-21 08:55:15 +00:00
|
|
|
|
(if (= (point) (mark t))
|
|
|
|
|
(message "Mark popped"))
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(goto-char (mark t))
|
|
|
|
|
(pop-mark)))
|
|
|
|
|
|
2002-05-27 12:13:56 +00:00
|
|
|
|
(defun push-mark-command (arg &optional nomsg)
|
2002-04-14 17:27:55 +00:00
|
|
|
|
"Set mark at where point is.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
If no prefix ARG and mark is already set there, just activate it.
|
2002-05-27 12:13:56 +00:00
|
|
|
|
Display `Mark set' unless the optional second arg NOMSG is non-nil."
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(interactive "P")
|
2014-01-08 20:59:19 -05:00
|
|
|
|
(let ((mark (mark t)))
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(if (or arg (null mark) (/= mark (point)))
|
2002-05-27 12:13:56 +00:00
|
|
|
|
(push-mark nil nomsg t)
|
2014-01-08 20:59:19 -05:00
|
|
|
|
(activate-mark 'no-tmm)
|
2002-05-27 12:13:56 +00:00
|
|
|
|
(unless nomsg
|
|
|
|
|
(message "Mark activated")))))
|
2002-04-14 17:27:55 +00:00
|
|
|
|
|
2005-11-03 21:41:20 +00:00
|
|
|
|
(defcustom set-mark-command-repeat-pop nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Non-nil means repeating \\[set-mark-command] after popping mark pops it again.
|
2007-04-23 21:16:31 +00:00
|
|
|
|
That means that C-u \\[set-mark-command] \\[set-mark-command]
|
|
|
|
|
will pop the mark twice, and
|
|
|
|
|
C-u \\[set-mark-command] \\[set-mark-command] \\[set-mark-command]
|
|
|
|
|
will pop the mark three times.
|
|
|
|
|
|
2007-05-16 11:26:41 +00:00
|
|
|
|
A value of nil means \\[set-mark-command]'s behavior does not change
|
2007-04-23 21:16:31 +00:00
|
|
|
|
after C-u \\[set-mark-command]."
|
2005-11-03 21:41:20 +00:00
|
|
|
|
:type 'boolean
|
2007-04-23 21:19:11 +00:00
|
|
|
|
:group 'editing-basics)
|
2005-11-03 21:41:20 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun set-mark-command (arg)
|
2016-11-07 19:04:19 +02:00
|
|
|
|
"Set the mark where point is, and activate it; or jump to the mark.
|
2007-04-21 08:55:15 +00:00
|
|
|
|
Setting the mark also alters the region, which is the text
|
|
|
|
|
between point and mark; this is the closest equivalent in
|
|
|
|
|
Emacs to what some editors call the \"selection\".
|
2007-04-09 07:51:37 +00:00
|
|
|
|
|
2007-04-21 08:55:15 +00:00
|
|
|
|
With no prefix argument, set the mark at point, and push the
|
2016-11-07 19:04:19 +02:00
|
|
|
|
old mark position on local mark ring. Also push the new mark on
|
2007-04-21 08:55:15 +00:00
|
|
|
|
global mark ring, if the previous mark was set in another buffer.
|
2007-04-09 07:51:37 +00:00
|
|
|
|
|
2008-03-11 02:00:08 +00:00
|
|
|
|
When Transient Mark Mode is off, immediately repeating this
|
|
|
|
|
command activates `transient-mark-mode' temporarily.
|
2003-03-21 23:49:23 +00:00
|
|
|
|
|
2014-02-21 14:22:14 +01:00
|
|
|
|
With prefix argument (e.g., \\[universal-argument] \\[set-mark-command]), \
|
2007-04-21 08:55:15 +00:00
|
|
|
|
jump to the mark, and set the mark from
|
2014-02-21 14:22:14 +01:00
|
|
|
|
position popped off the local mark ring (this does not affect the global
|
|
|
|
|
mark ring). Use \\[pop-global-mark] to jump to a mark popped off the global
|
|
|
|
|
mark ring (see `pop-global-mark').
|
2003-03-24 11:00:39 +00:00
|
|
|
|
|
2006-01-20 01:22:07 +00:00
|
|
|
|
If `set-mark-command-repeat-pop' is non-nil, repeating
|
2007-04-09 07:51:37 +00:00
|
|
|
|
the \\[set-mark-command] command with no prefix argument pops the next position
|
2006-01-20 01:22:07 +00:00
|
|
|
|
off the local (or global) mark ring and jumps there.
|
2003-03-21 23:49:23 +00:00
|
|
|
|
|
2007-04-21 08:55:15 +00:00
|
|
|
|
With \\[universal-argument] \\[universal-argument] as prefix
|
|
|
|
|
argument, unconditionally set mark where point is, even if
|
|
|
|
|
`set-mark-command-repeat-pop' is non-nil.
|
2006-03-20 15:08:28 +00:00
|
|
|
|
|
1992-08-21 07:18:16 +00:00
|
|
|
|
Novice Emacs Lisp programmers often try to use the mark for the wrong
|
1991-12-21 09:29:41 +00:00
|
|
|
|
purposes. See the documentation of `set-mark' for more information."
|
|
|
|
|
(interactive "P")
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(cond ((eq transient-mark-mode 'lambda)
|
2014-07-01 14:13:28 -04:00
|
|
|
|
(kill-local-variable 'transient-mark-mode))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
((eq (car-safe transient-mark-mode) 'only)
|
|
|
|
|
(deactivate-mark)))
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(cond
|
2003-03-24 11:00:39 +00:00
|
|
|
|
((and (consp arg) (> (prefix-numeric-value arg) 4))
|
|
|
|
|
(push-mark-command nil))
|
2002-04-14 17:27:55 +00:00
|
|
|
|
((not (eq this-command 'set-mark-command))
|
2002-04-18 22:16:50 +00:00
|
|
|
|
(if arg
|
|
|
|
|
(pop-to-mark-command)
|
|
|
|
|
(push-mark-command t)))
|
2005-11-03 21:41:20 +00:00
|
|
|
|
((and set-mark-command-repeat-pop
|
|
|
|
|
(eq last-command 'pop-global-mark)
|
|
|
|
|
(not arg))
|
2003-03-21 23:49:23 +00:00
|
|
|
|
(setq this-command 'pop-global-mark)
|
|
|
|
|
(pop-global-mark))
|
2014-06-13 11:50:38 -04:00
|
|
|
|
((or (and set-mark-command-repeat-pop
|
|
|
|
|
(eq last-command 'pop-to-mark-command))
|
|
|
|
|
arg)
|
2002-04-18 22:16:50 +00:00
|
|
|
|
(setq this-command 'pop-to-mark-command)
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(pop-to-mark-command))
|
2008-03-26 03:40:40 +00:00
|
|
|
|
((eq last-command 'set-mark-command)
|
|
|
|
|
(if (region-active-p)
|
|
|
|
|
(progn
|
|
|
|
|
(deactivate-mark)
|
|
|
|
|
(message "Mark deactivated"))
|
|
|
|
|
(activate-mark)
|
|
|
|
|
(message "Mark activated")))
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(t
|
2012-12-09 11:40:09 +08:00
|
|
|
|
(push-mark-command nil))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1993-05-16 15:39:39 +00:00
|
|
|
|
(defun push-mark (&optional location nomsg activate)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Set mark at LOCATION (point, by default) and push old mark on mark ring.
|
1994-02-07 04:48:18 +00:00
|
|
|
|
If the last global mark pushed was not in the current buffer,
|
|
|
|
|
also push LOCATION on the global mark ring.
|
1993-05-16 15:39:39 +00:00
|
|
|
|
Display `Mark set' unless the optional second arg NOMSG is non-nil.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1992-08-21 07:18:16 +00:00
|
|
|
|
Novice Emacs Lisp programmers often try to use the mark for the wrong
|
1993-05-15 20:55:02 +00:00
|
|
|
|
purposes. See the documentation of `set-mark' for more information.
|
|
|
|
|
|
2007-05-18 22:56:08 +00:00
|
|
|
|
In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil."
|
2018-04-30 00:58:32 +01:00
|
|
|
|
(when (mark t)
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(let ((old (nth mark-ring-max mark-ring))
|
|
|
|
|
(history-delete-duplicates nil))
|
|
|
|
|
(add-to-history 'mark-ring (copy-marker (mark-marker)) mark-ring-max t)
|
|
|
|
|
(when old
|
|
|
|
|
(set-marker old nil))))
|
1993-05-15 20:55:02 +00:00
|
|
|
|
(set-marker (mark-marker) (or location (point)) (current-buffer))
|
2018-04-30 00:58:32 +01:00
|
|
|
|
;; Don't push the mark on the global mark ring if the last global
|
|
|
|
|
;; mark pushed was in this same buffer.
|
|
|
|
|
(unless (and global-mark-ring
|
|
|
|
|
(eq (marker-buffer (car global-mark-ring)) (current-buffer)))
|
2018-04-29 15:37:45 +01:00
|
|
|
|
(let ((old (nth global-mark-ring-max global-mark-ring))
|
|
|
|
|
(history-delete-duplicates nil))
|
|
|
|
|
(add-to-history
|
|
|
|
|
'global-mark-ring (copy-marker (mark-marker)) global-mark-ring-max t)
|
|
|
|
|
(when old
|
|
|
|
|
(set-marker old nil))))
|
1996-05-29 17:17:34 +00:00
|
|
|
|
(or nomsg executing-kbd-macro (> (minibuffer-depth) 0)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(message "Mark set"))
|
1993-05-16 23:09:57 +00:00
|
|
|
|
(if (or activate (not transient-mark-mode))
|
|
|
|
|
(set-mark (mark t)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defun pop-mark ()
|
|
|
|
|
"Pop off mark ring into the buffer's actual mark.
|
|
|
|
|
Does not set point. Does nothing if mark ring is empty."
|
2003-07-25 12:18:04 +00:00
|
|
|
|
(when mark-ring
|
|
|
|
|
(setq mark-ring (nconc mark-ring (list (copy-marker (mark-marker)))))
|
2018-04-30 00:58:32 +01:00
|
|
|
|
(set-marker (mark-marker) (car mark-ring))
|
|
|
|
|
(set-marker (car mark-ring) nil)
|
|
|
|
|
(unless (mark t) (ding))
|
|
|
|
|
(pop mark-ring))
|
2005-01-12 00:42:57 +00:00
|
|
|
|
(deactivate-mark))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2010-08-04 20:04:29 +02:00
|
|
|
|
(define-obsolete-function-alias
|
|
|
|
|
'exchange-dot-and-mark 'exchange-point-and-mark "23.3")
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(defun exchange-point-and-mark (&optional arg)
|
1993-03-09 05:40:33 +00:00
|
|
|
|
"Put the mark where point is now, and point where the mark is now.
|
|
|
|
|
This command works even when the mark is not active,
|
2002-04-14 17:27:55 +00:00
|
|
|
|
and it reactivates the mark.
|
2008-04-02 20:16:10 +00:00
|
|
|
|
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
If Transient Mark mode is on, a prefix ARG deactivates the mark
|
2008-04-02 20:16:10 +00:00
|
|
|
|
if it is active, and otherwise avoids reactivating it. If
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
Transient Mark mode is off, a prefix ARG enables Transient Mark
|
2008-04-02 20:16:10 +00:00
|
|
|
|
mode temporarily."
|
2002-04-14 17:27:55 +00:00
|
|
|
|
(interactive "P")
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(let ((omark (mark t))
|
|
|
|
|
(temp-highlight (eq (car-safe transient-mark-mode) 'only)))
|
2008-03-26 03:40:40 +00:00
|
|
|
|
(if (null omark)
|
2015-02-18 07:35:49 +00:00
|
|
|
|
(user-error "No mark set in this buffer"))
|
2008-03-26 03:40:40 +00:00
|
|
|
|
(set-mark (point))
|
|
|
|
|
(goto-char omark)
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(cond (temp-highlight
|
2014-06-23 11:32:24 -04:00
|
|
|
|
(setq-local transient-mark-mode (cons 'only transient-mark-mode)))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
((or (and arg (region-active-p)) ; (xor arg (not (region-active-p)))
|
|
|
|
|
(not (or arg (region-active-p))))
|
|
|
|
|
(deactivate-mark))
|
|
|
|
|
(t (activate-mark)))
|
2008-03-26 03:40:40 +00:00
|
|
|
|
nil))
|
1993-05-15 18:47:18 +00:00
|
|
|
|
|
2009-03-27 16:50:14 +00:00
|
|
|
|
(defcustom shift-select-mode t
|
2009-03-26 17:07:54 +00:00
|
|
|
|
"When non-nil, shifted motion keys activate the mark momentarily.
|
|
|
|
|
|
|
|
|
|
While the mark is activated in this way, any shift-translated point
|
|
|
|
|
motion key extends the region, and if Transient Mark mode was off, it
|
|
|
|
|
is temporarily turned on. Furthermore, the mark will be deactivated
|
|
|
|
|
by any subsequent point motion key that was not shift-translated, or
|
|
|
|
|
by any action that normally deactivates the mark in Transient Mark mode.
|
|
|
|
|
|
|
|
|
|
See `this-command-keys-shift-translated' for the meaning of
|
2009-03-27 16:50:14 +00:00
|
|
|
|
shift-translation."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'editing-basics)
|
2009-03-26 17:07:54 +00:00
|
|
|
|
|
|
|
|
|
(defun handle-shift-selection ()
|
2009-04-06 01:21:48 +00:00
|
|
|
|
"Activate/deactivate mark depending on invocation thru shift translation.
|
|
|
|
|
This function is called by `call-interactively' when a command
|
|
|
|
|
with a `^' character in its `interactive' spec is invoked, before
|
|
|
|
|
running the command itself.
|
|
|
|
|
|
|
|
|
|
If `shift-select-mode' is enabled and the command was invoked
|
|
|
|
|
through shift translation, set the mark and activate the region
|
|
|
|
|
temporarily, unless it was already set in this way. See
|
|
|
|
|
`this-command-keys-shift-translated' for the meaning of shift
|
|
|
|
|
translation.
|
|
|
|
|
|
|
|
|
|
Otherwise, if the region has been activated temporarily,
|
|
|
|
|
deactivate it, and restore the variable `transient-mark-mode' to
|
|
|
|
|
its earlier value."
|
2009-03-26 17:07:54 +00:00
|
|
|
|
(cond ((and shift-select-mode this-command-keys-shift-translated)
|
2010-08-07 15:39:04 -04:00
|
|
|
|
(unless (and mark-active
|
|
|
|
|
(eq (car-safe transient-mark-mode) 'only))
|
2014-06-23 11:32:24 -04:00
|
|
|
|
(setq-local transient-mark-mode
|
|
|
|
|
(cons 'only
|
|
|
|
|
(unless (eq transient-mark-mode 'lambda)
|
|
|
|
|
transient-mark-mode)))
|
2009-03-26 17:07:54 +00:00
|
|
|
|
(push-mark nil nil t)))
|
|
|
|
|
((eq (car-safe transient-mark-mode) 'only)
|
|
|
|
|
(setq transient-mark-mode (cdr transient-mark-mode))
|
2014-07-01 14:13:28 -04:00
|
|
|
|
(if (eq transient-mark-mode (default-value 'transient-mark-mode))
|
|
|
|
|
(kill-local-variable 'transient-mark-mode))
|
2009-03-26 17:07:54 +00:00
|
|
|
|
(deactivate-mark))))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
|
2002-09-11 20:46:33 +00:00
|
|
|
|
(define-minor-mode transient-mark-mode
|
1993-05-15 18:47:18 +00:00
|
|
|
|
"Toggle Transient Mark mode.
|
|
|
|
|
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
Transient Mark mode is a global minor mode. When enabled, the
|
2015-02-13 11:09:21 +02:00
|
|
|
|
region is highlighted with the `region' face whenever the mark
|
2018-10-06 21:24:32 +02:00
|
|
|
|
is active. The mark is \"deactivated\" after certain non-motion
|
|
|
|
|
commands, including those that change the text in the buffer, and
|
|
|
|
|
during shift or mouse selection by any unshifted cursor motion
|
|
|
|
|
command (see Info node `Shift Selection' for more details).
|
2001-01-27 11:45:54 +00:00
|
|
|
|
|
2001-03-30 11:37:52 +00:00
|
|
|
|
You can also deactivate the mark by typing \\[keyboard-quit] or
|
|
|
|
|
\\[keyboard-escape-quit].
|
2001-03-30 08:35:49 +00:00
|
|
|
|
|
2012-11-28 15:16:45 +08:00
|
|
|
|
Many commands change their behavior when Transient Mark mode is
|
|
|
|
|
in effect and the mark is active, by acting on the region instead
|
|
|
|
|
of their usual default part of the buffer's text. Examples of
|
|
|
|
|
such commands include \\[comment-dwim], \\[flush-lines], \\[keep-lines],
|
2004-12-13 03:08:52 +00:00
|
|
|
|
\\[query-replace], \\[query-replace-regexp], \\[ispell], and \\[undo].
|
2012-11-28 15:16:45 +08:00
|
|
|
|
To see the documentation of commands which are sensitive to the
|
|
|
|
|
Transient Mark mode, invoke \\[apropos-documentation] and type \"transient\"
|
|
|
|
|
or \"mark.*active\" at the prompt."
|
2008-03-03 02:16:29 +00:00
|
|
|
|
:global t
|
2010-10-28 20:29:29 -07:00
|
|
|
|
;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
|
2014-06-23 11:32:24 -04:00
|
|
|
|
:variable (default-value 'transient-mark-mode))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
|
2005-05-01 18:54:00 +00:00
|
|
|
|
(defvar widen-automatically t
|
|
|
|
|
"Non-nil means it is ok for commands to call `widen' when they want to.
|
|
|
|
|
Some commands will do this in order to go to positions outside
|
|
|
|
|
the current accessible part of the buffer.
|
|
|
|
|
|
|
|
|
|
If `widen-automatically' is nil, these commands will do something else
|
|
|
|
|
as a fallback, and won't change the buffer bounds.")
|
|
|
|
|
|
2010-04-14 11:24:17 -04:00
|
|
|
|
(defvar non-essential nil
|
|
|
|
|
"Whether the currently executing code is performing an essential task.
|
|
|
|
|
This variable should be non-nil only when running code which should not
|
|
|
|
|
disturb the user. E.g. it can be used to prevent Tramp from prompting the
|
|
|
|
|
user for a password when we are simply scanning a set of files in the
|
|
|
|
|
background or displaying possible completions before the user even asked
|
|
|
|
|
for it.")
|
|
|
|
|
|
1994-02-07 02:24:01 +00:00
|
|
|
|
(defun pop-global-mark ()
|
|
|
|
|
"Pop off global mark ring and jump to the top location."
|
|
|
|
|
(interactive)
|
1994-06-14 00:34:43 +00:00
|
|
|
|
;; Pop entries which refer to non-existent buffers.
|
|
|
|
|
(while (and global-mark-ring (not (marker-buffer (car global-mark-ring))))
|
|
|
|
|
(setq global-mark-ring (cdr global-mark-ring)))
|
1994-02-07 02:24:01 +00:00
|
|
|
|
(or global-mark-ring
|
|
|
|
|
(error "No global mark set"))
|
|
|
|
|
(let* ((marker (car global-mark-ring))
|
|
|
|
|
(buffer (marker-buffer marker))
|
|
|
|
|
(position (marker-position marker)))
|
1995-01-05 23:53:01 +00:00
|
|
|
|
(setq global-mark-ring (nconc (cdr global-mark-ring)
|
|
|
|
|
(list (car global-mark-ring))))
|
1994-02-07 02:24:01 +00:00
|
|
|
|
(set-buffer buffer)
|
|
|
|
|
(or (and (>= position (point-min))
|
|
|
|
|
(<= position (point-max)))
|
2005-05-01 18:54:00 +00:00
|
|
|
|
(if widen-automatically
|
2005-08-11 13:58:59 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(error "Global mark position is outside accessible part of buffer")))
|
1994-02-07 02:24:01 +00:00
|
|
|
|
(goto-char position)
|
|
|
|
|
(switch-to-buffer buffer)))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2000-12-02 10:14:48 +00:00
|
|
|
|
(defcustom next-line-add-newlines nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"If non-nil, `next-line' inserts newline to avoid `end of buffer' error."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'boolean
|
2001-01-16 12:13:43 +00:00
|
|
|
|
:version "21.1"
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:group 'editing-basics)
|
1993-04-23 06:50:37 +00:00
|
|
|
|
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(defun next-line (&optional arg try-vscroll)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Move cursor vertically down ARG lines.
|
2005-03-13 23:20:49 +00:00
|
|
|
|
Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
|
2013-07-12 11:33:14 +03:00
|
|
|
|
Non-interactively, use TRY-VSCROLL to control whether to vscroll tall
|
|
|
|
|
lines: if either `auto-window-vscroll' or TRY-VSCROLL is nil, this
|
|
|
|
|
function will not vscroll.
|
|
|
|
|
|
2013-07-12 11:35:42 +03:00
|
|
|
|
ARG defaults to 1.
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
If there is no character in the target line exactly under the current column,
|
|
|
|
|
the cursor is positioned after the character in that line which spans this
|
|
|
|
|
column, or at the end of the line if it is not long enough.
|
1993-04-23 06:50:37 +00:00
|
|
|
|
If there is no line in the buffer after this one, behavior depends on the
|
1994-12-23 17:25:50 +00:00
|
|
|
|
value of `next-line-add-newlines'. If non-nil, it inserts a newline character
|
|
|
|
|
to create a line, and moves the cursor to that line. Otherwise it moves the
|
1995-07-30 00:46:23 +00:00
|
|
|
|
cursor to the end of the buffer.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2008-07-11 18:11:06 +00:00
|
|
|
|
If the variable `line-move-visual' is non-nil, this command moves
|
|
|
|
|
by display lines. Otherwise, it moves by buffer lines, without
|
|
|
|
|
taking variable-width characters or continued lines into account.
|
2016-09-16 12:31:41 +03:00
|
|
|
|
See \\[next-logical-line] for a command that always moves by buffer lines.
|
2008-07-11 18:11:06 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
The command \\[set-goal-column] can be used to create
|
1997-07-04 04:47:05 +00:00
|
|
|
|
a semipermanent goal column for this command.
|
|
|
|
|
Then instead of trying to move exactly vertically (or as close as possible),
|
|
|
|
|
this command moves to the specified goal column (or as close as possible).
|
|
|
|
|
The goal column is stored in the variable `goal-column', which is nil
|
2011-09-16 20:15:16 +03:00
|
|
|
|
when there is no goal column. Note that setting `goal-column'
|
|
|
|
|
overrides `line-move-visual' and causes this command to move by buffer
|
Include interactive-only information in describe-function output
* lisp/help-fns.el (help-fns--interactive-only): New function.
(help-fns-describe-function-functions): Add the above function.
* lisp/simple.el (beginning-of-buffer, end-of-buffer, insert-buffer)
(next-line, previous-line): Remove hand-written interactive-only
information from doc strings, it is auto-generated now.
* lisp/bookmark.el (bookmark-write):
* lisp/epa-mail.el (epa-mail-decrypt, epa-mail-verify, epa-mail-sign)
(epa-mail-import-keys): Mark interactive-only,
and remove hand-written interactive-only information from doc strings.
* lisp/epa.el (epa-decrypt-armor-in-region, epa-verify-region)
(epa-verify-cleartext-in-region, epa-sign-region, epa-encrypt-region):
* lisp/files.el (not-modified):
* lisp/simple.el (mark-whole-buffer): Mark interactive-only.
* doc/lispref/commands.texi (Defining Commands):
Mention that interactive-only also affects describe-function.
* etc/NEWS: Mention this.
2014-03-22 15:36:29 -07:00
|
|
|
|
lines rather than by display lines."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only forward-line))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p\np")
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(or arg (setq arg 1))
|
1994-01-26 17:19:32 +00:00
|
|
|
|
(if (and next-line-add-newlines (= arg 1))
|
2001-01-26 09:23:17 +00:00
|
|
|
|
(if (save-excursion (end-of-line) (eobp))
|
|
|
|
|
;; When adding a newline, don't expand an abbrev.
|
|
|
|
|
(let ((abbrev-mode nil))
|
2001-02-05 10:16:47 +00:00
|
|
|
|
(end-of-line)
|
2005-11-29 23:54:47 +00:00
|
|
|
|
(insert (if use-hard-newlines hard-newline "\n")))
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(line-move arg nil nil try-vscroll))
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2010-03-31 18:16:12 +03:00
|
|
|
|
(condition-case err
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(line-move arg nil nil try-vscroll)
|
2010-03-31 18:16:12 +03:00
|
|
|
|
((beginning-of-buffer end-of-buffer)
|
|
|
|
|
(signal (car err) (cdr err))))
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(line-move arg nil nil try-vscroll)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
nil)
|
|
|
|
|
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(defun previous-line (&optional arg try-vscroll)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Move cursor vertically up ARG lines.
|
2005-03-13 23:20:49 +00:00
|
|
|
|
Interactively, vscroll tall lines if `auto-window-vscroll' is enabled.
|
2013-07-12 11:33:14 +03:00
|
|
|
|
Non-interactively, use TRY-VSCROLL to control whether to vscroll tall
|
|
|
|
|
lines: if either `auto-window-vscroll' or TRY-VSCROLL is nil, this
|
|
|
|
|
function will not vscroll.
|
|
|
|
|
|
2013-07-12 11:35:42 +03:00
|
|
|
|
ARG defaults to 1.
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
If there is no character in the target line exactly over the current column,
|
|
|
|
|
the cursor is positioned after the character in that line which spans this
|
|
|
|
|
column, or at the end of the line if it is not long enough.
|
|
|
|
|
|
2008-07-11 18:11:06 +00:00
|
|
|
|
If the variable `line-move-visual' is non-nil, this command moves
|
|
|
|
|
by display lines. Otherwise, it moves by buffer lines, without
|
|
|
|
|
taking variable-width characters or continued lines into account.
|
2016-09-16 12:31:41 +03:00
|
|
|
|
See \\[previous-logical-line] for a command that always moves by buffer lines.
|
2008-07-11 18:11:06 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
The command \\[set-goal-column] can be used to create
|
1997-07-04 04:47:05 +00:00
|
|
|
|
a semipermanent goal column for this command.
|
|
|
|
|
Then instead of trying to move exactly vertically (or as close as possible),
|
|
|
|
|
this command moves to the specified goal column (or as close as possible).
|
|
|
|
|
The goal column is stored in the variable `goal-column', which is nil
|
2011-09-16 20:15:16 +03:00
|
|
|
|
when there is no goal column. Note that setting `goal-column'
|
|
|
|
|
overrides `line-move-visual' and causes this command to move by buffer
|
Include interactive-only information in describe-function output
* lisp/help-fns.el (help-fns--interactive-only): New function.
(help-fns-describe-function-functions): Add the above function.
* lisp/simple.el (beginning-of-buffer, end-of-buffer, insert-buffer)
(next-line, previous-line): Remove hand-written interactive-only
information from doc strings, it is auto-generated now.
* lisp/bookmark.el (bookmark-write):
* lisp/epa-mail.el (epa-mail-decrypt, epa-mail-verify, epa-mail-sign)
(epa-mail-import-keys): Mark interactive-only,
and remove hand-written interactive-only information from doc strings.
* lisp/epa.el (epa-decrypt-armor-in-region, epa-verify-region)
(epa-verify-cleartext-in-region, epa-sign-region, epa-encrypt-region):
* lisp/files.el (not-modified):
* lisp/simple.el (mark-whole-buffer): Mark interactive-only.
* doc/lispref/commands.texi (Defining Commands):
Mention that interactive-only also affects describe-function.
* etc/NEWS: Mention this.
2014-03-22 15:36:29 -07:00
|
|
|
|
lines rather than by display lines."
|
2014-03-22 15:12:52 -07:00
|
|
|
|
(declare (interactive-only
|
|
|
|
|
"use `forward-line' with negative argument instead."))
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p\np")
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(or arg (setq arg 1))
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2010-03-31 18:16:12 +03:00
|
|
|
|
(condition-case err
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(line-move (- arg) nil nil try-vscroll)
|
2010-03-31 18:16:12 +03:00
|
|
|
|
((beginning-of-buffer end-of-buffer)
|
|
|
|
|
(signal (car err) (cdr err))))
|
2005-03-13 23:20:49 +00:00
|
|
|
|
(line-move (- arg) nil nil try-vscroll))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
nil)
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom track-eol nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Non-nil means vertical motion starting at end of line keeps to ends of lines.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
This means moving to the end of each line moved onto.
|
2008-07-11 18:07:01 +00:00
|
|
|
|
The beginning of a blank line does not count as the end of a line.
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
This has no effect when the variable `line-move-visual' is non-nil."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'editing-basics)
|
|
|
|
|
|
|
|
|
|
(defcustom goal-column nil
|
2011-09-16 20:15:16 +03:00
|
|
|
|
"Semipermanent goal column for vertical motion, as set by \\[set-goal-column], or nil.
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
A non-nil setting overrides the variable `line-move-visual', which see."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type '(choice integer
|
|
|
|
|
(const :tag "None" nil))
|
|
|
|
|
:group 'editing-basics)
|
1992-10-23 08:54:08 +00:00
|
|
|
|
(make-variable-buffer-local 'goal-column)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defvar temporary-goal-column 0
|
|
|
|
|
"Current goal column for vertical motion.
|
2008-07-11 18:07:01 +00:00
|
|
|
|
It is the column where point was at the start of the current run
|
2009-07-11 16:36:05 +00:00
|
|
|
|
of vertical motion commands.
|
|
|
|
|
|
Disambiguate function and variable references in docstrings.
* lisp/comint.el (comint-history-isearch-message): Fix ambiguous doc
string cross-reference(s).
* lisp/ffap.el (ffap-string-at-point-region, ffap-next)
(ffap-string-at-point, ffap-string-around)
(ffap-copy-string-as-kill, ffap-highlight-overlay)
(ffap-literally): Fix ambiguous doc string cross-reference(s).
* lisp/font-lock.el (font-lock-keywords-alist)
(font-lock-removed-keywords-alist): Fix ambiguous doc string
cross-reference(s).
* lisp/help-mode.el (help-xref-symbol-regexp): Add "call" as a hint for
a cross-reference to a function.
* lisp/info.el (Info-find-emacs-command-nodes): Fix ambiguous doc
string cross-reference(s).
* lisp/isearch.el (isearch-message-function, isearch-fail-pos): Fix
ambiguous doc string cross-reference(s).
* lisp/misearch.el (multi-isearch-next-buffer-function): Fix ambiguous
doc string cross-reference(s).
* lisp/newcomment.el (comment-box): Fix ambiguous doc string
cross-reference(s).
* lisp/printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
(pr-setting-database): Fix ambiguous doc string
cross-reference(s).
* lisp/ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
(ps-n-up-filling-database): Fix ambiguous doc string
cross-reference(s).
* lisp/server.el (server-buffer, server-log): Fix ambiguous doc string
cross-reference(s).
* lisp/simple.el (newline, delete-backward-char, delete-forward-char)
(minibuffer-history-isearch-message, kill-line, track-eol)
(temporary-goal-column): Fix ambiguous doc string
cross-reference(s).
* lisp/whitespace.el (whitespace-point)
(whitespace-font-lock-refontify, whitespace-bob-marker)
(whitespace-eob-marker): Fix ambiguous doc string
cross-reference(s).
* lisp/calc/calc.el (calc-highlight-selections-with-faces)
(calc-dispatch): Fix ambiguous doc string cross-reference(s).
* lisp/emacs-lisp/edebug.el (edebug-read, edebug-eval-defun): Fix
ambiguous doc string cross-reference(s).
* lisp/gnus/gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
cross-reference(s).
* lisp/gnus/gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
cross-reference(s).
* lisp/international/mule.el (add-to-coding-system-list): Fix ambiguous
doc string cross-reference(s).
* lisp/progmodes/cc-fonts.el (c-font-lock-keywords-3)
(c++-font-lock-keywords-3, objc-font-lock-keywords-3)
(java-font-lock-keywords-3, idl-font-lock-keywords-3)
(pike-font-lock-keywords-3): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/compile.el (compile): Fix ambiguous doc string
cross-reference(s).
* lisp/progmodes/etags.el (tags-table-files)
(tags-table-files-function, tags-included-tables-function): Fix
ambiguous doc string cross-reference(s).
* lisp/progmodes/gdb-mi.el (gdb, gdb-setup-windows)
(gdb-restore-windows): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/flyspell.el (flyspell-mark-duplications-flag)
(flyspell-default-deplacement-commands): Fix ambiguous doc string
cross-reference(s).
* lisp/textmodes/ispell.el (ispell-accept-output): Fix ambiguous doc
string cross-reference(s).
* lisp/textmodes/sgml-mode.el (html-tag-help): Fix ambiguous doc string
cross-reference(s).
* lisp/vc/compare-w.el (compare-ignore-whitespace)
(compare-ignore-case, compare-windows-dehighlight): Fix ambiguous
doc string cross-reference(s).
* lisp/vc/diff.el (diff): Fix ambiguous doc string cross-reference(s).
* src/insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
ambiguous doc string cross-reference(s).
* src/keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
doc string cross-reference(s).
* src/window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
string cross-reference(s).
Fixes: debbugs:12686
2013-01-11 18:08:55 -05:00
|
|
|
|
When moving by visual lines via the function `line-move-visual', it is a cons
|
2009-07-11 16:36:05 +00:00
|
|
|
|
cell (COL . HSCROLL), where COL is the x-position, in pixels,
|
|
|
|
|
divided by the default column width, and HSCROLL is the number of
|
|
|
|
|
columns by which window is scrolled from left margin.
|
|
|
|
|
|
|
|
|
|
When the `track-eol' feature is doing its job, the value is
|
2008-07-11 18:07:01 +00:00
|
|
|
|
`most-positive-fixnum'.")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(defcustom line-move-ignore-invisible t
|
2014-05-17 11:58:17 +03:00
|
|
|
|
"Non-nil means commands that move by lines ignore invisible newlines.
|
|
|
|
|
When this option is non-nil, \\[next-line], \\[previous-line], \\[move-end-of-line], and \\[move-beginning-of-line] behave
|
|
|
|
|
as if newlines that are invisible didn't exist, and count
|
2017-10-28 17:10:25 -07:00
|
|
|
|
only visible newlines. Thus, moving across 2 newlines
|
2014-05-17 11:58:17 +03:00
|
|
|
|
one of which is invisible will be counted as a one-line move.
|
|
|
|
|
Also, a non-nil value causes invisible text to be ignored when
|
|
|
|
|
counting columns for the purposes of keeping point in the same
|
|
|
|
|
column by \\[next-line] and \\[previous-line].
|
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
Outline mode sets this."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'editing-basics)
|
1995-03-10 03:27:46 +00:00
|
|
|
|
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(defcustom line-move-visual t
|
2008-07-11 18:07:01 +00:00
|
|
|
|
"When non-nil, `line-move' moves point by visual lines.
|
|
|
|
|
This movement is based on where the cursor is displayed on the
|
|
|
|
|
screen, instead of relying on buffer contents alone. It takes
|
2011-01-22 14:29:10 -05:00
|
|
|
|
into account variable-width characters and line continuation.
|
2011-09-16 20:15:16 +03:00
|
|
|
|
If nil, `line-move' moves point by logical lines.
|
|
|
|
|
A non-nil setting of `goal-column' overrides the value of this variable
|
2011-09-29 16:03:42 +03:00
|
|
|
|
and forces movement by logical lines.
|
2018-08-12 13:05:27 +02:00
|
|
|
|
A window that is horizontally scrolled also forces movement by logical
|
2011-11-19 21:49:56 +02:00
|
|
|
|
lines."
|
2008-07-17 23:37:50 +00:00
|
|
|
|
:type 'boolean
|
2011-01-22 14:29:10 -05:00
|
|
|
|
:group 'editing-basics
|
|
|
|
|
:version "23.1")
|
2008-07-11 18:07:01 +00:00
|
|
|
|
|
2013-09-17 19:50:04 -07:00
|
|
|
|
;; Only used if display-graphic-p.
|
|
|
|
|
(declare-function font-info "font.c" (name &optional frame))
|
|
|
|
|
|
2013-07-07 18:49:03 +03:00
|
|
|
|
(defun default-font-height ()
|
2015-03-21 12:31:29 +02:00
|
|
|
|
"Return the height in pixels of the current buffer's default face font.
|
|
|
|
|
|
|
|
|
|
If the default font is remapped (see `face-remapping-alist'), the
|
|
|
|
|
function returns the height of the remapped face."
|
2013-07-13 10:26:43 +03:00
|
|
|
|
(let ((default-font (face-font 'default)))
|
|
|
|
|
(cond
|
|
|
|
|
((and (display-multi-font-p)
|
|
|
|
|
;; Avoid calling font-info if the frame's default font was
|
|
|
|
|
;; not changed since the frame was created. That's because
|
|
|
|
|
;; font-info is expensive for some fonts, see bug #14838.
|
|
|
|
|
(not (string= (frame-parameter nil 'font) default-font)))
|
|
|
|
|
(aref (font-info default-font) 3))
|
|
|
|
|
(t (frame-char-height)))))
|
2013-07-07 18:49:03 +03:00
|
|
|
|
|
2015-03-21 12:31:29 +02:00
|
|
|
|
(defun default-font-width ()
|
|
|
|
|
"Return the width in pixels of the current buffer's default face font.
|
|
|
|
|
|
|
|
|
|
If the default font is remapped (see `face-remapping-alist'), the
|
|
|
|
|
function returns the width of the remapped face."
|
|
|
|
|
(let ((default-font (face-font 'default)))
|
|
|
|
|
(cond
|
|
|
|
|
((and (display-multi-font-p)
|
|
|
|
|
;; Avoid calling font-info if the frame's default font was
|
|
|
|
|
;; not changed since the frame was created. That's because
|
|
|
|
|
;; font-info is expensive for some fonts, see bug #14838.
|
|
|
|
|
(not (string= (frame-parameter nil 'font) default-font)))
|
|
|
|
|
(let* ((info (font-info (face-font 'default)))
|
|
|
|
|
(width (aref info 11)))
|
|
|
|
|
(if (> width 0)
|
|
|
|
|
width
|
|
|
|
|
(aref info 10))))
|
|
|
|
|
(t (frame-char-width)))))
|
|
|
|
|
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(defun default-line-height ()
|
|
|
|
|
"Return the pixel height of current buffer's default-face text line.
|
|
|
|
|
|
|
|
|
|
The value includes `line-spacing', if any, defined for the buffer
|
|
|
|
|
or the frame."
|
|
|
|
|
(let ((dfh (default-font-height))
|
|
|
|
|
(lsp (if (display-graphic-p)
|
|
|
|
|
(or line-spacing
|
|
|
|
|
(default-value 'line-spacing)
|
|
|
|
|
(frame-parameter nil 'line-spacing)
|
|
|
|
|
0)
|
|
|
|
|
0)))
|
|
|
|
|
(if (floatp lsp)
|
2014-08-05 16:34:06 +03:00
|
|
|
|
(setq lsp (truncate (* (frame-char-height) lsp))))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(+ dfh lsp)))
|
|
|
|
|
|
2013-07-07 18:49:03 +03:00
|
|
|
|
(defun window-screen-lines ()
|
|
|
|
|
"Return the number of screen lines in the text area of the selected window.
|
|
|
|
|
|
|
|
|
|
This is different from `window-text-height' in that this function counts
|
|
|
|
|
lines in units of the height of the font used by the default face displayed
|
2013-07-10 19:18:17 +03:00
|
|
|
|
in the window, not in units of the frame's default font, and also accounts
|
|
|
|
|
for `line-spacing', if any, defined for the window's buffer or frame.
|
2013-07-07 18:49:03 +03:00
|
|
|
|
|
|
|
|
|
The value is a floating-point number."
|
2014-08-05 16:34:06 +03:00
|
|
|
|
(let ((edges (window-inside-pixel-edges))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(dlh (default-line-height)))
|
2014-08-05 16:34:06 +03:00
|
|
|
|
(/ (float (- (nth 3 edges) (nth 1 edges))) dlh)))
|
2013-07-07 18:49:03 +03:00
|
|
|
|
|
2006-09-05 22:52:29 +00:00
|
|
|
|
;; Returns non-nil if partial move was done.
|
2016-04-29 02:40:13 +02:00
|
|
|
|
(defun line-move-partial (arg noerror &optional _to-end)
|
2006-09-05 22:52:29 +00:00
|
|
|
|
(if (< arg 0)
|
|
|
|
|
;; Move backward (up).
|
|
|
|
|
;; If already vscrolled, reduce vscroll
|
2013-07-07 18:49:03 +03:00
|
|
|
|
(let ((vs (window-vscroll nil t))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(dlh (default-line-height)))
|
|
|
|
|
(when (> vs dlh)
|
|
|
|
|
(set-window-vscroll nil (- vs dlh) t)))
|
2006-09-05 22:52:29 +00:00
|
|
|
|
|
|
|
|
|
;; Move forward (down).
|
2006-09-18 11:13:04 +00:00
|
|
|
|
(let* ((lh (window-line-height -1))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(rowh (car lh))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
(vpos (nth 1 lh))
|
|
|
|
|
(ypos (nth 2 lh))
|
|
|
|
|
(rbot (nth 3 lh))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(this-lh (window-line-height))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(this-height (car this-lh))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(this-ypos (nth 2 this-lh))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(dlh (default-line-height))
|
|
|
|
|
(wslines (window-screen-lines))
|
2013-07-17 19:47:49 +03:00
|
|
|
|
(edges (window-inside-pixel-edges))
|
|
|
|
|
(winh (- (nth 3 edges) (nth 1 edges) 1))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
py vs last-line)
|
|
|
|
|
(if (> (mod wslines 1.0) 0.0)
|
|
|
|
|
(setq wslines (round (+ wslines 0.5))))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
(when (or (null lh)
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(>= rbot dlh)
|
|
|
|
|
(<= ypos (- dlh))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(null this-lh)
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(<= this-ypos (- dlh)))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
(unless lh
|
2006-09-20 09:45:19 +00:00
|
|
|
|
(let ((wend (pos-visible-in-window-p t nil t)))
|
|
|
|
|
(setq rbot (nth 3 wend)
|
2013-07-08 20:30:50 +03:00
|
|
|
|
rowh (nth 4 wend)
|
2006-09-20 09:45:19 +00:00
|
|
|
|
vpos (nth 5 wend))))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(unless this-lh
|
|
|
|
|
(let ((wstart (pos-visible-in-window-p nil nil t)))
|
|
|
|
|
(setq this-ypos (nth 2 wstart)
|
|
|
|
|
this-height (nth 4 wstart))))
|
|
|
|
|
(setq py
|
|
|
|
|
(or (nth 1 this-lh)
|
2013-07-06 20:38:24 +03:00
|
|
|
|
(let ((ppos (posn-at-point))
|
|
|
|
|
col-row)
|
|
|
|
|
(setq col-row (posn-actual-col-row ppos))
|
|
|
|
|
(if col-row
|
|
|
|
|
(- (cdr col-row) (window-vscroll))
|
|
|
|
|
(cdr (posn-col-row ppos))))))
|
2013-07-10 19:18:17 +03:00
|
|
|
|
;; VPOS > 0 means the last line is only partially visible.
|
|
|
|
|
;; But if the part that is visible is at least as tall as the
|
|
|
|
|
;; default font, that means the line is actually fully
|
|
|
|
|
;; readable, and something like line-spacing is hidden. So in
|
|
|
|
|
;; that case we accept the last line in the window as still
|
|
|
|
|
;; visible, and consider the margin as starting one line
|
|
|
|
|
;; later.
|
|
|
|
|
(if (and vpos (> vpos 0))
|
|
|
|
|
(if (and rowh
|
|
|
|
|
(>= rowh (default-font-height))
|
|
|
|
|
(< rowh dlh))
|
|
|
|
|
(setq last-line (min (- wslines scroll-margin) vpos))
|
|
|
|
|
(setq last-line (min (- wslines scroll-margin 1) (1- vpos)))))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
(cond
|
2013-06-15 12:34:20 +03:00
|
|
|
|
;; If last line of window is fully visible, and vscrolling
|
|
|
|
|
;; more would make this line invisible, move forward.
|
2013-07-08 20:30:50 +03:00
|
|
|
|
((and (or (< (setq vs (window-vscroll nil t)) dlh)
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(null this-height)
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(<= this-height dlh))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(or (null rbot) (= rbot 0)))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
nil)
|
2013-06-15 12:34:20 +03:00
|
|
|
|
;; If cursor is not in the bottom scroll margin, and the
|
2017-10-27 20:45:23 -04:00
|
|
|
|
;; current line is not too tall, move forward.
|
2013-07-17 19:47:49 +03:00
|
|
|
|
((and (or (null this-height) (<= this-height winh))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
vpos
|
|
|
|
|
(> vpos 0)
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(< py last-line))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
nil)
|
|
|
|
|
;; When already vscrolled, we vscroll some more if we can,
|
|
|
|
|
;; or clear vscroll and move forward at end of tall image.
|
2013-06-15 12:34:20 +03:00
|
|
|
|
((> vs 0)
|
|
|
|
|
(when (or (and rbot (> rbot 0))
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(and this-height (> this-height dlh)))
|
|
|
|
|
(set-window-vscroll nil (+ vs dlh) t)))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
;; If cursor just entered the bottom scroll margin, move forward,
|
2013-07-08 20:30:50 +03:00
|
|
|
|
;; but also optionally vscroll one line so redisplay won't recenter.
|
2013-06-15 12:34:20 +03:00
|
|
|
|
((and vpos
|
|
|
|
|
(> vpos 0)
|
2013-07-10 19:18:17 +03:00
|
|
|
|
(= py last-line))
|
2013-07-08 20:30:50 +03:00
|
|
|
|
;; Don't vscroll if the partially-visible line at window
|
2013-07-17 19:47:49 +03:00
|
|
|
|
;; bottom is not too tall (a.k.a. "just one more text
|
2013-07-08 20:30:50 +03:00
|
|
|
|
;; line"): in that case, we do want redisplay to behave
|
|
|
|
|
;; normally, i.e. recenter or whatever.
|
|
|
|
|
;;
|
|
|
|
|
;; Note: ROWH + RBOT from the value returned by
|
|
|
|
|
;; pos-visible-in-window-p give the total height of the
|
|
|
|
|
;; partially-visible glyph row at the end of the window. As
|
|
|
|
|
;; we are dealing with floats, we disregard sub-pixel
|
|
|
|
|
;; discrepancies between that and DLH.
|
2013-07-17 19:47:49 +03:00
|
|
|
|
(if (and rowh rbot (>= (- (+ rowh rbot) winh) 1))
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(set-window-vscroll nil dlh t))
|
2016-04-29 02:40:13 +02:00
|
|
|
|
(line-move-1 arg noerror)
|
2006-09-18 11:13:04 +00:00
|
|
|
|
t)
|
|
|
|
|
;; If there are lines above the last line, scroll-up one line.
|
2013-06-15 12:34:20 +03:00
|
|
|
|
((and vpos (> vpos 0))
|
2006-09-18 11:13:04 +00:00
|
|
|
|
(scroll-up 1)
|
|
|
|
|
t)
|
|
|
|
|
;; Finally, start vscroll.
|
|
|
|
|
(t
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(set-window-vscroll nil dlh t)))))))
|
2006-09-05 22:52:29 +00:00
|
|
|
|
|
|
|
|
|
|
2005-06-08 15:35:05 +00:00
|
|
|
|
;; This is like line-move-1 except that it also performs
|
|
|
|
|
;; vertical scrolling of tall images if appropriate.
|
|
|
|
|
;; That is not really a clean thing to do, since it mixes
|
|
|
|
|
;; scrolling with cursor motion. But so far we don't have
|
|
|
|
|
;; a cleaner solution to the problem of making C-n do something
|
|
|
|
|
;; useful given a tall image.
|
2016-04-29 02:40:13 +02:00
|
|
|
|
(defun line-move (arg &optional noerror _to-end try-vscroll)
|
2014-02-07 22:28:12 -08:00
|
|
|
|
"Move forward ARG lines.
|
|
|
|
|
If NOERROR, don't signal an error if we can't move ARG lines.
|
|
|
|
|
TO-END is unused.
|
|
|
|
|
TRY-VSCROLL controls whether to vscroll tall lines: if either
|
|
|
|
|
`auto-window-vscroll' or TRY-VSCROLL is nil, this function will
|
|
|
|
|
not vscroll."
|
2012-04-18 15:00:52 +08:00
|
|
|
|
(if noninteractive
|
2016-04-29 02:40:13 +02:00
|
|
|
|
(line-move-1 arg noerror)
|
2012-04-18 15:00:52 +08:00
|
|
|
|
(unless (and auto-window-vscroll try-vscroll
|
|
|
|
|
;; Only vscroll for single line moves
|
|
|
|
|
(= (abs arg) 1)
|
2012-11-20 19:44:04 +02:00
|
|
|
|
;; Under scroll-conservatively, the display engine
|
|
|
|
|
;; does this better.
|
|
|
|
|
(zerop scroll-conservatively)
|
2012-04-18 15:00:52 +08:00
|
|
|
|
;; But don't vscroll in a keyboard macro.
|
|
|
|
|
(not defining-kbd-macro)
|
|
|
|
|
(not executing-kbd-macro)
|
2016-04-29 02:40:13 +02:00
|
|
|
|
(line-move-partial arg noerror))
|
2012-04-18 15:00:52 +08:00
|
|
|
|
(set-window-vscroll nil 0 t)
|
|
|
|
|
(if (and line-move-visual
|
|
|
|
|
;; Display-based column are incompatible with goal-column.
|
|
|
|
|
(not goal-column)
|
|
|
|
|
;; When the text in the window is scrolled to the left,
|
|
|
|
|
;; display-based motion doesn't make sense (because each
|
|
|
|
|
;; logical line occupies exactly one screen line).
|
2013-10-25 12:45:51 +03:00
|
|
|
|
(not (> (window-hscroll) 0))
|
|
|
|
|
;; Likewise when the text _was_ scrolled to the left
|
|
|
|
|
;; when the current run of vertical motion commands
|
|
|
|
|
;; started.
|
|
|
|
|
(not (and (memq last-command
|
|
|
|
|
`(next-line previous-line ,this-command))
|
|
|
|
|
auto-hscroll-mode
|
|
|
|
|
(numberp temporary-goal-column)
|
|
|
|
|
(>= temporary-goal-column
|
|
|
|
|
(- (window-width) hscroll-margin)))))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(prog1 (line-move-visual arg noerror)
|
|
|
|
|
;; If we moved into a tall line, set vscroll to make
|
|
|
|
|
;; scrolling through tall images more smooth.
|
2013-07-07 18:49:03 +03:00
|
|
|
|
(let ((lh (line-pixel-height))
|
2013-07-17 19:47:49 +03:00
|
|
|
|
(edges (window-inside-pixel-edges))
|
|
|
|
|
(dlh (default-line-height))
|
|
|
|
|
winh)
|
|
|
|
|
(setq winh (- (nth 3 edges) (nth 1 edges) 1))
|
2013-06-15 12:34:20 +03:00
|
|
|
|
(if (and (< arg 0)
|
|
|
|
|
(< (point) (window-start))
|
2013-07-17 19:47:49 +03:00
|
|
|
|
(> lh winh))
|
2013-07-07 18:49:03 +03:00
|
|
|
|
(set-window-vscroll
|
|
|
|
|
nil
|
2013-07-08 20:30:50 +03:00
|
|
|
|
(- lh dlh) t))))
|
2016-04-29 02:40:13 +02:00
|
|
|
|
(line-move-1 arg noerror)))))
|
2008-07-11 18:07:01 +00:00
|
|
|
|
|
|
|
|
|
;; Display-based alternative to line-move-1.
|
|
|
|
|
;; Arg says how many lines to move. The value is t if we can move the
|
|
|
|
|
;; specified number of lines.
|
|
|
|
|
(defun line-move-visual (arg &optional noerror)
|
2014-02-07 22:28:12 -08:00
|
|
|
|
"Move ARG lines forward.
|
|
|
|
|
If NOERROR, don't signal an error if we can't move that many lines."
|
2009-07-31 02:14:43 +00:00
|
|
|
|
(let ((opoint (point))
|
2009-07-11 16:36:05 +00:00
|
|
|
|
(hscroll (window-hscroll))
|
2017-07-07 12:21:10 +03:00
|
|
|
|
(lnum-width (line-number-display-width t))
|
2009-07-31 02:14:43 +00:00
|
|
|
|
target-hscroll)
|
2009-07-11 16:36:05 +00:00
|
|
|
|
;; Check if the previous command was a line-motion command, or if
|
|
|
|
|
;; we were called from some other command.
|
2009-07-31 02:14:43 +00:00
|
|
|
|
(if (and (consp temporary-goal-column)
|
|
|
|
|
(memq last-command `(next-line previous-line ,this-command)))
|
|
|
|
|
;; If so, there's no need to reset `temporary-goal-column',
|
|
|
|
|
;; but we may need to hscroll.
|
2018-06-06 18:28:44 +03:00
|
|
|
|
(if (or (/= (cdr temporary-goal-column) hscroll)
|
|
|
|
|
(> (cdr temporary-goal-column) 0))
|
|
|
|
|
(setq target-hscroll (cdr temporary-goal-column)))
|
2009-07-31 02:14:43 +00:00
|
|
|
|
;; Otherwise, we should reset `temporary-goal-column'.
|
2015-01-08 16:04:46 +02:00
|
|
|
|
(let ((posn (posn-at-point))
|
|
|
|
|
x-pos)
|
2009-07-31 02:14:43 +00:00
|
|
|
|
(cond
|
2017-08-13 17:53:48 +03:00
|
|
|
|
;; Handle the `overflow-newline-into-fringe' case
|
|
|
|
|
;; (left-fringe is for the R2L case):
|
|
|
|
|
((memq (nth 1 posn) '(right-fringe left-fringe))
|
|
|
|
|
(setq temporary-goal-column (cons (window-width) hscroll)))
|
2009-07-31 02:14:43 +00:00
|
|
|
|
((car (posn-x-y posn))
|
2018-06-06 18:28:44 +03:00
|
|
|
|
(setq x-pos (- (car (posn-x-y posn)) lnum-width))
|
2015-01-08 16:04:46 +02:00
|
|
|
|
;; In R2L lines, the X pixel coordinate is measured from the
|
|
|
|
|
;; left edge of the window, but columns are still counted
|
|
|
|
|
;; from the logical-order beginning of the line, i.e. from
|
|
|
|
|
;; the right edge in this case. We need to adjust for that.
|
|
|
|
|
(if (eq (current-bidi-paragraph-direction) 'right-to-left)
|
|
|
|
|
(setq x-pos (- (window-body-width nil t) 1 x-pos)))
|
2009-07-31 02:14:43 +00:00
|
|
|
|
(setq temporary-goal-column
|
2015-01-08 16:04:46 +02:00
|
|
|
|
(cons (/ (float x-pos)
|
Get rid of backend-dependent selection-handling functions for kill/yank
and make it generic instead by relying on the lower-level selection
management functions.
* select.el (select-enable-clipboard): Rename from
gui-select-enable-clipboard.
(select-enable-primary): Move from x-win.el and rename from
x-select-enable-primary.
(gui-last-selected-text): Remove.
(gui--last-selected-text-clipboard, gui--last-selected-text-primary):
New vars.
(gui-select-text): Rewrite, based on x-win.el's old x-select-text.
(gui-select-text-alist, gui-selection-value-alist): Remove.
(x-select-request-type): Move from x-win.el.
(gui--selection-value-internal): New function, taken from x-win's
x-selection-value-internal.
(gui-selection-value): Rewrite, based on x-win.el's old x-selection-value.
(gui-set-selection-alist): Rename from gui-own-selection-alist and
extend it to handle a nil value as a "disown" request.
(gui-disown-selection-alist): Remove.
(xselect-convert-to-delete): Adjust accordingly.
(gui-set-selection): Simplify accordingly as well. Use dotimes.
* lisp/frame.el (gui-method): Use window-system rather than framep.
(gui-method-declare): The tty case is now nil rather than t.
(make-frame): Adjust accordingly.
* lisp/term/x-win.el (x-last-selected-text-primary)
(x-select-enable-primary): Remove (moved to select.el).
(x-select-request-type): Move to select.el.
(x-selection-value-internal, x--selection-value): Remove functions.
(gui-selection-value, gui-select-text): Remove moethods.
(gui-set-selection): Merge own and disown methods.
* lisp/startup.el (command-line): Adjust now that `gui-method' expects nil
for ttys.
* lisp/term/ns-win.el (ns-get-pasteboard, ns-set-pasteboard)
(ns-selection-value): Remove functions.
(gui-select-text, gui-selection-value): Don't define method any more.
(gui-set-selection): Merge the old own and disown methods.
(gui-selection-exists-p, gui-get-selection): Adjust to new name of
underlying C primitive.
* lisp/term/pc-win.el (w16-get-selection-value): Add dummy argument and drop
test of gui-select-enable-clipboard, to make it usable as
a gui-get-selection method.
(gui-selection-exists-p): Adjust to new name of C primitive.
(gui-set-selection): Merge own and disown methods.
(gui-select-text, gui-selection-value): Delete methods.
(w16--select-text): Delete function.
* lisp/term/w32-win.el (w32--select-text, w32--get-selection-value):
Delete function (move functionality into w32--set-selection and
w32--get-selection).
(gui-select-text, gui-selection-value): Don't define methods.
(w32--set-selection, w32--get-selection, w32--selection-owner-p):
New functions.
(gui-get-selection, gui-selection-owner-p, gui-selection-exists-p):
Use them.
(gui-selection-exists-p): Adjust to new name of C primitive.
* src/nsselect.m (ns_get_local_selection): Signal error rather than `quit'.
(Fns_own_selection_internal): Tighten scoping.
(Fns_selection_exists_p): Rename from Fx_selection_exists_p.
(Fns_get_selection): Rename from Fx_get_selection_internal.
(Fns_get_selection_internal, Fns_store_selection_internal):
Remove functions.
(syms_of_nsselect): Adjust accordingly.
* src/w16select.c (Fw16_selection_exists_p): Rename from
Fx_selection_exists_p.
(syms_of_win16select): Adjust accordingly.
* src/w32select.c (Fw32_selection_exists_p): Rename from
Fx_selection_exists_p.
(syms_of_w32select): Adjust accordingly.
2014-10-21 11:27:18 -04:00
|
|
|
|
(frame-char-width))
|
2016-05-28 18:33:50 +03:00
|
|
|
|
hscroll)))
|
|
|
|
|
(executing-kbd-macro
|
|
|
|
|
;; When we move beyond the first/last character visible in
|
|
|
|
|
;; the window, posn-at-point will return nil, so we need to
|
|
|
|
|
;; approximate the goal column as below.
|
|
|
|
|
(setq temporary-goal-column
|
|
|
|
|
(mod (current-column) (window-text-width)))))))
|
2009-07-31 02:14:43 +00:00
|
|
|
|
(if target-hscroll
|
|
|
|
|
(set-window-hscroll (selected-window) target-hscroll))
|
2013-05-08 21:05:40 +03:00
|
|
|
|
;; vertical-motion can move more than it was asked to if it moves
|
|
|
|
|
;; across display strings with newlines. We don't want to ring
|
|
|
|
|
;; the bell and announce beginning/end of buffer in that case.
|
|
|
|
|
(or (and (or (and (>= arg 0)
|
|
|
|
|
(>= (vertical-motion
|
|
|
|
|
(cons (or goal-column
|
|
|
|
|
(if (consp temporary-goal-column)
|
|
|
|
|
(car temporary-goal-column)
|
|
|
|
|
temporary-goal-column))
|
|
|
|
|
arg))
|
|
|
|
|
arg))
|
|
|
|
|
(and (< arg 0)
|
|
|
|
|
(<= (vertical-motion
|
|
|
|
|
(cons (or goal-column
|
|
|
|
|
(if (consp temporary-goal-column)
|
|
|
|
|
(car temporary-goal-column)
|
|
|
|
|
temporary-goal-column))
|
|
|
|
|
arg))
|
|
|
|
|
arg)))
|
2009-04-25 15:27:45 +00:00
|
|
|
|
(or (>= arg 0)
|
|
|
|
|
(/= (point) opoint)
|
|
|
|
|
;; If the goal column lies on a display string,
|
|
|
|
|
;; `vertical-motion' advances the cursor to the end
|
|
|
|
|
;; of the string. For arg < 0, this can cause the
|
|
|
|
|
;; cursor to get stuck. (Bug#3020).
|
|
|
|
|
(= (vertical-motion arg) arg)))
|
|
|
|
|
(unless noerror
|
|
|
|
|
(signal (if (< arg 0) 'beginning-of-buffer 'end-of-buffer)
|
|
|
|
|
nil)))))
|
2005-01-22 01:44:56 +00:00
|
|
|
|
|
1995-04-09 09:34:05 +00:00
|
|
|
|
;; This is the guts of next-line and previous-line.
|
|
|
|
|
;; Arg says how many lines to move.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
;; The value is t if we can move the specified number of lines.
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun line-move-1 (arg &optional noerror _to-end)
|
1995-04-18 07:01:34 +00:00
|
|
|
|
;; Don't run any point-motion hooks, and disregard intangibility,
|
|
|
|
|
;; for intermediate positions.
|
|
|
|
|
(let ((inhibit-point-motion-hooks t)
|
|
|
|
|
(opoint (point))
|
2006-09-19 21:34:01 +00:00
|
|
|
|
(orig-arg arg))
|
2009-07-11 16:36:05 +00:00
|
|
|
|
(if (consp temporary-goal-column)
|
|
|
|
|
(setq temporary-goal-column (+ (car temporary-goal-column)
|
|
|
|
|
(cdr temporary-goal-column))))
|
1995-04-18 07:01:34 +00:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
2002-04-11 23:44:06 +00:00
|
|
|
|
(if (not (memq last-command '(next-line previous-line)))
|
1995-04-18 07:01:34 +00:00
|
|
|
|
(setq temporary-goal-column
|
|
|
|
|
(if (and track-eol (eolp)
|
|
|
|
|
;; Don't count beg of empty line as end of line
|
|
|
|
|
;; unless we just did explicit end-of-line.
|
2006-06-21 12:01:57 +00:00
|
|
|
|
(or (not (bolp)) (eq last-command 'move-end-of-line)))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
most-positive-fixnum
|
1995-04-18 07:01:34 +00:00
|
|
|
|
(current-column))))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(if (not (or (integerp selective-display)
|
|
|
|
|
line-move-ignore-invisible))
|
1995-04-18 07:01:34 +00:00
|
|
|
|
;; Use just newline characters.
|
2002-01-13 04:02:49 +00:00
|
|
|
|
;; Set ARG to 0 if we move as many lines as requested.
|
1995-04-18 07:01:34 +00:00
|
|
|
|
(or (if (> arg 0)
|
|
|
|
|
(progn (if (> arg 1) (forward-line (1- arg)))
|
|
|
|
|
;; This way of moving forward ARG lines
|
|
|
|
|
;; verifies that we have a newline after the last one.
|
|
|
|
|
;; It doesn't get confused by intangible text.
|
|
|
|
|
(end-of-line)
|
2002-01-13 04:02:49 +00:00
|
|
|
|
(if (zerop (forward-line 1))
|
|
|
|
|
(setq arg 0)))
|
1995-04-18 07:01:34 +00:00
|
|
|
|
(and (zerop (forward-line arg))
|
2002-01-13 04:02:49 +00:00
|
|
|
|
(bolp)
|
|
|
|
|
(setq arg 0)))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(unless noerror
|
|
|
|
|
(signal (if (< arg 0)
|
|
|
|
|
'beginning-of-buffer
|
|
|
|
|
'end-of-buffer)
|
|
|
|
|
nil)))
|
1995-04-18 07:01:34 +00:00
|
|
|
|
;; Move by arg lines, but ignore invisible ones.
|
2007-03-17 19:44:21 +00:00
|
|
|
|
(let (done)
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(while (and (> arg 0) (not done))
|
|
|
|
|
;; If the following character is currently invisible,
|
|
|
|
|
;; skip all characters with that same `invisible' property value.
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(while (and (not (eobp)) (invisible-p (point)))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(goto-char (next-char-property-change (point))))
|
2006-09-19 21:34:01 +00:00
|
|
|
|
;; Move a line.
|
|
|
|
|
;; We don't use `end-of-line', since we want to escape
|
2010-09-25 14:04:35 +02:00
|
|
|
|
;; from field boundaries occurring exactly at point.
|
2007-03-17 19:44:21 +00:00
|
|
|
|
(goto-char (constrain-to-field
|
|
|
|
|
(let ((inhibit-field-text-motion t))
|
|
|
|
|
(line-end-position))
|
|
|
|
|
(point) t t
|
|
|
|
|
'inhibit-line-move-field-capture))
|
2005-04-26 18:31:19 +00:00
|
|
|
|
;; If there's no invisibility here, move over the newline.
|
2005-07-13 13:45:30 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eobp)
|
|
|
|
|
(if (not noerror)
|
|
|
|
|
(signal 'end-of-buffer nil)
|
|
|
|
|
(setq done t)))
|
|
|
|
|
((and (> arg 1) ;; Use vertical-motion for last move
|
|
|
|
|
(not (integerp selective-display))
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(not (invisible-p (point))))
|
2005-07-13 13:45:30 +00:00
|
|
|
|
;; We avoid vertical-motion when possible
|
|
|
|
|
;; because that has to fontify.
|
|
|
|
|
(forward-line 1))
|
|
|
|
|
;; Otherwise move a more sophisticated way.
|
|
|
|
|
((zerop (vertical-motion 1))
|
|
|
|
|
(if (not noerror)
|
|
|
|
|
(signal 'end-of-buffer nil)
|
|
|
|
|
(setq done t))))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(unless done
|
|
|
|
|
(setq arg (1- arg))))
|
2005-05-05 22:43:06 +00:00
|
|
|
|
;; The logic of this is the same as the loop above,
|
2005-04-26 18:31:19 +00:00
|
|
|
|
;; it just goes in the other direction.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(while (and (< arg 0) (not done))
|
2006-10-18 04:58:29 +00:00
|
|
|
|
;; For completely consistency with the forward-motion
|
|
|
|
|
;; case, we should call beginning-of-line here.
|
|
|
|
|
;; However, if point is inside a field and on a
|
|
|
|
|
;; continued line, the call to (vertical-motion -1)
|
|
|
|
|
;; below won't move us back far enough; then we return
|
|
|
|
|
;; to the same column in line-move-finish, and point
|
|
|
|
|
;; gets stuck -- cyd
|
|
|
|
|
(forward-line 0)
|
2005-07-13 13:45:30 +00:00
|
|
|
|
(cond
|
|
|
|
|
((bobp)
|
|
|
|
|
(if (not noerror)
|
|
|
|
|
(signal 'beginning-of-buffer nil)
|
|
|
|
|
(setq done t)))
|
|
|
|
|
((and (< arg -1) ;; Use vertical-motion for last move
|
|
|
|
|
(not (integerp selective-display))
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(not (invisible-p (1- (point)))))
|
2005-07-13 13:45:30 +00:00
|
|
|
|
(forward-line -1))
|
|
|
|
|
((zerop (vertical-motion -1))
|
|
|
|
|
(if (not noerror)
|
|
|
|
|
(signal 'beginning-of-buffer nil)
|
|
|
|
|
(setq done t))))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(unless done
|
|
|
|
|
(setq arg (1+ arg))
|
|
|
|
|
(while (and ;; Don't move over previous invis lines
|
|
|
|
|
;; if our target is the middle of this line.
|
|
|
|
|
(or (zerop (or goal-column temporary-goal-column))
|
|
|
|
|
(< arg 0))
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(not (bobp)) (invisible-p (1- (point))))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(goto-char (previous-char-property-change (point))))))))
|
|
|
|
|
;; This is the value the function returns.
|
|
|
|
|
(= arg 0))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
|
2002-01-13 04:02:49 +00:00
|
|
|
|
(cond ((> arg 0)
|
2008-06-03 22:56:56 +00:00
|
|
|
|
;; If we did not move down as far as desired, at least go
|
|
|
|
|
;; to end of line. Be sure to call point-entered and
|
|
|
|
|
;; point-left-hooks.
|
|
|
|
|
(let* ((npoint (prog1 (line-end-position)
|
|
|
|
|
(goto-char opoint)))
|
|
|
|
|
(inhibit-point-motion-hooks nil))
|
|
|
|
|
(goto-char npoint)))
|
2002-01-13 04:02:49 +00:00
|
|
|
|
((< arg 0)
|
2005-07-22 18:43:24 +00:00
|
|
|
|
;; If we did not move up as far as desired,
|
|
|
|
|
;; at least go to beginning of line.
|
2008-06-03 22:56:56 +00:00
|
|
|
|
(let* ((npoint (prog1 (line-beginning-position)
|
|
|
|
|
(goto-char opoint)))
|
|
|
|
|
(inhibit-point-motion-hooks nil))
|
|
|
|
|
(goto-char npoint)))
|
2002-01-13 04:02:49 +00:00
|
|
|
|
(t
|
2004-11-20 19:08:45 +00:00
|
|
|
|
(line-move-finish (or goal-column temporary-goal-column)
|
2006-09-19 21:34:01 +00:00
|
|
|
|
opoint (> orig-arg 0)))))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2004-11-20 19:08:45 +00:00
|
|
|
|
(defun line-move-finish (column opoint forward)
|
2001-12-28 05:15:59 +00:00
|
|
|
|
(let ((repeat t))
|
|
|
|
|
(while repeat
|
|
|
|
|
;; Set REPEAT to t to repeat the whole thing.
|
|
|
|
|
(setq repeat nil)
|
|
|
|
|
|
2002-04-22 22:35:46 +00:00
|
|
|
|
(let (new
|
2006-09-24 21:58:12 +00:00
|
|
|
|
(old (point))
|
Use line-end-position rather than end-of-line, etc.
* textmodes/texnfo-upd.el (texinfo-start-menu-description)
(texinfo-update-menu-region-beginning, texinfo-menu-first-node)
(texinfo-delete-existing-pointers, texinfo-find-pointer)
(texinfo-clean-up-node-line, texinfo-insert-node-lines)
(texinfo-multiple-files-update):
* textmodes/table.el (table--probe-cell-left-up)
(table--probe-cell-right-bottom):
* textmodes/picture.el (picture-tab-search):
* textmodes/page-ext.el (pages-copy-header-and-position)
(pages-directory-for-addresses):
* progmodes/vera-mode.el (vera-get-offset):
* progmodes/simula.el (simula-calculate-indent):
* progmodes/python.el (python-pdbtrack-overlay-arrow):
* progmodes/prolog.el (end-of-prolog-clause):
* progmodes/perl-mode.el (perl-calculate-indent, perl-indent-exp):
* progmodes/icon.el (indent-icon-exp):
* progmodes/etags.el (tag-re-match-p):
* progmodes/ebrowse.el (ebrowse-show-file-name-at-point):
* progmodes/ebnf2ps.el (ebnf-begin-file):
* progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-save-local-variable):
* play/life.el (life-setup):
* play/gametree.el (gametree-looking-at-ply):
* nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* mail/sendmail.el (mail-mode-auto-fill):
* emacs-lisp/lisp-mode.el (calculate-lisp-indent):
* emacs-lisp/edebug.el (edebug-overlay-arrow):
* emacs-lisp/checkdoc.el (checkdoc-this-string-valid):
* woman.el (woman-parse-numeric-value, woman2-TH, woman2-SH)
(woman-tab-to-tab-stop, WoMan-warn-ignored):
* type-break.el (type-break-file-keystroke-count):
* term.el (term-replace-by-expanded-history-before-point)
(term-skip-prompt, term-extract-string):
* speedbar.el (speedbar-edit-line, speedbar-expand-line)
(speedbar-contract-line, speedbar-toggle-line-expansion)
(speedbar-parse-c-or-c++tag, speedbar-parse-tex-string)
(speedbar-buffer-revert-buffer, speedbar-highlight-one-tag-line):
* sort.el (sort-skip-fields):
* skeleton.el (skeleton-internal-list):
* simple.el (line-move-finish, line-move-to-column):
* shell.el (shell-forward-command):
* misc.el (copy-from-above-command):
* makesum.el (double-column):
* ebuff-menu.el (electric-buffer-update-highlight):
* dired.el (dired-move-to-end-of-filename):
* dframe.el (dframe-popup-kludge):
* bookmark.el (bookmark-kill-line, bookmark-bmenu-show-filenames):
* arc-mode.el (archive-get-lineno):
Use line-end-position and line-beginning-position.
* net/ange-ftp.el, progmodes/hideif.el, reposition.el:
Same, but only in comments.
2010-11-06 13:23:42 -07:00
|
|
|
|
(line-beg (line-beginning-position))
|
2002-04-22 22:35:46 +00:00
|
|
|
|
(line-end
|
|
|
|
|
;; Compute the end of the line
|
2004-11-20 19:08:45 +00:00
|
|
|
|
;; ignoring effectively invisible newlines.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(save-excursion
|
2005-10-23 18:26:38 +00:00
|
|
|
|
;; Like end-of-line but ignores fields.
|
|
|
|
|
(skip-chars-forward "^\n")
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(while (and (not (eobp)) (invisible-p (point)))
|
2004-11-20 19:08:45 +00:00
|
|
|
|
(goto-char (next-char-property-change (point)))
|
2005-10-23 18:26:38 +00:00
|
|
|
|
(skip-chars-forward "^\n"))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(point))))
|
2002-04-22 22:35:46 +00:00
|
|
|
|
|
|
|
|
|
;; Move to the desired column.
|
2017-05-18 22:54:35 +03:00
|
|
|
|
(if (and line-move-visual
|
|
|
|
|
(not (or truncate-lines truncate-partial-width-windows)))
|
2017-05-10 19:58:06 +03:00
|
|
|
|
;; Under line-move-visual, goal-column should be
|
|
|
|
|
;; interpreted in units of the frame's canonical character
|
|
|
|
|
;; width, which is exactly what vertical-motion does.
|
|
|
|
|
(vertical-motion (cons column 0))
|
|
|
|
|
(line-move-to-column (truncate column)))
|
2006-09-24 21:58:12 +00:00
|
|
|
|
|
|
|
|
|
;; Corner case: suppose we start out in a field boundary in
|
|
|
|
|
;; the middle of a continued line. When we get to
|
|
|
|
|
;; line-move-finish, point is at the start of a new *screen*
|
|
|
|
|
;; line but the same text line; then line-move-to-column would
|
2014-02-21 14:22:14 +01:00
|
|
|
|
;; move us backwards. Test using C-n with point on the "x" in
|
2006-09-24 21:58:12 +00:00
|
|
|
|
;; (insert "a" (propertize "x" 'field t) (make-string 89 ?y))
|
|
|
|
|
(and forward
|
|
|
|
|
(< (point) old)
|
|
|
|
|
(goto-char old))
|
|
|
|
|
|
2002-04-22 22:35:46 +00:00
|
|
|
|
(setq new (point))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
|
|
|
|
|
;; Process intangibility within a line.
|
2006-05-23 00:49:55 +00:00
|
|
|
|
;; With inhibit-point-motion-hooks bound to nil, a call to
|
|
|
|
|
;; goto-char moves point past intangible text.
|
|
|
|
|
|
|
|
|
|
;; However, inhibit-point-motion-hooks controls both the
|
|
|
|
|
;; intangibility and the point-entered/point-left hooks. The
|
|
|
|
|
;; following hack avoids calling the point-* hooks
|
|
|
|
|
;; unnecessarily. Note that we move *forward* past intangible
|
|
|
|
|
;; text when the initial and final points are the same.
|
2006-05-12 17:39:59 +00:00
|
|
|
|
(goto-char new)
|
2001-12-28 05:15:59 +00:00
|
|
|
|
(let ((inhibit-point-motion-hooks nil))
|
|
|
|
|
(goto-char new)
|
|
|
|
|
|
|
|
|
|
;; If intangibility moves us to a different (later) place
|
|
|
|
|
;; in the same line, use that as the destination.
|
|
|
|
|
(if (<= (point) line-end)
|
2002-04-22 22:35:46 +00:00
|
|
|
|
(setq new (point))
|
|
|
|
|
;; If that position is "too late",
|
|
|
|
|
;; try the previous allowable position.
|
|
|
|
|
;; See if it is ok.
|
|
|
|
|
(backward-char)
|
2004-11-20 19:08:45 +00:00
|
|
|
|
(if (if forward
|
|
|
|
|
;; If going forward, don't accept the previous
|
|
|
|
|
;; allowable position if it is before the target line.
|
2004-12-14 00:51:02 +00:00
|
|
|
|
(< line-beg (point))
|
2004-11-20 19:08:45 +00:00
|
|
|
|
;; If going backward, don't accept the previous
|
|
|
|
|
;; allowable position if it is still after the target line.
|
|
|
|
|
(<= (point) line-end))
|
2002-04-22 22:35:46 +00:00
|
|
|
|
(setq new (point))
|
|
|
|
|
;; As a last resort, use the end of the line.
|
|
|
|
|
(setq new line-end))))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
|
|
|
|
|
;; Now move to the updated destination, processing fields
|
|
|
|
|
;; as well as intangibility.
|
|
|
|
|
(goto-char opoint)
|
|
|
|
|
(let ((inhibit-point-motion-hooks nil))
|
|
|
|
|
(goto-char
|
2006-09-29 18:18:42 +00:00
|
|
|
|
;; Ignore field boundaries if the initial and final
|
|
|
|
|
;; positions have the same `field' property, even if the
|
|
|
|
|
;; fields are non-contiguous. This seems to be "nicer"
|
|
|
|
|
;; behavior in many situations.
|
|
|
|
|
(if (eq (get-char-property new 'field)
|
|
|
|
|
(get-char-property opoint 'field))
|
|
|
|
|
new
|
|
|
|
|
(constrain-to-field new opoint t t
|
|
|
|
|
'inhibit-line-move-field-capture))))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
|
2002-04-22 22:35:46 +00:00
|
|
|
|
;; If all this moved us to a different line,
|
2001-12-28 05:15:59 +00:00
|
|
|
|
;; retry everything within that new line.
|
|
|
|
|
(when (or (< (point) line-beg) (> (point) line-end))
|
|
|
|
|
;; Repeat the intangibility and field processing.
|
|
|
|
|
(setq repeat t))))))
|
|
|
|
|
|
|
|
|
|
(defun line-move-to-column (col)
|
|
|
|
|
"Try to find column COL, considering invisibility.
|
|
|
|
|
This function works only in certain cases,
|
|
|
|
|
because what we really need is for `move-to-column'
|
|
|
|
|
and `current-column' to be able to ignore invisible text."
|
2002-03-28 18:27:23 +00:00
|
|
|
|
(if (zerop col)
|
|
|
|
|
(beginning-of-line)
|
2006-09-16 14:14:53 +00:00
|
|
|
|
(move-to-column col))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
|
|
|
|
|
(when (and line-move-ignore-invisible
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(not (bolp)) (invisible-p (1- (point))))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
(let ((normal-location (point))
|
|
|
|
|
(normal-column (current-column)))
|
|
|
|
|
;; If the following character is currently invisible,
|
|
|
|
|
;; skip all characters with that same `invisible' property value.
|
|
|
|
|
(while (and (not (eobp))
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(invisible-p (point)))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
(goto-char (next-char-property-change (point))))
|
|
|
|
|
;; Have we advanced to a larger column position?
|
|
|
|
|
(if (> (current-column) normal-column)
|
|
|
|
|
;; We have made some progress towards the desired column.
|
|
|
|
|
;; See if we can make any further progress.
|
|
|
|
|
(line-move-to-column (+ (current-column) (- col normal-column)))
|
|
|
|
|
;; Otherwise, go to the place we originally found
|
|
|
|
|
;; and move back over invisible text.
|
|
|
|
|
;; that will get us to the same place on the screen
|
|
|
|
|
;; but with a more reasonable buffer position.
|
|
|
|
|
(goto-char normal-location)
|
2015-05-09 16:06:48 +03:00
|
|
|
|
(let ((line-beg
|
|
|
|
|
;; We want the real line beginning, so it's consistent
|
|
|
|
|
;; with bolp below, otherwise we might infloop.
|
|
|
|
|
(let ((inhibit-field-text-motion t))
|
|
|
|
|
(line-beginning-position))))
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(while (and (not (bolp)) (invisible-p (1- (point))))
|
2001-12-28 05:15:59 +00:00
|
|
|
|
(goto-char (previous-char-property-change (point) line-beg))))))))
|
|
|
|
|
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(defun move-end-of-line (arg)
|
2006-01-05 15:59:50 +00:00
|
|
|
|
"Move point to end of current line as displayed.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
With argument ARG not nil or 1, move forward ARG - 1 lines first.
|
|
|
|
|
If point reaches the beginning or end of buffer, it stops there.
|
2009-01-04 08:03:23 +00:00
|
|
|
|
|
|
|
|
|
To ignore the effects of the `intangible' text or overlay
|
|
|
|
|
property, bind `inhibit-point-motion-hooks' to t.
|
|
|
|
|
If there is an image in the current line, this function
|
|
|
|
|
disregards newlines that are part of the text on which the image
|
|
|
|
|
rests."
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p")
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(or arg (setq arg 1))
|
|
|
|
|
(let (done)
|
|
|
|
|
(while (not done)
|
|
|
|
|
(let ((newpos
|
|
|
|
|
(save-excursion
|
2008-07-11 18:07:01 +00:00
|
|
|
|
(let ((goal-column 0)
|
|
|
|
|
(line-move-visual nil))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(and (line-move arg t)
|
2010-05-19 20:16:07 +03:00
|
|
|
|
;; With bidi reordering, we may not be at bol,
|
|
|
|
|
;; so make sure we are.
|
|
|
|
|
(skip-chars-backward "^\n")
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(not (bobp))
|
|
|
|
|
(progn
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(while (and (not (bobp)) (invisible-p (1- (point))))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(goto-char (previous-single-char-property-change
|
|
|
|
|
(point) 'invisible)))
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(backward-char 1)))
|
|
|
|
|
(point)))))
|
|
|
|
|
(goto-char newpos)
|
|
|
|
|
(if (and (> (point) newpos)
|
|
|
|
|
(eq (preceding-char) ?\n))
|
|
|
|
|
(backward-char 1)
|
|
|
|
|
(if (and (> (point) newpos) (not (eobp))
|
|
|
|
|
(not (eq (following-char) ?\n)))
|
2008-07-11 18:07:01 +00:00
|
|
|
|
;; If we skipped something intangible and now we're not
|
|
|
|
|
;; really at eol, keep going.
|
2004-11-08 16:59:43 +00:00
|
|
|
|
(setq arg 1)
|
|
|
|
|
(setq done t)))))))
|
|
|
|
|
|
2005-03-07 11:12:31 +00:00
|
|
|
|
(defun move-beginning-of-line (arg)
|
2006-01-05 15:59:50 +00:00
|
|
|
|
"Move point to beginning of current line as displayed.
|
|
|
|
|
\(If there's an image in the line, this disregards newlines
|
|
|
|
|
which are part of the text that the image rests on.)
|
|
|
|
|
|
2005-03-07 11:12:31 +00:00
|
|
|
|
With argument ARG not nil or 1, move forward ARG - 1 lines first.
|
|
|
|
|
If point reaches the beginning or end of buffer, it stops there.
|
2017-08-12 15:11:16 +03:00
|
|
|
|
\(But if the buffer doesn't end in a newline, it stops at the
|
|
|
|
|
beginning of the last line.)
|
2006-01-05 15:59:50 +00:00
|
|
|
|
To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p")
|
2005-03-07 11:12:31 +00:00
|
|
|
|
(or arg (setq arg 1))
|
2006-04-09 23:03:48 +00:00
|
|
|
|
|
2006-08-16 05:07:22 +00:00
|
|
|
|
(let ((orig (point))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
first-vis first-vis-field-value)
|
2006-01-26 17:56:54 +00:00
|
|
|
|
|
|
|
|
|
;; Move by lines, if ARG is not 1 (the default).
|
|
|
|
|
(if (/= arg 1)
|
2008-07-11 18:07:01 +00:00
|
|
|
|
(let ((line-move-visual nil))
|
|
|
|
|
(line-move (1- arg) t)))
|
2006-01-26 17:56:54 +00:00
|
|
|
|
|
2011-12-18 22:21:24 -08:00
|
|
|
|
;; Move to beginning-of-line, ignoring fields and invisible text.
|
2006-01-26 17:56:54 +00:00
|
|
|
|
(skip-chars-backward "^\n")
|
2007-08-25 20:20:26 +00:00
|
|
|
|
(while (and (not (bobp)) (invisible-p (1- (point))))
|
2006-02-02 04:21:10 +00:00
|
|
|
|
(goto-char (previous-char-property-change (point)))
|
2006-01-26 17:56:54 +00:00
|
|
|
|
(skip-chars-backward "^\n"))
|
2006-08-16 05:07:22 +00:00
|
|
|
|
|
2014-01-20 14:15:10 -05:00
|
|
|
|
;; Now find first visible char in the line.
|
|
|
|
|
(while (and (< (point) orig) (invisible-p (point)))
|
|
|
|
|
(goto-char (next-char-property-change (point) orig)))
|
2006-08-16 05:07:22 +00:00
|
|
|
|
(setq first-vis (point))
|
|
|
|
|
|
|
|
|
|
;; See if fields would stop us from reaching FIRST-VIS.
|
|
|
|
|
(setq first-vis-field-value
|
|
|
|
|
(constrain-to-field first-vis orig (/= arg 1) t nil))
|
|
|
|
|
|
|
|
|
|
(goto-char (if (/= first-vis-field-value first-vis)
|
|
|
|
|
;; If yes, obey them.
|
|
|
|
|
first-vis-field-value
|
|
|
|
|
;; Otherwise, move to START with attention to fields.
|
|
|
|
|
;; (It is possible that fields never matter in this case.)
|
|
|
|
|
(constrain-to-field (point) orig
|
|
|
|
|
(/= arg 1) t nil)))))
|
2005-03-07 11:12:31 +00:00
|
|
|
|
|
|
|
|
|
|
2009-08-19 02:31:59 +00:00
|
|
|
|
;; Many people have said they rarely use this feature, and often type
|
|
|
|
|
;; it by accident. Maybe it shouldn't even be on a key.
|
1993-01-14 14:50:16 +00:00
|
|
|
|
(put 'set-goal-column 'disabled t)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun set-goal-column (arg)
|
|
|
|
|
"Set the current horizontal position as a goal for \\[next-line] and \\[previous-line].
|
|
|
|
|
Those commands will move to this position in the line moved to
|
|
|
|
|
rather than trying to keep the same horizontal position.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With a non-nil argument ARG, clears out the goal column
|
1992-10-23 08:54:08 +00:00
|
|
|
|
so that \\[next-line] and \\[previous-line] resume vertical motion.
|
2016-04-30 14:14:57 +03:00
|
|
|
|
The goal column is stored in the variable `goal-column'.
|
|
|
|
|
This is a buffer-local setting."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if arg
|
|
|
|
|
(progn
|
|
|
|
|
(setq goal-column nil)
|
|
|
|
|
(message "No goal column"))
|
|
|
|
|
(setq goal-column (current-column))
|
2005-09-18 12:25:02 +00:00
|
|
|
|
;; The older method below can be erroneous if `set-goal-column' is bound
|
|
|
|
|
;; to a sequence containing %
|
|
|
|
|
;;(message (substitute-command-keys
|
|
|
|
|
;;"Goal column %d (use \\[set-goal-column] with an arg to unset it)")
|
|
|
|
|
;;goal-column)
|
|
|
|
|
(message "%s"
|
2005-11-12 00:10:56 +00:00
|
|
|
|
(concat
|
2005-09-18 12:25:02 +00:00
|
|
|
|
(format "Goal column %d " goal-column)
|
|
|
|
|
(substitute-command-keys
|
|
|
|
|
"(use \\[set-goal-column] with an arg to unset it)")))
|
2005-11-12 00:10:56 +00:00
|
|
|
|
|
2005-09-18 12:25:02 +00:00
|
|
|
|
)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
nil)
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2008-07-17 23:37:50 +00:00
|
|
|
|
;;; Editing based on visual lines, as opposed to logical lines.
|
|
|
|
|
|
|
|
|
|
(defun end-of-visual-line (&optional n)
|
|
|
|
|
"Move point to end of current visual line.
|
|
|
|
|
With argument N not nil or 1, move forward N - 1 visual lines first.
|
|
|
|
|
If point reaches the beginning or end of buffer, it stops there.
|
|
|
|
|
To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
|
|
|
|
|
(interactive "^p")
|
|
|
|
|
(or n (setq n 1))
|
|
|
|
|
(if (/= n 1)
|
|
|
|
|
(let ((line-move-visual t))
|
|
|
|
|
(line-move (1- n) t)))
|
2009-12-06 18:48:48 +00:00
|
|
|
|
;; Unlike `move-beginning-of-line', `move-end-of-line' doesn't
|
|
|
|
|
;; constrain to field boundaries, so we don't either.
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(vertical-motion (cons (window-width) 0)))
|
|
|
|
|
|
|
|
|
|
(defun beginning-of-visual-line (&optional n)
|
|
|
|
|
"Move point to beginning of current visual line.
|
|
|
|
|
With argument N not nil or 1, move forward N - 1 visual lines first.
|
|
|
|
|
If point reaches the beginning or end of buffer, it stops there.
|
2017-08-12 15:11:16 +03:00
|
|
|
|
\(But if the buffer doesn't end in a newline, it stops at the
|
|
|
|
|
beginning of the last visual line.)
|
2008-07-17 23:37:50 +00:00
|
|
|
|
To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
|
|
|
|
|
(interactive "^p")
|
|
|
|
|
(or n (setq n 1))
|
2009-12-06 18:48:48 +00:00
|
|
|
|
(let ((opoint (point)))
|
|
|
|
|
(if (/= n 1)
|
|
|
|
|
(let ((line-move-visual t))
|
|
|
|
|
(line-move (1- n) t)))
|
|
|
|
|
(vertical-motion 0)
|
|
|
|
|
;; Constrain to field boundaries, like `move-beginning-of-line'.
|
|
|
|
|
(goto-char (constrain-to-field (point) opoint (/= n 1)))))
|
2008-07-17 23:37:50 +00:00
|
|
|
|
|
|
|
|
|
(defun kill-visual-line (&optional arg)
|
|
|
|
|
"Kill the rest of the visual line.
|
2009-06-13 18:56:07 +00:00
|
|
|
|
With prefix argument ARG, kill that many visual lines from point.
|
|
|
|
|
If ARG is negative, kill visual lines backward.
|
|
|
|
|
If ARG is zero, kill the text before point on the current visual
|
|
|
|
|
line.
|
2008-07-17 23:37:50 +00:00
|
|
|
|
|
|
|
|
|
If you want to append the killed line to the last killed text,
|
|
|
|
|
use \\[append-next-kill] before \\[kill-line].
|
|
|
|
|
|
|
|
|
|
If the buffer is read-only, Emacs will beep and refrain from deleting
|
|
|
|
|
the line, but put the line in the kill ring anyway. This means that
|
|
|
|
|
you can use this command to copy text from a read-only buffer.
|
|
|
|
|
\(If the variable `kill-read-only-ok' is non-nil, then this won't
|
|
|
|
|
even beep.)"
|
|
|
|
|
(interactive "P")
|
2009-06-13 18:56:07 +00:00
|
|
|
|
;; Like in `kill-line', it's better to move point to the other end
|
|
|
|
|
;; of the kill before killing.
|
2009-07-15 02:05:32 +00:00
|
|
|
|
(let ((opoint (point))
|
|
|
|
|
(kill-whole-line (and kill-whole-line (bolp))))
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(if arg
|
|
|
|
|
(vertical-motion (prefix-numeric-value arg))
|
2009-06-13 18:56:07 +00:00
|
|
|
|
(end-of-visual-line 1)
|
|
|
|
|
(if (= (point) opoint)
|
|
|
|
|
(vertical-motion 1)
|
|
|
|
|
;; Skip any trailing whitespace at the end of the visual line.
|
|
|
|
|
;; We used to do this only if `show-trailing-whitespace' is
|
|
|
|
|
;; nil, but that's wrong; the correct thing would be to check
|
|
|
|
|
;; whether the trailing whitespace is highlighted. But, it's
|
|
|
|
|
;; OK to just do this unconditionally.
|
|
|
|
|
(skip-chars-forward " \t")))
|
2017-02-12 09:46:03 -05:00
|
|
|
|
(kill-region opoint (if (and kill-whole-line (= (following-char) ?\n))
|
2009-07-15 02:05:32 +00:00
|
|
|
|
(1+ (point))
|
|
|
|
|
(point)))))
|
2008-07-17 23:37:50 +00:00
|
|
|
|
|
|
|
|
|
(defun next-logical-line (&optional arg try-vscroll)
|
|
|
|
|
"Move cursor vertically down ARG lines.
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
This is identical to `next-line', except that it always moves
|
2008-07-17 23:37:50 +00:00
|
|
|
|
by logical lines instead of visual lines, ignoring the value of
|
|
|
|
|
the variable `line-move-visual'."
|
|
|
|
|
(interactive "^p\np")
|
|
|
|
|
(let ((line-move-visual nil))
|
|
|
|
|
(with-no-warnings
|
|
|
|
|
(next-line arg try-vscroll))))
|
|
|
|
|
|
|
|
|
|
(defun previous-logical-line (&optional arg try-vscroll)
|
|
|
|
|
"Move cursor vertically up ARG lines.
|
|
|
|
|
This is identical to `previous-line', except that it always moves
|
|
|
|
|
by logical lines instead of visual lines, ignoring the value of
|
|
|
|
|
the variable `line-move-visual'."
|
|
|
|
|
(interactive "^p\np")
|
|
|
|
|
(let ((line-move-visual nil))
|
|
|
|
|
(with-no-warnings
|
|
|
|
|
(previous-line arg try-vscroll))))
|
|
|
|
|
|
2008-07-21 03:50:17 +00:00
|
|
|
|
(defgroup visual-line nil
|
|
|
|
|
"Editing based on visual lines."
|
|
|
|
|
:group 'convenience
|
|
|
|
|
:version "23.1")
|
|
|
|
|
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(defvar visual-line-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map [remap kill-line] 'kill-visual-line)
|
|
|
|
|
(define-key map [remap move-beginning-of-line] 'beginning-of-visual-line)
|
|
|
|
|
(define-key map [remap move-end-of-line] 'end-of-visual-line)
|
2009-01-04 08:30:58 +00:00
|
|
|
|
;; These keybindings interfere with xterm function keys. Are
|
|
|
|
|
;; there any other suitable bindings?
|
|
|
|
|
;; (define-key map "\M-[" 'previous-logical-line)
|
|
|
|
|
;; (define-key map "\M-]" 'next-logical-line)
|
2008-07-17 23:37:50 +00:00
|
|
|
|
map))
|
|
|
|
|
|
2008-07-21 03:50:17 +00:00
|
|
|
|
(defcustom visual-line-fringe-indicators '(nil nil)
|
|
|
|
|
"How fringe indicators are shown for wrapped lines in `visual-line-mode'.
|
|
|
|
|
The value should be a list of the form (LEFT RIGHT), where LEFT
|
|
|
|
|
and RIGHT are symbols representing the bitmaps to display, to
|
|
|
|
|
indicate wrapped lines, in the left and right fringes respectively.
|
|
|
|
|
See also `fringe-indicator-alist'.
|
|
|
|
|
The default is not to display fringe indicators for wrapped lines.
|
|
|
|
|
This variable does not affect fringe indicators displayed for
|
|
|
|
|
other purposes."
|
|
|
|
|
:type '(list (choice (const :tag "Hide left indicator" nil)
|
|
|
|
|
(const :tag "Left curly arrow" left-curly-arrow)
|
|
|
|
|
(symbol :tag "Other bitmap"))
|
|
|
|
|
(choice (const :tag "Hide right indicator" nil)
|
|
|
|
|
(const :tag "Right curly arrow" right-curly-arrow)
|
|
|
|
|
(symbol :tag "Other bitmap")))
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(when (and (boundp 'visual-line-mode)
|
|
|
|
|
(symbol-value 'visual-line-mode))
|
|
|
|
|
(setq fringe-indicator-alist
|
|
|
|
|
(cons (cons 'continuation value)
|
|
|
|
|
(assq-delete-all
|
|
|
|
|
'continuation
|
|
|
|
|
(copy-tree fringe-indicator-alist)))))))
|
|
|
|
|
(set-default symbol value)))
|
|
|
|
|
|
2008-08-12 19:39:50 +00:00
|
|
|
|
(defvar visual-line--saved-state nil)
|
|
|
|
|
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(define-minor-mode visual-line-mode
|
2017-09-03 18:20:31 +03:00
|
|
|
|
"Toggle visual line based editing (Visual Line mode) in the current buffer.
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
|
|
|
|
|
When Visual Line mode is enabled, `word-wrap' is turned on in
|
|
|
|
|
this buffer, and simple editing commands are redefined to act on
|
|
|
|
|
visual lines, not logical lines. See Info node `Visual Line
|
|
|
|
|
Mode' for details."
|
2008-07-17 23:37:50 +00:00
|
|
|
|
:keymap visual-line-mode-map
|
2008-07-21 03:50:17 +00:00
|
|
|
|
:group 'visual-line
|
2010-02-03 21:02:56 -08:00
|
|
|
|
:lighter " Wrap"
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(if visual-line-mode
|
|
|
|
|
(progn
|
2008-08-12 19:39:50 +00:00
|
|
|
|
(set (make-local-variable 'visual-line--saved-state) nil)
|
|
|
|
|
;; Save the local values of some variables, to be restored if
|
|
|
|
|
;; visual-line-mode is turned off.
|
|
|
|
|
(dolist (var '(line-move-visual truncate-lines
|
|
|
|
|
truncate-partial-width-windows
|
|
|
|
|
word-wrap fringe-indicator-alist))
|
|
|
|
|
(if (local-variable-p var)
|
2008-08-12 19:41:18 +00:00
|
|
|
|
(push (cons var (symbol-value var))
|
2008-08-12 19:39:50 +00:00
|
|
|
|
visual-line--saved-state)))
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(set (make-local-variable 'line-move-visual) t)
|
2008-07-21 18:14:23 +00:00
|
|
|
|
(set (make-local-variable 'truncate-partial-width-windows) nil)
|
|
|
|
|
(setq truncate-lines nil
|
|
|
|
|
word-wrap t
|
|
|
|
|
fringe-indicator-alist
|
2008-07-21 03:50:17 +00:00
|
|
|
|
(cons (cons 'continuation visual-line-fringe-indicators)
|
|
|
|
|
fringe-indicator-alist)))
|
2008-07-17 23:37:50 +00:00
|
|
|
|
(kill-local-variable 'line-move-visual)
|
2008-07-21 03:50:17 +00:00
|
|
|
|
(kill-local-variable 'word-wrap)
|
2008-07-21 18:14:23 +00:00
|
|
|
|
(kill-local-variable 'truncate-lines)
|
|
|
|
|
(kill-local-variable 'truncate-partial-width-windows)
|
2008-08-12 19:39:50 +00:00
|
|
|
|
(kill-local-variable 'fringe-indicator-alist)
|
|
|
|
|
(dolist (saved visual-line--saved-state)
|
|
|
|
|
(set (make-local-variable (car saved)) (cdr saved)))
|
|
|
|
|
(kill-local-variable 'visual-line--saved-state)))
|
2008-07-17 23:37:50 +00:00
|
|
|
|
|
|
|
|
|
(defun turn-on-visual-line-mode ()
|
|
|
|
|
(visual-line-mode 1))
|
|
|
|
|
|
|
|
|
|
(define-globalized-minor-mode global-visual-line-mode
|
2013-07-25 21:55:06 -04:00
|
|
|
|
visual-line-mode turn-on-visual-line-mode)
|
2010-04-06 02:44:24 +03:00
|
|
|
|
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun transpose-chars (arg)
|
|
|
|
|
"Interchange characters around point, moving forward one character.
|
|
|
|
|
With prefix arg ARG, effect is to take character before point
|
|
|
|
|
and drag it forward past ARG other characters (backward if ARG negative).
|
|
|
|
|
If no argument and at end of line, the previous two chars are exchanged."
|
|
|
|
|
(interactive "*P")
|
2014-07-08 11:27:46 +03:00
|
|
|
|
(when (and (null arg) (eolp) (not (bobp))
|
|
|
|
|
(not (get-text-property (1- (point)) 'read-only)))
|
|
|
|
|
(forward-char -1))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(transpose-subr 'forward-char (prefix-numeric-value arg)))
|
|
|
|
|
|
|
|
|
|
(defun transpose-words (arg)
|
|
|
|
|
"Interchange words around point, leaving point at end of them.
|
|
|
|
|
With prefix arg ARG, effect is to take word before or around point
|
|
|
|
|
and drag it forward past ARG other words (backward if ARG negative).
|
|
|
|
|
If ARG is zero, the words around or after point and around or after mark
|
|
|
|
|
are interchanged."
|
2002-04-11 23:44:06 +00:00
|
|
|
|
;; FIXME: `foo a!nd bar' should transpose into `bar and foo'.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*p")
|
|
|
|
|
(transpose-subr 'forward-word arg))
|
|
|
|
|
|
|
|
|
|
(defun transpose-sexps (arg)
|
2016-11-04 11:50:48 +02:00
|
|
|
|
"Like \\[transpose-chars] (`transpose-chars'), but applies to sexps.
|
|
|
|
|
Unlike `transpose-words', point must be between the two sexps and not
|
|
|
|
|
in the middle of a sexp to be transposed.
|
|
|
|
|
With non-zero prefix arg ARG, effect is to take the sexp before point
|
|
|
|
|
and drag it forward past ARG other sexps (backward if ARG is negative).
|
|
|
|
|
If ARG is zero, the sexps ending at or after point and at or after mark
|
|
|
|
|
are interchanged."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "*p")
|
2002-04-11 23:44:06 +00:00
|
|
|
|
(transpose-subr
|
|
|
|
|
(lambda (arg)
|
|
|
|
|
;; Here we should try to simulate the behavior of
|
|
|
|
|
;; (cons (progn (forward-sexp x) (point))
|
|
|
|
|
;; (progn (forward-sexp (- x)) (point)))
|
|
|
|
|
;; Except that we don't want to rely on the second forward-sexp
|
|
|
|
|
;; putting us back to where we want to be, since forward-sexp-function
|
|
|
|
|
;; might do funny things like infix-precedence.
|
|
|
|
|
(if (if (> arg 0)
|
|
|
|
|
(looking-at "\\sw\\|\\s_")
|
|
|
|
|
(and (not (bobp))
|
|
|
|
|
(save-excursion (forward-char -1) (looking-at "\\sw\\|\\s_"))))
|
|
|
|
|
;; Jumping over a symbol. We might be inside it, mind you.
|
|
|
|
|
(progn (funcall (if (> arg 0)
|
|
|
|
|
'skip-syntax-backward 'skip-syntax-forward)
|
|
|
|
|
"w_")
|
|
|
|
|
(cons (save-excursion (forward-sexp arg) (point)) (point)))
|
|
|
|
|
;; Otherwise, we're between sexps. Take a step back before jumping
|
|
|
|
|
;; to make sure we'll obey the same precedence no matter which direction
|
|
|
|
|
;; we're going.
|
|
|
|
|
(funcall (if (> arg 0) 'skip-syntax-backward 'skip-syntax-forward) " .")
|
|
|
|
|
(cons (save-excursion (forward-sexp arg) (point))
|
|
|
|
|
(progn (while (or (forward-comment (if (> arg 0) 1 -1))
|
|
|
|
|
(not (zerop (funcall (if (> arg 0)
|
|
|
|
|
'skip-syntax-forward
|
|
|
|
|
'skip-syntax-backward)
|
|
|
|
|
".")))))
|
|
|
|
|
(point)))))
|
|
|
|
|
arg 'special))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun transpose-lines (arg)
|
|
|
|
|
"Exchange current line and previous line, leaving point after both.
|
|
|
|
|
With argument ARG, takes previous line and moves it past ARG lines.
|
|
|
|
|
With argument 0, interchanges line point is in with line mark is in."
|
|
|
|
|
(interactive "*p")
|
|
|
|
|
(transpose-subr (function
|
|
|
|
|
(lambda (arg)
|
1997-12-17 13:54:03 +00:00
|
|
|
|
(if (> arg 0)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(progn
|
1997-12-17 13:54:03 +00:00
|
|
|
|
;; Move forward over ARG lines,
|
|
|
|
|
;; but create newlines if necessary.
|
|
|
|
|
(setq arg (forward-line arg))
|
|
|
|
|
(if (/= (preceding-char) ?\n)
|
|
|
|
|
(setq arg (1+ arg)))
|
|
|
|
|
(if (> arg 0)
|
|
|
|
|
(newline arg)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(forward-line arg))))
|
|
|
|
|
arg))
|
|
|
|
|
|
2010-02-13 11:29:25 -08:00
|
|
|
|
;; FIXME seems to leave point BEFORE the current object when ARG = 0,
|
|
|
|
|
;; which seems inconsistent with the ARG /= 0 case.
|
|
|
|
|
;; FIXME document SPECIAL.
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(defun transpose-subr (mover arg &optional special)
|
2010-02-13 11:29:25 -08:00
|
|
|
|
"Subroutine to do the work of transposing objects.
|
|
|
|
|
Works for lines, sentences, paragraphs, etc. MOVER is a function that
|
|
|
|
|
moves forward by units of the given object (e.g. forward-sentence,
|
|
|
|
|
forward-paragraph). If ARG is zero, exchanges the current object
|
|
|
|
|
with the one containing mark. If ARG is an integer, moves the
|
|
|
|
|
current object past ARG following (if ARG is positive) or
|
|
|
|
|
preceding (if ARG is negative) objects, leaving point after the
|
|
|
|
|
current object."
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(let ((aux (if special mover
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(cons (progn (funcall mover x) (point))
|
|
|
|
|
(progn (funcall mover (- x)) (point))))))
|
|
|
|
|
pos1 pos2)
|
|
|
|
|
(cond
|
|
|
|
|
((= arg 0)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq pos1 (funcall aux 1))
|
2009-10-26 14:59:12 +00:00
|
|
|
|
(goto-char (or (mark) (error "No mark set in this buffer")))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(setq pos2 (funcall aux 1))
|
|
|
|
|
(transpose-subr-1 pos1 pos2))
|
|
|
|
|
(exchange-point-and-mark))
|
|
|
|
|
((> arg 0)
|
|
|
|
|
(setq pos1 (funcall aux -1))
|
|
|
|
|
(setq pos2 (funcall aux arg))
|
|
|
|
|
(transpose-subr-1 pos1 pos2)
|
|
|
|
|
(goto-char (car pos2)))
|
|
|
|
|
(t
|
|
|
|
|
(setq pos1 (funcall aux -1))
|
|
|
|
|
(goto-char (car pos1))
|
|
|
|
|
(setq pos2 (funcall aux arg))
|
2015-11-13 11:46:20 +02:00
|
|
|
|
(transpose-subr-1 pos1 pos2)
|
|
|
|
|
(goto-char (+ (car pos2) (- (cdr pos1) (car pos1))))))))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
|
|
|
|
|
(defun transpose-subr-1 (pos1 pos2)
|
|
|
|
|
(when (> (car pos1) (cdr pos1)) (setq pos1 (cons (cdr pos1) (car pos1))))
|
|
|
|
|
(when (> (car pos2) (cdr pos2)) (setq pos2 (cons (cdr pos2) (car pos2))))
|
|
|
|
|
(when (> (car pos1) (car pos2))
|
|
|
|
|
(let ((swap pos1))
|
|
|
|
|
(setq pos1 pos2 pos2 swap)))
|
|
|
|
|
(if (> (cdr pos1) (car pos2)) (error "Don't have two things to transpose"))
|
2002-02-06 15:08:45 +00:00
|
|
|
|
(atomic-change-group
|
2012-12-21 13:42:59 +08:00
|
|
|
|
;; This sequence of insertions attempts to preserve marker
|
|
|
|
|
;; positions at the start and end of the transposed objects.
|
|
|
|
|
(let* ((word (buffer-substring (car pos2) (cdr pos2)))
|
|
|
|
|
(len1 (- (cdr pos1) (car pos1)))
|
|
|
|
|
(len2 (length word))
|
|
|
|
|
(boundary (make-marker)))
|
|
|
|
|
(set-marker boundary (car pos2))
|
|
|
|
|
(goto-char (cdr pos1))
|
|
|
|
|
(insert-before-markers word)
|
|
|
|
|
(setq word (delete-and-extract-region (car pos1) (+ (car pos1) len1)))
|
|
|
|
|
(goto-char boundary)
|
|
|
|
|
(insert word)
|
|
|
|
|
(goto-char (+ boundary len1))
|
|
|
|
|
(delete-region (point) (+ (point) len2))
|
|
|
|
|
(set-marker boundary nil))))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(defun backward-word (&optional arg)
|
2001-09-04 08:37:35 +00:00
|
|
|
|
"Move backward until encountering the beginning of a word.
|
2013-08-13 22:26:39 +08:00
|
|
|
|
With argument ARG, do this that many times.
|
2016-02-10 20:30:12 +02:00
|
|
|
|
If ARG is omitted or nil, move point backward one word.
|
|
|
|
|
|
2018-03-13 22:17:43 -04:00
|
|
|
|
The word boundaries are normally determined by the buffer's
|
|
|
|
|
syntax table and character script (according to
|
|
|
|
|
`char-script-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. See Info
|
|
|
|
|
node `(elisp) Word Motion' for details."
|
2008-04-02 20:16:10 +00:00
|
|
|
|
(interactive "^p")
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(forward-word (- (or arg 1))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2004-12-29 01:33:04 +00:00
|
|
|
|
(defun mark-word (&optional arg allow-extend)
|
2004-12-13 03:08:52 +00:00
|
|
|
|
"Set mark ARG words away from point.
|
|
|
|
|
The place mark goes is the same place \\[forward-word] would
|
|
|
|
|
move to with the same argument.
|
2004-12-29 01:33:04 +00:00
|
|
|
|
Interactively, if this command is repeated
|
2005-01-06 22:00:36 +00:00
|
|
|
|
or (in Transient Mark mode) if the mark is active,
|
2004-12-13 03:08:52 +00:00
|
|
|
|
it marks the next ARG words after the ones already marked."
|
2004-12-29 01:33:04 +00:00
|
|
|
|
(interactive "P\np")
|
|
|
|
|
(cond ((and allow-extend
|
|
|
|
|
(or (and (eq last-command this-command) (mark t))
|
2008-04-03 02:16:17 +00:00
|
|
|
|
(region-active-p)))
|
2004-12-13 03:08:52 +00:00
|
|
|
|
(setq arg (if arg (prefix-numeric-value arg)
|
|
|
|
|
(if (< (mark) (point)) -1 1)))
|
2002-02-15 08:53:15 +00:00
|
|
|
|
(set-mark
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (mark))
|
|
|
|
|
(forward-word arg)
|
|
|
|
|
(point))))
|
|
|
|
|
(t
|
|
|
|
|
(push-mark
|
|
|
|
|
(save-excursion
|
2004-12-13 03:08:52 +00:00
|
|
|
|
(forward-word (prefix-numeric-value arg))
|
2002-02-15 08:53:15 +00:00
|
|
|
|
(point))
|
|
|
|
|
nil t))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun kill-word (arg)
|
|
|
|
|
"Kill characters forward until encountering the end of a word.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With argument ARG, do this that many times."
|
2000-02-23 23:08:02 +00:00
|
|
|
|
(interactive "p")
|
1999-08-25 21:12:15 +00:00
|
|
|
|
(kill-region (point) (progn (forward-word arg) (point))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun backward-kill-word (arg)
|
2007-01-05 20:24:50 +00:00
|
|
|
|
"Kill characters backward until encountering the beginning of a word.
|
* simple.el (quoted-insert, minibuffer-history-isearch-pop-state, undo)
(undo-only, rotate-yank-pointer, kill-whole-line, push-mark-command)
(exchange-point-and-mark, set-goal-column, kill-line, backward-word)
(kill-word, backward-kill-word): Doc fixes.
(shell-command, repeat-complex-command): Reflow docstrings.
(zap-to-char, pop-to-mark-command): Fix typos in docstrings.
2008-11-17 01:54:02 +00:00
|
|
|
|
With argument ARG, do this that many times."
|
2000-02-23 23:08:02 +00:00
|
|
|
|
(interactive "p")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(kill-word (- arg)))
|
1993-03-29 04:58:31 +00:00
|
|
|
|
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(defun current-word (&optional strict really-word)
|
2016-11-25 11:44:24 +02:00
|
|
|
|
"Return the word at or near point, as a string.
|
2003-07-07 21:00:26 +00:00
|
|
|
|
The return value includes no text properties.
|
2016-11-25 11:44:24 +02:00
|
|
|
|
|
|
|
|
|
If optional arg STRICT is non-nil, return nil unless point is
|
|
|
|
|
within or adjacent to a word, otherwise look for a word within
|
|
|
|
|
point's line. If there is no word anywhere on point's line, the
|
|
|
|
|
value is nil regardless of STRICT.
|
|
|
|
|
|
|
|
|
|
By default, this function treats as a single word any sequence of
|
|
|
|
|
characters that have either word or symbol syntax. If optional
|
|
|
|
|
arg REALLY-WORD is non-nil, only characters of word syntax can
|
|
|
|
|
constitute a word."
|
1993-03-29 04:58:31 +00:00
|
|
|
|
(save-excursion
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(let* ((oldpoint (point)) (start (point)) (end (point))
|
2003-07-18 22:46:08 +00:00
|
|
|
|
(syntaxes (if really-word "w" "w_"))
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(not-syntaxes (concat "^" syntaxes)))
|
|
|
|
|
(skip-syntax-backward syntaxes) (setq start (point))
|
1993-03-29 04:58:31 +00:00
|
|
|
|
(goto-char oldpoint)
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(skip-syntax-forward syntaxes) (setq end (point))
|
|
|
|
|
(when (and (eq start oldpoint) (eq end oldpoint)
|
|
|
|
|
;; Point is neither within nor adjacent to a word.
|
|
|
|
|
(not strict))
|
|
|
|
|
;; Look for preceding word in same line.
|
Replace still more end-of-line etc with line-end-position, etc.
* lisp/gnus/nnbabyl.el (nnbabyl-request-move-article, nnbabyl-delete-mail)
(nnbabyl-check-mbox): Use point-at-bol.
* lisp/cedet/semantic/lex.el (semantic-lex-ignore-comments, semantic-flex):
* lisp/cedet/semantic/grammar.el (semantic-grammar-epilogue):
* lisp/cedet/ede/speedbar.el (ede-find-nearest-file-line):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/ede/autoconf-edit.el (autoconf-delete-parameter):
Use point-at-bol and point-at-eol.
* lisp/vc/emerge.el (emerge-line-number-in-buf):
* lisp/textmodes/ispell.el (ispell-region):
* lisp/textmodes/fill.el (current-fill-column):
* lisp/progmodes/xscheme.el (xscheme-send-current-line):
* lisp/progmodes/vhdl-mode.el (vhdl-current-line, vhdl-line-copy):
* lisp/progmodes/tcl.el (tcl-hairy-scan-for-comment):
* lisp/progmodes/sh-script.el (sh-handle-prev-do):
* lisp/progmodes/meta-mode.el (meta-indent-line):
* lisp/progmodes/idlwave.el (idlwave-goto-comment, idlwave-fill-paragraph)
(idlwave-in-quote):
* lisp/progmodes/idlw-shell.el (idlwave-shell-current-frame)
(idlwave-shell-update-bp-overlays, idlwave-shell-sources-filter):
* lisp/progmodes/fortran.el (fortran-looking-at-if-then):
* lisp/progmodes/etags.el (find-tag-in-order, etags-snarf-tag):
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent)
(cperl-find-pods-heres):
* lisp/progmodes/ada-mode.el (ada-get-current-indent, ada-narrow-to-defun):
* lisp/net/quickurl.el (quickurl-list-insert):
* lisp/net/ldap.el (ldap-search-internal):
* lisp/net/eudc.el (eudc-expand-inline):
* lisp/mail/sendmail.el (sendmail-send-it):
* lisp/mail/mspools.el (mspools-visit-spool, mspools-get-spool-name):
* lisp/emulation/viper-cmd.el (viper-paren-match, viper-backward-indent)
(viper-brac-function):
* lisp/calc/calc-yank.el (calc-do-grab-region):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/term.el (term-move-columns, term-insert-spaces):
* lisp/speedbar.el (speedbar-highlight-one-tag-line):
* lisp/simple.el (current-word):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* lisp/info.el (Info-find-node-in-buffer-1, Info-follow-reference)
(Info-scroll-down):
* lisp/hippie-exp.el (he-line-beg):
* lisp/epa.el (epa--marked-keys):
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-update-file-line, dired-add-entry, dired-remove-entry)
(dired-relist-entry):
* lisp/buff-menu.el (Buffer-menu-buffer):
* lisp/array.el (current-line):
* lisp/allout.el (allout-resolve-xref)
(allout-latex-verbatim-quote-curr-line):
Replace yet more uses of end-of-line etc with line-end-position.
2010-11-08 21:33:07 -08:00
|
|
|
|
(skip-syntax-backward not-syntaxes (line-beginning-position))
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(if (bolp)
|
|
|
|
|
;; No preceding word in same line.
|
|
|
|
|
;; Look for following word in same line.
|
|
|
|
|
(progn
|
Replace still more end-of-line etc with line-end-position, etc.
* lisp/gnus/nnbabyl.el (nnbabyl-request-move-article, nnbabyl-delete-mail)
(nnbabyl-check-mbox): Use point-at-bol.
* lisp/cedet/semantic/lex.el (semantic-lex-ignore-comments, semantic-flex):
* lisp/cedet/semantic/grammar.el (semantic-grammar-epilogue):
* lisp/cedet/ede/speedbar.el (ede-find-nearest-file-line):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/ede/autoconf-edit.el (autoconf-delete-parameter):
Use point-at-bol and point-at-eol.
* lisp/vc/emerge.el (emerge-line-number-in-buf):
* lisp/textmodes/ispell.el (ispell-region):
* lisp/textmodes/fill.el (current-fill-column):
* lisp/progmodes/xscheme.el (xscheme-send-current-line):
* lisp/progmodes/vhdl-mode.el (vhdl-current-line, vhdl-line-copy):
* lisp/progmodes/tcl.el (tcl-hairy-scan-for-comment):
* lisp/progmodes/sh-script.el (sh-handle-prev-do):
* lisp/progmodes/meta-mode.el (meta-indent-line):
* lisp/progmodes/idlwave.el (idlwave-goto-comment, idlwave-fill-paragraph)
(idlwave-in-quote):
* lisp/progmodes/idlw-shell.el (idlwave-shell-current-frame)
(idlwave-shell-update-bp-overlays, idlwave-shell-sources-filter):
* lisp/progmodes/fortran.el (fortran-looking-at-if-then):
* lisp/progmodes/etags.el (find-tag-in-order, etags-snarf-tag):
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent)
(cperl-find-pods-heres):
* lisp/progmodes/ada-mode.el (ada-get-current-indent, ada-narrow-to-defun):
* lisp/net/quickurl.el (quickurl-list-insert):
* lisp/net/ldap.el (ldap-search-internal):
* lisp/net/eudc.el (eudc-expand-inline):
* lisp/mail/sendmail.el (sendmail-send-it):
* lisp/mail/mspools.el (mspools-visit-spool, mspools-get-spool-name):
* lisp/emulation/viper-cmd.el (viper-paren-match, viper-backward-indent)
(viper-brac-function):
* lisp/calc/calc-yank.el (calc-do-grab-region):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/term.el (term-move-columns, term-insert-spaces):
* lisp/speedbar.el (speedbar-highlight-one-tag-line):
* lisp/simple.el (current-word):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* lisp/info.el (Info-find-node-in-buffer-1, Info-follow-reference)
(Info-scroll-down):
* lisp/hippie-exp.el (he-line-beg):
* lisp/epa.el (epa--marked-keys):
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-update-file-line, dired-add-entry, dired-remove-entry)
(dired-relist-entry):
* lisp/buff-menu.el (Buffer-menu-buffer):
* lisp/array.el (current-line):
* lisp/allout.el (allout-resolve-xref)
(allout-latex-verbatim-quote-curr-line):
Replace yet more uses of end-of-line etc with line-end-position.
2010-11-08 21:33:07 -08:00
|
|
|
|
(skip-syntax-forward not-syntaxes (line-end-position))
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(setq start (point))
|
|
|
|
|
(skip-syntax-forward syntaxes)
|
|
|
|
|
(setq end (point)))
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(skip-syntax-backward syntaxes)
|
|
|
|
|
(setq start (point))))
|
|
|
|
|
;; If we found something nonempty, return it as a string.
|
|
|
|
|
(unless (= start end)
|
1997-06-22 09:16:07 +00:00
|
|
|
|
(buffer-substring-no-properties start end)))))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom fill-prefix nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"String for filling to insert at front of new line, or nil for none."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type '(choice (const :tag "None" nil)
|
|
|
|
|
string)
|
|
|
|
|
:group 'fill)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(make-variable-buffer-local 'fill-prefix)
|
2008-03-14 17:42:18 +00:00
|
|
|
|
(put 'fill-prefix 'safe-local-variable 'string-or-null-p)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom auto-fill-inhibit-regexp nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Regexp to match lines which should not be auto-filled."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type '(choice (const :tag "None" nil)
|
|
|
|
|
regexp)
|
|
|
|
|
:group 'fill)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun do-auto-fill ()
|
2011-01-22 13:02:49 -08:00
|
|
|
|
"The default value for `normal-auto-fill-function'.
|
|
|
|
|
This is the default auto-fill function, some major modes use a different one.
|
|
|
|
|
Returns t if it really did any work."
|
2004-05-19 19:10:19 +00:00
|
|
|
|
(let (fc justify give-up
|
1995-07-28 02:38:16 +00:00
|
|
|
|
(fill-prefix fill-prefix))
|
1995-01-19 04:26:55 +00:00
|
|
|
|
(if (or (not (setq justify (current-justification)))
|
1995-06-29 03:18:29 +00:00
|
|
|
|
(null (setq fc (current-fill-column)))
|
|
|
|
|
(and (eq justify 'left)
|
|
|
|
|
(<= (current-column) fc))
|
2004-05-19 19:10:19 +00:00
|
|
|
|
(and auto-fill-inhibit-regexp
|
|
|
|
|
(save-excursion (beginning-of-line)
|
1995-01-19 04:21:56 +00:00
|
|
|
|
(looking-at auto-fill-inhibit-regexp))))
|
|
|
|
|
nil ;; Auto-filling not required
|
1995-02-23 18:38:42 +00:00
|
|
|
|
(if (memq justify '(full center right))
|
|
|
|
|
(save-excursion (unjustify-current-line)))
|
1995-07-28 02:38:16 +00:00
|
|
|
|
|
|
|
|
|
;; Choose a fill-prefix automatically.
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(when (and adaptive-fill-mode
|
|
|
|
|
(or (null fill-prefix) (string= fill-prefix "")))
|
|
|
|
|
(let ((prefix
|
|
|
|
|
(fill-context-prefix
|
2011-06-01 12:52:35 -03:00
|
|
|
|
(save-excursion (fill-forward-paragraph -1) (point))
|
|
|
|
|
(save-excursion (fill-forward-paragraph 1) (point)))))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(and prefix (not (equal prefix ""))
|
|
|
|
|
;; Use auto-indentation rather than a guessed empty prefix.
|
2002-09-10 01:24:12 +00:00
|
|
|
|
(not (and fill-indent-according-to-mode
|
2002-09-09 22:09:14 +00:00
|
|
|
|
(string-match "\\`[ \t]*\\'" prefix)))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(setq fill-prefix prefix))))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
|
1995-01-19 04:21:56 +00:00
|
|
|
|
(while (and (not give-up) (> (current-column) fc))
|
2017-08-23 13:40:45 -04:00
|
|
|
|
;; Determine where to split the line.
|
|
|
|
|
(let ((fill-point
|
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
;; Don't split earlier in the line than the length of the
|
|
|
|
|
;; fill prefix, since the resulting line would be longer.
|
|
|
|
|
(when fill-prefix
|
|
|
|
|
(move-to-column (string-width fill-prefix)))
|
|
|
|
|
(let ((after-prefix (point)))
|
|
|
|
|
(move-to-column (1+ fc))
|
|
|
|
|
(fill-move-to-break-point after-prefix)
|
|
|
|
|
(point)))))
|
1997-08-14 03:55:49 +00:00
|
|
|
|
|
|
|
|
|
;; See whether the place we found is any good.
|
1995-07-30 00:46:23 +00:00
|
|
|
|
(if (save-excursion
|
|
|
|
|
(goto-char fill-point)
|
2002-04-11 23:44:06 +00:00
|
|
|
|
(or (bolp)
|
|
|
|
|
;; There is no use breaking at end of line.
|
|
|
|
|
(save-excursion (skip-chars-forward " ") (eolp))
|
|
|
|
|
;; Don't split right after a comment starter
|
|
|
|
|
;; since we would just make another comment starter.
|
|
|
|
|
(and comment-start-skip
|
|
|
|
|
(let ((limit (point)))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(and (re-search-forward comment-start-skip
|
|
|
|
|
limit t)
|
|
|
|
|
(eq (point) limit))))))
|
|
|
|
|
;; No good place to break => stop trying.
|
|
|
|
|
(setq give-up t)
|
|
|
|
|
;; Ok, we have a useful place to break the line. Do it.
|
|
|
|
|
(let ((prev-column (current-column)))
|
|
|
|
|
;; If point is at the fill-point, do not `save-excursion'.
|
|
|
|
|
;; Otherwise, if a comment prefix or fill-prefix is inserted,
|
|
|
|
|
;; point will end up before it rather than after it.
|
|
|
|
|
(if (save-excursion
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(= (point) fill-point))
|
2007-08-07 03:04:23 +00:00
|
|
|
|
(default-indent-new-line t)
|
2002-04-11 23:44:06 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char fill-point)
|
2007-08-07 03:04:23 +00:00
|
|
|
|
(default-indent-new-line t)))
|
2002-04-11 23:44:06 +00:00
|
|
|
|
;; Now do justification, if required
|
|
|
|
|
(if (not (eq justify 'left))
|
1995-07-30 00:46:23 +00:00
|
|
|
|
(save-excursion
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(end-of-line 0)
|
|
|
|
|
(justify-current-line justify nil t)))
|
2002-04-11 23:44:06 +00:00
|
|
|
|
;; If making the new line didn't reduce the hpos of
|
|
|
|
|
;; the end of the line, then give up now;
|
|
|
|
|
;; trying again will not help.
|
|
|
|
|
(if (>= (current-column) prev-column)
|
|
|
|
|
(setq give-up t))))))
|
1996-08-07 19:45:46 +00:00
|
|
|
|
;; Justify last line.
|
1996-05-21 14:31:40 +00:00
|
|
|
|
(justify-current-line justify t t)
|
1999-11-15 16:11:14 +00:00
|
|
|
|
t)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2007-08-07 03:04:23 +00:00
|
|
|
|
(defvar comment-line-break-function 'comment-indent-new-line
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Mode-specific function which line breaks and continues a comment.
|
2007-08-07 03:04:23 +00:00
|
|
|
|
This function is called during auto-filling when a comment syntax
|
|
|
|
|
is defined.
|
|
|
|
|
The function should take a single optional argument, which is a flag
|
|
|
|
|
indicating whether it should use soft newlines.")
|
|
|
|
|
|
|
|
|
|
(defun default-indent-new-line (&optional soft)
|
|
|
|
|
"Break line at point and indent.
|
|
|
|
|
If a comment syntax is defined, call `comment-indent-new-line'.
|
|
|
|
|
|
|
|
|
|
The inserted newline is marked hard if variable `use-hard-newlines' is true,
|
|
|
|
|
unless optional argument SOFT is non-nil."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if comment-start
|
|
|
|
|
(funcall comment-line-break-function soft)
|
|
|
|
|
;; Insert the newline before removing empty space so that markers
|
|
|
|
|
;; get preserved better.
|
|
|
|
|
(if soft (insert-and-inherit ?\n) (newline 1))
|
|
|
|
|
(save-excursion (forward-char -1) (delete-horizontal-space))
|
|
|
|
|
(delete-horizontal-space)
|
|
|
|
|
|
|
|
|
|
(if (and fill-prefix (not adaptive-fill-mode))
|
|
|
|
|
;; Blindly trust a non-adaptive fill-prefix.
|
|
|
|
|
(progn
|
|
|
|
|
(indent-to-left-margin)
|
|
|
|
|
(insert-before-markers-and-inherit fill-prefix))
|
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
;; If there's an adaptive prefix, use it unless we're inside
|
|
|
|
|
;; a comment and the prefix is not a comment starter.
|
|
|
|
|
(fill-prefix
|
|
|
|
|
(indent-to-left-margin)
|
|
|
|
|
(insert-and-inherit fill-prefix))
|
|
|
|
|
;; If we're not inside a comment, just try to indent.
|
|
|
|
|
(t (indent-according-to-mode))))))
|
|
|
|
|
|
2017-08-05 18:30:52 -06:00
|
|
|
|
(defun internal-auto-fill ()
|
|
|
|
|
"The function called by `self-insert-command' to perform auto-filling."
|
|
|
|
|
(when (or (not comment-start)
|
|
|
|
|
(not comment-auto-fill-only-comments)
|
|
|
|
|
(nth 4 (syntax-ppss)))
|
2017-08-09 16:06:23 -06:00
|
|
|
|
(funcall auto-fill-function)))
|
2017-08-05 18:30:52 -06:00
|
|
|
|
|
1996-08-07 19:45:46 +00:00
|
|
|
|
(defvar normal-auto-fill-function 'do-auto-fill
|
|
|
|
|
"The function to use for `auto-fill-function' if Auto Fill mode is turned on.
|
|
|
|
|
Some major modes set this.")
|
|
|
|
|
|
2005-03-16 13:11:34 +00:00
|
|
|
|
(put 'auto-fill-function :minor-mode-function 'auto-fill-mode)
|
2009-04-02 01:56:43 +00:00
|
|
|
|
;; `functions' and `hooks' are usually unsafe to set, but setting
|
|
|
|
|
;; auto-fill-function to nil in a file-local setting is safe and
|
|
|
|
|
;; can be useful to prevent auto-filling.
|
|
|
|
|
(put 'auto-fill-function 'safe-local-variable 'null)
|
2011-07-16 20:42:38 +02:00
|
|
|
|
|
2010-05-04 23:45:21 -04:00
|
|
|
|
(define-minor-mode auto-fill-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
"Toggle automatic line breaking (Auto Fill mode).
|
|
|
|
|
|
|
|
|
|
When Auto Fill mode is enabled, inserting a space at a column
|
|
|
|
|
beyond `current-fill-column' automatically breaks the line at a
|
|
|
|
|
previous space.
|
1996-08-07 19:45:46 +00:00
|
|
|
|
|
2011-07-16 20:42:38 +02:00
|
|
|
|
When `auto-fill-mode' is on, the `auto-fill-function' variable is
|
2015-05-21 10:04:45 -07:00
|
|
|
|
non-nil.
|
2011-07-16 20:42:38 +02:00
|
|
|
|
|
1996-08-07 19:45:46 +00:00
|
|
|
|
The value of `normal-auto-fill-function' specifies the function to use
|
|
|
|
|
for `auto-fill-function' when turning Auto Fill mode on."
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
:variable (auto-fill-function
|
|
|
|
|
. (lambda (v) (setq auto-fill-function
|
|
|
|
|
(if v normal-auto-fill-function)))))
|
1994-04-16 02:06:17 +00:00
|
|
|
|
|
|
|
|
|
;; This holds a document string used to document auto-fill-mode.
|
|
|
|
|
(defun auto-fill-function ()
|
|
|
|
|
"Automatically break line at a previous space, in insertion of text."
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defun turn-on-auto-fill ()
|
|
|
|
|
"Unconditionally turn on Auto Fill mode."
|
|
|
|
|
(auto-fill-mode 1))
|
2000-06-20 18:24:59 +00:00
|
|
|
|
|
|
|
|
|
(defun turn-off-auto-fill ()
|
|
|
|
|
"Unconditionally turn off Auto Fill mode."
|
|
|
|
|
(auto-fill-mode -1))
|
|
|
|
|
|
1999-02-18 07:24:11 +00:00
|
|
|
|
(custom-add-option 'text-mode-hook 'turn-on-auto-fill)
|
1994-04-16 02:06:17 +00:00
|
|
|
|
|
|
|
|
|
(defun set-fill-column (arg)
|
1996-06-14 02:11:11 +00:00
|
|
|
|
"Set `fill-column' to specified argument.
|
1998-10-13 15:47:40 +00:00
|
|
|
|
Use \\[universal-argument] followed by a number to specify a column.
|
1996-06-14 02:11:11 +00:00
|
|
|
|
Just \\[universal-argument] as argument means to use the current column."
|
2008-04-04 16:16:23 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list (or current-prefix-arg
|
|
|
|
|
;; We used to use current-column silently, but C-x f is too easily
|
|
|
|
|
;; typed as a typo for C-x C-f, so we turned it into an error and
|
|
|
|
|
;; now an interactive prompt.
|
|
|
|
|
(read-number "Set fill-column to: " (current-column)))))
|
1997-05-19 02:52:50 +00:00
|
|
|
|
(if (consp arg)
|
|
|
|
|
(setq arg (current-column)))
|
|
|
|
|
(if (not (integerp arg))
|
|
|
|
|
;; Disallow missing argument; it's probably a typo for C-x C-f.
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
(error "set-fill-column requires an explicit argument")
|
1997-05-19 02:52:50 +00:00
|
|
|
|
(message "Fill column set to %d (was %d)" arg fill-column)
|
|
|
|
|
(setq fill-column arg)))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun set-selective-display (arg)
|
1992-08-21 07:18:16 +00:00
|
|
|
|
"Set `selective-display' to ARG; clear it if no arg.
|
|
|
|
|
When the value of `selective-display' is a number > 0,
|
|
|
|
|
lines whose indentation is >= that value are not displayed.
|
|
|
|
|
The variable `selective-display' has a separate value for each buffer."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if (eq selective-display t)
|
|
|
|
|
(error "selective-display already in use for marked lines"))
|
1992-05-30 21:11:25 +00:00
|
|
|
|
(let ((current-vpos
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region (point-min) (point))
|
|
|
|
|
(goto-char (window-start))
|
|
|
|
|
(vertical-motion (window-height)))))
|
|
|
|
|
(setq selective-display
|
|
|
|
|
(and arg (prefix-numeric-value arg)))
|
|
|
|
|
(recenter current-vpos))
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 18:26:57 +04:00
|
|
|
|
(set-window-start (selected-window) (window-start))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(princ "selective-display set to " t)
|
|
|
|
|
(prin1 selective-display t)
|
|
|
|
|
(princ "." t))
|
|
|
|
|
|
2002-11-18 04:55:28 +00:00
|
|
|
|
(defvaralias 'indicate-unused-lines 'indicate-empty-lines)
|
|
|
|
|
|
2006-05-26 12:40:59 +00:00
|
|
|
|
(defun toggle-truncate-lines (&optional arg)
|
2011-07-13 18:39:49 +02:00
|
|
|
|
"Toggle truncating of long lines for the current buffer.
|
|
|
|
|
When truncating is off, long lines are folded.
|
2007-08-08 07:40:09 +00:00
|
|
|
|
With prefix argument ARG, truncate long lines if ARG is positive,
|
2011-07-13 18:39:49 +02:00
|
|
|
|
otherwise fold them. Note that in side-by-side windows, this
|
|
|
|
|
command has no effect if `truncate-partial-width-windows' is
|
|
|
|
|
non-nil."
|
2002-07-04 13:36:12 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(setq truncate-lines
|
|
|
|
|
(if (null arg)
|
|
|
|
|
(not truncate-lines)
|
2002-08-13 01:48:42 +00:00
|
|
|
|
(> (prefix-numeric-value arg) 0)))
|
|
|
|
|
(force-mode-line-update)
|
2002-10-26 22:40:31 +00:00
|
|
|
|
(unless truncate-lines
|
|
|
|
|
(let ((buffer (current-buffer)))
|
|
|
|
|
(walk-windows (lambda (window)
|
|
|
|
|
(if (eq buffer (window-buffer window))
|
|
|
|
|
(set-window-hscroll window 0)))
|
|
|
|
|
nil t)))
|
2002-08-13 01:48:42 +00:00
|
|
|
|
(message "Truncate long lines %s"
|
|
|
|
|
(if truncate-lines "enabled" "disabled")))
|
2002-07-04 13:36:12 +00:00
|
|
|
|
|
2009-02-08 00:47:15 +00:00
|
|
|
|
(defun toggle-word-wrap (&optional arg)
|
|
|
|
|
"Toggle whether to use word-wrapping for continuation lines.
|
|
|
|
|
With prefix argument ARG, wrap continuation lines at word boundaries
|
|
|
|
|
if ARG is positive, otherwise wrap them at the right screen edge.
|
|
|
|
|
This command toggles the value of `word-wrap'. It has no effect
|
|
|
|
|
if long lines are truncated."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(setq word-wrap
|
|
|
|
|
(if (null arg)
|
|
|
|
|
(not word-wrap)
|
|
|
|
|
(> (prefix-numeric-value arg) 0)))
|
|
|
|
|
(force-mode-line-update)
|
|
|
|
|
(message "Word wrapping %s"
|
|
|
|
|
(if word-wrap "enabled" "disabled")))
|
|
|
|
|
|
2009-10-30 02:00:11 +00:00
|
|
|
|
(defvar overwrite-mode-textual (purecopy " Ovwrt")
|
1993-03-16 18:18:47 +00:00
|
|
|
|
"The string displayed in the mode line when in overwrite mode.")
|
2009-10-30 02:00:11 +00:00
|
|
|
|
(defvar overwrite-mode-binary (purecopy " Bin Ovwrt")
|
1993-03-16 18:18:47 +00:00
|
|
|
|
"The string displayed in the mode line when in binary overwrite mode.")
|
|
|
|
|
|
2010-05-04 23:45:21 -04:00
|
|
|
|
(define-minor-mode overwrite-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
"Toggle Overwrite mode.
|
|
|
|
|
|
|
|
|
|
When Overwrite mode is enabled, printing characters typed in
|
|
|
|
|
replace existing text on a one-for-one basis, rather than pushing
|
|
|
|
|
it to the right. At the end of a line, such characters extend
|
|
|
|
|
the line. Before a tab, such characters insert until the tab is
|
|
|
|
|
filled in. \\[quoted-insert] still inserts characters in
|
|
|
|
|
overwrite mode; this is supposed to make it easier to insert
|
|
|
|
|
characters when necessary."
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
:variable (overwrite-mode
|
|
|
|
|
. (lambda (v) (setq overwrite-mode (if v 'overwrite-mode-textual)))))
|
1993-03-16 18:18:47 +00:00
|
|
|
|
|
2010-05-04 23:45:21 -04:00
|
|
|
|
(define-minor-mode binary-overwrite-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
"Toggle Binary Overwrite mode.
|
|
|
|
|
|
|
|
|
|
When Binary Overwrite mode is enabled, printing characters typed
|
|
|
|
|
in replace existing text. Newlines are not treated specially, so
|
|
|
|
|
typing at the end of a line joins the line to the next, with the
|
|
|
|
|
typed character between them. Typing before a tab character
|
|
|
|
|
simply replaces the tab with the character typed.
|
|
|
|
|
\\[quoted-insert] replaces the text at the cursor, just as
|
|
|
|
|
ordinary typing characters do.
|
|
|
|
|
|
|
|
|
|
Note that Binary Overwrite mode is not its own minor mode; it is
|
|
|
|
|
a specialization of overwrite mode, entered by setting the
|
1993-03-16 18:18:47 +00:00
|
|
|
|
`overwrite-mode' variable to `overwrite-mode-binary'."
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
:variable (overwrite-mode
|
|
|
|
|
. (lambda (v) (setq overwrite-mode (if v 'overwrite-mode-binary)))))
|
2000-11-22 20:59:39 +00:00
|
|
|
|
|
2002-09-11 20:46:33 +00:00
|
|
|
|
(define-minor-mode line-number-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
"Toggle line number display in the mode line (Line Number mode).
|
1998-11-07 02:08:40 +00:00
|
|
|
|
|
2001-08-22 18:30:36 +00:00
|
|
|
|
Line numbers do not appear for very large buffers and buffers
|
|
|
|
|
with very long lines; see variables `line-number-display-limit'
|
|
|
|
|
and `line-number-display-limit-width'."
|
2006-09-14 23:55:31 +00:00
|
|
|
|
:init-value t :global t :group 'mode-line)
|
1995-07-17 23:03:53 +00:00
|
|
|
|
|
2002-09-11 20:46:33 +00:00
|
|
|
|
(define-minor-mode column-number-mode
|
2018-07-01 23:34:53 -04:00
|
|
|
|
"Toggle column number display in the mode line (Column Number mode)."
|
2006-09-14 23:55:31 +00:00
|
|
|
|
:global t :group 'mode-line)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
|
|
|
|
(define-minor-mode size-indication-mode
|
2018-07-01 23:34:53 -04:00
|
|
|
|
"Toggle buffer size display in the mode line (Size Indication mode)."
|
2006-09-14 23:55:31 +00:00
|
|
|
|
:global t :group 'mode-line)
|
2010-05-07 08:49:14 -04:00
|
|
|
|
|
|
|
|
|
(define-minor-mode auto-save-mode
|
2018-07-01 23:34:53 -04:00
|
|
|
|
"Toggle auto-saving in the current buffer (Auto Save mode)."
|
2010-05-07 08:49:14 -04:00
|
|
|
|
:variable ((and buffer-auto-save-file-name
|
|
|
|
|
;; If auto-save is off because buffer has shrunk,
|
|
|
|
|
;; then toggling should turn it on.
|
|
|
|
|
(>= buffer-saved-size 0))
|
|
|
|
|
. (lambda (val)
|
|
|
|
|
(setq buffer-auto-save-file-name
|
|
|
|
|
(cond
|
|
|
|
|
((null val) nil)
|
|
|
|
|
((and buffer-file-name auto-save-visited-file-name
|
|
|
|
|
(not buffer-read-only))
|
|
|
|
|
buffer-file-name)
|
|
|
|
|
(t (make-auto-save-file-name))))))
|
|
|
|
|
;; If -1 was stored here, to temporarily turn off saving,
|
|
|
|
|
;; turn it back on.
|
|
|
|
|
(and (< buffer-saved-size 0)
|
|
|
|
|
(setq buffer-saved-size 0)))
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1997-06-19 09:04:09 +00:00
|
|
|
|
(defgroup paren-blinking nil
|
1997-06-22 09:16:07 +00:00
|
|
|
|
"Blinking matching of parens and expressions."
|
1997-06-19 09:04:09 +00:00
|
|
|
|
:prefix "blink-matching-"
|
|
|
|
|
:group 'paren-matching)
|
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom blink-matching-paren t
|
2014-03-14 20:01:39 +02:00
|
|
|
|
"Non-nil means show matching open-paren when close-paren is inserted.
|
2015-08-18 23:31:52 +03:00
|
|
|
|
If t, highlight the paren. If `jump', briefly move cursor to its
|
|
|
|
|
position. If `jump-offscreen', move cursor there even if the
|
|
|
|
|
position is off screen. With any other non-nil value, the
|
|
|
|
|
off-screen position of the opening paren will be shown in the
|
|
|
|
|
echo area."
|
2014-03-14 20:01:39 +02:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Disable" nil)
|
|
|
|
|
(const :tag "Highlight" t)
|
2015-08-18 23:31:52 +03:00
|
|
|
|
(const :tag "Move cursor" jump)
|
|
|
|
|
(const :tag "Move cursor, even if off screen" jump-offscreen))
|
1997-06-19 09:04:09 +00:00
|
|
|
|
:group 'paren-blinking)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom blink-matching-paren-on-screen t
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Non-nil means show matching open-paren when it is on screen.
|
2007-02-06 09:35:04 +00:00
|
|
|
|
If nil, don't show it (but the open-paren can still be shown
|
2015-08-18 23:31:52 +03:00
|
|
|
|
in the echo area when it is off screen).
|
2005-11-27 15:53:16 +00:00
|
|
|
|
|
2005-11-27 16:59:57 +00:00
|
|
|
|
This variable has no effect if `blink-matching-paren' is nil.
|
2005-11-27 17:02:13 +00:00
|
|
|
|
\(In that case, the open-paren is never shown.)
|
2005-11-27 16:59:57 +00:00
|
|
|
|
It is also ignored if `show-paren-mode' is enabled."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'boolean
|
1997-06-19 09:04:09 +00:00
|
|
|
|
:group 'paren-blinking)
|
1995-12-21 18:08:12 +00:00
|
|
|
|
|
2009-07-22 02:35:45 +00:00
|
|
|
|
(defcustom blink-matching-paren-distance (* 100 1024)
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"If non-nil, maximum distance to search backwards for matching open-paren.
|
2005-08-27 12:30:36 +00:00
|
|
|
|
If nil, search stops at the beginning of the accessible portion of the buffer."
|
2009-07-22 02:35:45 +00:00
|
|
|
|
:version "23.2" ; 25->100k
|
2005-08-27 12:30:36 +00:00
|
|
|
|
:type '(choice (const nil) integer)
|
1997-06-19 09:04:09 +00:00
|
|
|
|
:group 'paren-blinking)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom blink-matching-delay 1
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Time in seconds to delay after showing a matching paren."
|
1997-06-19 09:04:09 +00:00
|
|
|
|
:type 'number
|
|
|
|
|
:group 'paren-blinking)
|
1994-11-01 04:22:00 +00:00
|
|
|
|
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(defcustom blink-matching-paren-dont-ignore-comments nil
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"If nil, `blink-matching-paren' ignores comments.
|
2006-02-12 20:31:12 +00:00
|
|
|
|
More precisely, when looking for the matching parenthesis,
|
|
|
|
|
it skips the contents of comments that end before point."
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:type 'boolean
|
1997-06-19 09:04:09 +00:00
|
|
|
|
:group 'paren-blinking)
|
1995-08-19 16:59:43 +00:00
|
|
|
|
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(defun blink-matching-check-mismatch (start end)
|
|
|
|
|
"Return whether or not START...END are matching parens.
|
|
|
|
|
END is the current point and START is the blink position.
|
|
|
|
|
START might be nil if no matching starter was found.
|
|
|
|
|
Returns non-nil if we find there is a mismatch."
|
|
|
|
|
(let* ((end-syntax (syntax-after (1- end)))
|
|
|
|
|
(matching-paren (and (consp end-syntax)
|
|
|
|
|
(eq (syntax-class end-syntax) 5)
|
|
|
|
|
(cdr end-syntax))))
|
|
|
|
|
;; For self-matched chars like " and $, we can't know when they're
|
|
|
|
|
;; mismatched or unmatched, so we can only do it for parens.
|
|
|
|
|
(when matching-paren
|
|
|
|
|
(not (and start
|
|
|
|
|
(or
|
|
|
|
|
(eq (char-after start) matching-paren)
|
|
|
|
|
;; The cdr might hold a new paren-class info rather than
|
|
|
|
|
;; a matching-char info, in which case the two CDRs
|
|
|
|
|
;; should match.
|
|
|
|
|
(eq matching-paren (cdr-safe (syntax-after start)))))))))
|
|
|
|
|
|
|
|
|
|
(defvar blink-matching-check-function #'blink-matching-check-mismatch
|
|
|
|
|
"Function to check parentheses mismatches.
|
|
|
|
|
The function takes two arguments (START and END) where START is the
|
|
|
|
|
position just before the opening token and END is the position right after.
|
|
|
|
|
START can be nil, if it was not found.
|
|
|
|
|
The function should return non-nil if the two tokens do not match.")
|
|
|
|
|
|
2013-12-13 06:14:17 +02:00
|
|
|
|
(defvar blink-matching--overlay
|
|
|
|
|
(let ((ol (make-overlay (point) (point) nil t)))
|
|
|
|
|
(overlay-put ol 'face 'show-paren-match)
|
|
|
|
|
(delete-overlay ol)
|
|
|
|
|
ol)
|
|
|
|
|
"Overlay used to highlight the matching paren.")
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun blink-matching-open ()
|
2013-12-13 06:14:17 +02:00
|
|
|
|
"Momentarily highlight the beginning of the sexp before point."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive)
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(when (and (not (bobp))
|
|
|
|
|
blink-matching-paren)
|
2005-09-09 01:11:34 +00:00
|
|
|
|
(let* ((oldpos (point))
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(message-log-max nil) ; Don't log messages about paren matching.
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(blinkpos
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
2011-07-13 12:15:07 -04:00
|
|
|
|
(if blink-matching-paren-distance
|
|
|
|
|
(narrow-to-region
|
|
|
|
|
(max (minibuffer-prompt-end) ;(point-min) unless minibuf.
|
|
|
|
|
(- (point) blink-matching-paren-distance))
|
|
|
|
|
oldpos))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(let ((parse-sexp-ignore-comments
|
|
|
|
|
(and parse-sexp-ignore-comments
|
|
|
|
|
(not blink-matching-paren-dont-ignore-comments))))
|
|
|
|
|
(condition-case ()
|
2010-08-19 11:37:40 +02:00
|
|
|
|
(progn
|
* lisp/progmodes/ps-mode.el: Use SMIE. Move string and comment recognition
to syntax-propertize.
(ps-mode-auto-indent): Mark as obsolete.
(ps-mode-font-lock-keywords-1): Remove string-or-comment handling.
(ps-mode-font-lock-keywords-3): Use symbol regexp operators instead of
word regexp operators.
(ps-mode-map): Move initialization into declaration. Remove binding
for TAB, RET, >, ], and }.
(ps-mode-syntax-table): Move initialization into declaration.
Don't give word syntax to non-word chars.
(ps-run-mode-map): Move initialization into declaration.
(ps-mode-menu-main): Remove auto-indent entry.
(ps-mode-smie-rules): New function.
(ps-mode): Setup smie, syntax-propertize, and electric-indent-mode.
(ps-mode-looking-at-nested, ps-mode-match-string-or-comment): Remove.
(ps-mode--string-syntax-table): New const.
(ps-mode--syntax-propertize-special, ps-mode-syntax-propertize):
New functions.
(ps-mode-newline, ps-mode-tabkey, ps-mode-r-brace, ps-mode-r-angle)
(ps-mode-r-gt, ps-mode-r-balance): Remove functions.
2014-04-28 00:40:41 -04:00
|
|
|
|
(syntax-propertize (point))
|
2010-08-19 11:37:40 +02:00
|
|
|
|
(forward-sexp -1)
|
2010-09-02 23:57:08 +02:00
|
|
|
|
;; backward-sexp skips backward over prefix chars,
|
|
|
|
|
;; so move back to the matching paren.
|
|
|
|
|
(while (and (< (point) (1- oldpos))
|
2010-09-20 23:45:09 +02:00
|
|
|
|
(let ((code (syntax-after (point))))
|
|
|
|
|
(or (eq (syntax-class code) 6)
|
|
|
|
|
(eq (logand 1048576 (car code))
|
|
|
|
|
1048576))))
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(forward-char 1))
|
2010-08-19 11:37:40 +02:00
|
|
|
|
(point))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(error nil))))))
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(mismatch (funcall blink-matching-check-function blinkpos oldpos)))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(cond
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(mismatch
|
|
|
|
|
(if blinkpos
|
2009-01-14 23:10:10 +00:00
|
|
|
|
(if (minibufferp)
|
2011-07-13 12:15:07 -04:00
|
|
|
|
(minibuffer-message "Mismatched parentheses")
|
|
|
|
|
(message "Mismatched parentheses"))
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(if (minibufferp)
|
2011-07-13 12:15:07 -04:00
|
|
|
|
(minibuffer-message "No matching parenthesis found")
|
|
|
|
|
(message "No matching parenthesis found"))))
|
2010-09-08 18:14:44 +02:00
|
|
|
|
((not blinkpos) nil)
|
2015-08-18 23:31:52 +03:00
|
|
|
|
((or
|
|
|
|
|
(eq blink-matching-paren 'jump-offscreen)
|
|
|
|
|
(pos-visible-in-window-p blinkpos))
|
2014-03-14 20:01:39 +02:00
|
|
|
|
;; Matching open within window, temporarily move to or highlight
|
|
|
|
|
;; char after blinkpos but only if `blink-matching-paren-on-screen'
|
2013-12-13 06:14:17 +02:00
|
|
|
|
;; is non-nil.
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(and blink-matching-paren-on-screen
|
|
|
|
|
(not show-paren-mode)
|
2015-08-18 23:31:52 +03:00
|
|
|
|
(if (memq blink-matching-paren '(jump jump-offscreen))
|
2014-03-14 20:01:39 +02:00
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char blinkpos)
|
2013-12-13 06:14:17 +02:00
|
|
|
|
(sit-for blink-matching-delay))
|
2014-03-14 20:01:39 +02:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(move-overlay blink-matching--overlay blinkpos (1+ blinkpos)
|
|
|
|
|
(current-buffer))
|
|
|
|
|
(sit-for blink-matching-delay))
|
|
|
|
|
(delete-overlay blink-matching--overlay)))))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
(t
|
2015-08-18 18:56:00 +03:00
|
|
|
|
(let ((open-paren-line-string
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char blinkpos)
|
2007-09-16 22:11:33 +00:00
|
|
|
|
;; Show what precedes the open in its line, if anything.
|
|
|
|
|
(cond
|
|
|
|
|
((save-excursion (skip-chars-backward " \t") (not (bolp)))
|
|
|
|
|
(buffer-substring (line-beginning-position)
|
|
|
|
|
(1+ blinkpos)))
|
|
|
|
|
;; Show what follows the open in its line, if anything.
|
|
|
|
|
((save-excursion
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(not (eolp)))
|
|
|
|
|
(buffer-substring blinkpos
|
|
|
|
|
(line-end-position)))
|
|
|
|
|
;; Otherwise show the previous nonblank line,
|
|
|
|
|
;; if there is one.
|
|
|
|
|
((save-excursion (skip-chars-backward "\n \t") (not (bobp)))
|
|
|
|
|
(concat
|
|
|
|
|
(buffer-substring (progn
|
|
|
|
|
(skip-chars-backward "\n \t")
|
|
|
|
|
(line-beginning-position))
|
|
|
|
|
(progn (end-of-line)
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(point)))
|
|
|
|
|
;; Replace the newline and other whitespace with `...'.
|
|
|
|
|
"..."
|
|
|
|
|
(buffer-substring blinkpos (1+ blinkpos))))
|
|
|
|
|
;; There is nothing to show except the char itself.
|
2015-08-18 18:56:00 +03:00
|
|
|
|
(t (buffer-substring blinkpos (1+ blinkpos)))))))
|
|
|
|
|
(minibuffer-message
|
|
|
|
|
"Matches %s"
|
|
|
|
|
(substring-no-properties open-paren-line-string))))))))
|
2007-09-16 22:11:33 +00:00
|
|
|
|
|
2010-09-01 16:41:17 +02:00
|
|
|
|
(defvar blink-paren-function 'blink-matching-open
|
|
|
|
|
"Function called, if non-nil, whenever a close parenthesis is inserted.
|
|
|
|
|
More precisely, a char with closeparen syntax is self-inserted.")
|
|
|
|
|
|
|
|
|
|
(defun blink-paren-post-self-insert-function ()
|
|
|
|
|
(when (and (eq (char-before) last-command-event) ; Sanity check.
|
|
|
|
|
(memq (char-syntax last-command-event) '(?\) ?\$))
|
|
|
|
|
blink-paren-function
|
|
|
|
|
(not executing-kbd-macro)
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(not noninteractive)
|
|
|
|
|
;; Verify an even number of quoting characters precede the close.
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 15:51:15 -04:00
|
|
|
|
;; FIXME: Also check if this parenthesis closes a comment as
|
|
|
|
|
;; can happen in Pascal and SML.
|
2010-09-02 23:57:08 +02:00
|
|
|
|
(= 1 (logand 1 (- (point)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-char -1)
|
|
|
|
|
(skip-syntax-backward "/\\")
|
|
|
|
|
(point))))))
|
2010-09-01 16:41:17 +02:00
|
|
|
|
(funcall blink-paren-function)))
|
|
|
|
|
|
2013-12-26 22:02:49 +00:00
|
|
|
|
(put 'blink-paren-post-self-insert-function 'priority 100)
|
|
|
|
|
|
2010-09-01 16:41:17 +02:00
|
|
|
|
(add-hook 'post-self-insert-hook #'blink-paren-post-self-insert-function
|
|
|
|
|
;; Most likely, this hook is nil, so this arg doesn't matter,
|
|
|
|
|
;; but I use it as a reminder that this function usually
|
2013-12-26 22:02:49 +00:00
|
|
|
|
;; likes to be run after others since it does
|
|
|
|
|
;; `sit-for'. That's also the reason it get a `priority' prop
|
|
|
|
|
;; of 100.
|
2010-09-01 16:41:17 +02:00
|
|
|
|
'append)
|
2002-03-29 23:16:11 +00:00
|
|
|
|
|
1993-05-15 20:55:02 +00:00
|
|
|
|
;; This executes C-g typed while Emacs is waiting for a command.
|
|
|
|
|
;; Quitting out of a program does not go through here;
|
2017-01-25 21:13:19 -08:00
|
|
|
|
;; that happens in the maybe_quit function at the C code level.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(defun keyboard-quit ()
|
1998-06-01 03:04:39 +00:00
|
|
|
|
"Signal a `quit' condition.
|
1993-03-09 05:40:33 +00:00
|
|
|
|
During execution of Lisp code, this character causes a quit directly.
|
|
|
|
|
At top-level, as an editor command, this simply beeps."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive)
|
2010-08-07 15:39:04 -04:00
|
|
|
|
;; Avoid adding the region to the window selection.
|
|
|
|
|
(setq saved-region-selection nil)
|
|
|
|
|
(let (select-active-regions)
|
|
|
|
|
(deactivate-mark))
|
2004-11-01 23:03:12 +00:00
|
|
|
|
(if (fboundp 'kmacro-keyboard-quit)
|
|
|
|
|
(kmacro-keyboard-quit))
|
2014-03-30 12:12:57 -07:00
|
|
|
|
(when completion-in-region-mode
|
|
|
|
|
(completion-in-region-mode -1))
|
2014-06-01 18:19:14 +03:00
|
|
|
|
;; Force the next redisplay cycle to remove the "Def" indicator from
|
|
|
|
|
;; all the mode lines.
|
|
|
|
|
(if defining-kbd-macro
|
|
|
|
|
(force-mode-line-update t))
|
2002-09-09 22:45:03 +00:00
|
|
|
|
(setq defining-kbd-macro nil)
|
2011-06-01 12:52:35 -03:00
|
|
|
|
(let ((debug-on-quit nil))
|
|
|
|
|
(signal 'quit nil)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1994-12-15 02:02:04 +00:00
|
|
|
|
(defvar buffer-quit-function nil
|
|
|
|
|
"Function to call to \"quit\" the current buffer, or nil if none.
|
|
|
|
|
\\[keyboard-escape-quit] calls this function when its more local actions
|
2011-12-04 00:02:42 -08:00
|
|
|
|
\(such as canceling a prefix argument, minibuffer or region) do not apply.")
|
1994-12-15 02:02:04 +00:00
|
|
|
|
|
1994-11-28 19:44:16 +00:00
|
|
|
|
(defun keyboard-escape-quit ()
|
|
|
|
|
"Exit the current \"mode\" (in a generalized sense of the word).
|
|
|
|
|
This command can exit an interactive command such as `query-replace',
|
|
|
|
|
can clear out a prefix argument or a region,
|
|
|
|
|
can get out of the minibuffer or other recursive edit,
|
1994-12-15 02:02:04 +00:00
|
|
|
|
cancel the use of the current buffer (for special-purpose buffers),
|
|
|
|
|
or go back to just one window (by deleting all but the selected window)."
|
1994-11-28 19:44:16 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(cond ((eq last-command 'mode-exited) nil)
|
2010-03-31 18:02:53 +03:00
|
|
|
|
((region-active-p)
|
|
|
|
|
(deactivate-mark))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
((> (minibuffer-depth) 0)
|
|
|
|
|
(abort-recursive-edit))
|
|
|
|
|
(current-prefix-arg
|
|
|
|
|
nil)
|
1997-04-10 06:29:59 +00:00
|
|
|
|
((> (recursion-depth) 0)
|
|
|
|
|
(exit-recursive-edit))
|
1994-12-15 02:02:04 +00:00
|
|
|
|
(buffer-quit-function
|
|
|
|
|
(funcall buffer-quit-function))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
((not (one-window-p t))
|
1997-04-10 06:29:59 +00:00
|
|
|
|
(delete-other-windows))
|
|
|
|
|
((string-match "^ \\*" (buffer-name (current-buffer)))
|
|
|
|
|
(bury-buffer))))
|
1994-11-28 19:44:16 +00:00
|
|
|
|
|
2002-03-29 23:16:11 +00:00
|
|
|
|
(defun play-sound-file (file &optional volume device)
|
|
|
|
|
"Play sound stored in FILE.
|
|
|
|
|
VOLUME and DEVICE correspond to the keywords of the sound
|
|
|
|
|
specification for `play-sound'."
|
|
|
|
|
(interactive "fPlay sound file: ")
|
|
|
|
|
(let ((sound (list :file file)))
|
|
|
|
|
(if volume
|
|
|
|
|
(plist-put sound :volume volume))
|
|
|
|
|
(if device
|
|
|
|
|
(plist-put sound :device device))
|
|
|
|
|
(push 'sound sound)
|
|
|
|
|
(play-sound sound)))
|
|
|
|
|
|
2005-01-15 18:08:46 +00:00
|
|
|
|
|
2000-01-07 12:53:36 +00:00
|
|
|
|
(defcustom read-mail-command 'rmail
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Your preference for a mail reading package.
|
2000-09-12 17:59:26 +00:00
|
|
|
|
This is used by some keybindings which support reading mail.
|
|
|
|
|
See also `mail-user-agent' concerning sending mail."
|
2009-11-14 04:18:10 +00:00
|
|
|
|
:type '(radio (function-item :tag "Rmail" :format "%t\n" rmail)
|
|
|
|
|
(function-item :tag "Gnus" :format "%t\n" gnus)
|
|
|
|
|
(function-item :tag "Emacs interface to MH"
|
|
|
|
|
:format "%t\n" mh-rmail)
|
|
|
|
|
(function :tag "Other"))
|
2000-01-07 12:53:36 +00:00
|
|
|
|
:version "21.1"
|
|
|
|
|
:group 'mail)
|
|
|
|
|
|
2009-07-14 19:57:58 +00:00
|
|
|
|
(defcustom mail-user-agent 'message-user-agent
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
"Your preference for a mail composition package.
|
2000-09-12 17:59:26 +00:00
|
|
|
|
Various Emacs Lisp packages (e.g. Reporter) require you to compose an
|
1996-08-30 16:59:20 +00:00
|
|
|
|
outgoing email message. This variable lets you specify which
|
|
|
|
|
mail-sending package you prefer.
|
|
|
|
|
|
|
|
|
|
Valid values include:
|
|
|
|
|
|
2009-07-19 00:33:11 +00:00
|
|
|
|
`message-user-agent' -- use the Message package.
|
|
|
|
|
See Info node `(message)'.
|
|
|
|
|
`sendmail-user-agent' -- use the Mail package.
|
2000-09-12 17:59:26 +00:00
|
|
|
|
See Info node `(emacs)Sending Mail'.
|
|
|
|
|
`mh-e-user-agent' -- use the Emacs interface to the MH mail system.
|
|
|
|
|
See Info node `(mh-e)'.
|
|
|
|
|
`gnus-user-agent' -- like `message-user-agent', but with Gnus
|
2012-02-13 20:42:58 +01:00
|
|
|
|
paraphernalia if Gnus is running, particularly
|
|
|
|
|
the Gcc: header for archiving.
|
1996-08-30 16:59:20 +00:00
|
|
|
|
|
|
|
|
|
Additional valid symbols may be available; check with the author of
|
2000-12-18 17:09:42 +00:00
|
|
|
|
your package for details. The function should return non-nil if it
|
|
|
|
|
succeeds.
|
2000-09-12 17:59:26 +00:00
|
|
|
|
|
|
|
|
|
See also `read-mail-command' concerning reading mail."
|
2009-07-19 00:33:11 +00:00
|
|
|
|
:type '(radio (function-item :tag "Message package"
|
|
|
|
|
:format "%t\n"
|
|
|
|
|
message-user-agent)
|
|
|
|
|
(function-item :tag "Mail package"
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:format "%t\n"
|
|
|
|
|
sendmail-user-agent)
|
|
|
|
|
(function-item :tag "Emacs interface to MH"
|
|
|
|
|
:format "%t\n"
|
|
|
|
|
mh-e-user-agent)
|
2009-07-19 00:33:11 +00:00
|
|
|
|
(function-item :tag "Message with full Gnus features"
|
2000-09-12 17:59:26 +00:00
|
|
|
|
:format "%t\n"
|
|
|
|
|
gnus-user-agent)
|
1997-05-05 11:57:31 +00:00
|
|
|
|
(function :tag "Other"))
|
2009-07-19 00:33:11 +00:00
|
|
|
|
:version "23.2" ; sendmail->message
|
1997-05-05 11:57:31 +00:00
|
|
|
|
:group 'mail)
|
1996-08-30 16:59:20 +00:00
|
|
|
|
|
2009-12-07 16:09:05 +00:00
|
|
|
|
(defcustom compose-mail-user-agent-warnings t
|
|
|
|
|
"If non-nil, `compose-mail' warns about changes in `mail-user-agent'.
|
|
|
|
|
If the value of `mail-user-agent' is the default, and the user
|
|
|
|
|
appears to have customizations applying to the old default,
|
|
|
|
|
`compose-mail' issues a warning."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "23.2"
|
|
|
|
|
:group 'mail)
|
|
|
|
|
|
1998-05-02 06:50:44 +00:00
|
|
|
|
(defun rfc822-goto-eoh ()
|
2011-02-16 23:43:53 -08:00
|
|
|
|
"If the buffer starts with a mail header, move point to the header's end.
|
|
|
|
|
Otherwise, moves to `point-min'.
|
|
|
|
|
The end of the header is the start of the next line, if there is one,
|
|
|
|
|
else the end of the last line. This function obeys RFC822."
|
1998-05-02 06:50:44 +00:00
|
|
|
|
(goto-char (point-min))
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(when (re-search-forward
|
|
|
|
|
"^\\([:\n]\\|[^: \t\n]+[ \t\n]\\)" nil 'move)
|
|
|
|
|
(goto-char (match-beginning 0))))
|
1998-05-02 06:50:44 +00:00
|
|
|
|
|
2011-09-03 13:00:13 +03:00
|
|
|
|
;; Used by Rmail (e.g., rmail-forward).
|
|
|
|
|
(defvar mail-encode-mml nil
|
|
|
|
|
"If non-nil, mail-user-agent's `sendfunc' command should mml-encode
|
|
|
|
|
the outgoing message before sending it.")
|
|
|
|
|
|
1996-12-07 21:30:17 +00:00
|
|
|
|
(defun compose-mail (&optional to subject other-headers continue
|
2011-01-12 23:23:41 -05:00
|
|
|
|
switch-function yank-action send-actions
|
|
|
|
|
return-action)
|
1996-12-07 21:30:17 +00:00
|
|
|
|
"Start composing a mail message to send.
|
|
|
|
|
This uses the user's chosen mail composition package
|
|
|
|
|
as selected with the variable `mail-user-agent'.
|
|
|
|
|
The optional arguments TO and SUBJECT specify recipients
|
|
|
|
|
and the initial Subject field, respectively.
|
|
|
|
|
|
|
|
|
|
OTHER-HEADERS is an alist specifying additional
|
|
|
|
|
header fields. Elements look like (HEADER . VALUE) where both
|
|
|
|
|
HEADER and VALUE are strings.
|
|
|
|
|
|
|
|
|
|
CONTINUE, if non-nil, says to continue editing a message already
|
2009-03-10 05:01:43 +00:00
|
|
|
|
being composed. Interactively, CONTINUE is the prefix argument.
|
1996-12-07 21:30:17 +00:00
|
|
|
|
|
|
|
|
|
SWITCH-FUNCTION, if non-nil, is a function to use to
|
|
|
|
|
switch to and display the buffer used for mail composition.
|
|
|
|
|
|
|
|
|
|
YANK-ACTION, if non-nil, is an action to perform, if and when necessary,
|
1996-12-18 16:32:43 +00:00
|
|
|
|
to insert the raw text of the message being replied to.
|
|
|
|
|
It has the form (FUNCTION . ARGS). The user agent will apply
|
|
|
|
|
FUNCTION to ARGS, to insert the raw text of the original message.
|
|
|
|
|
\(The user agent will also run `mail-citation-hook', *after* the
|
|
|
|
|
original text has been inserted in this way.)
|
1996-12-07 21:30:17 +00:00
|
|
|
|
|
|
|
|
|
SEND-ACTIONS is a list of actions to call when the message is sent.
|
2011-01-12 23:23:41 -05:00
|
|
|
|
Each action has the form (FUNCTION . ARGS).
|
|
|
|
|
|
|
|
|
|
RETURN-ACTION, if non-nil, is an action for returning to the
|
|
|
|
|
caller. It has the form (FUNCTION . ARGS). The function is
|
|
|
|
|
called after the mail has been sent or put aside, and the mail
|
|
|
|
|
buffer buried."
|
1997-04-29 02:07:02 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list nil nil nil current-prefix-arg))
|
2009-12-07 16:09:05 +00:00
|
|
|
|
|
|
|
|
|
;; In Emacs 23.2, the default value of `mail-user-agent' changed
|
|
|
|
|
;; from sendmail-user-agent to message-user-agent. Some users may
|
|
|
|
|
;; encounter incompatibilities. This hack tries to detect problems
|
|
|
|
|
;; and warn about them.
|
|
|
|
|
(and compose-mail-user-agent-warnings
|
|
|
|
|
(eq mail-user-agent 'message-user-agent)
|
|
|
|
|
(let (warn-vars)
|
|
|
|
|
(dolist (var '(mail-mode-hook mail-send-hook mail-setup-hook
|
2017-11-22 16:05:45 -05:00
|
|
|
|
mail-citation-hook mail-archive-file-name
|
2009-12-07 16:09:05 +00:00
|
|
|
|
mail-default-reply-to mail-mailing-lists
|
2009-12-12 17:01:03 +00:00
|
|
|
|
mail-self-blind))
|
2009-12-07 16:09:05 +00:00
|
|
|
|
(and (boundp var)
|
|
|
|
|
(symbol-value var)
|
|
|
|
|
(push var warn-vars)))
|
|
|
|
|
(when warn-vars
|
|
|
|
|
(display-warning 'mail
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(format-message "\
|
2009-12-07 16:09:05 +00:00
|
|
|
|
The default mail mode is now Message mode.
|
|
|
|
|
You have the following Mail mode variable%s customized:
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
\n %s\n\nTo use Mail mode, set `mail-user-agent' to sendmail-user-agent.
|
|
|
|
|
To disable this warning, set `compose-mail-user-agent-warnings' to nil."
|
2009-12-07 16:09:05 +00:00
|
|
|
|
(if (> (length warn-vars) 1) "s" "")
|
|
|
|
|
(mapconcat 'symbol-name
|
|
|
|
|
warn-vars " "))))))
|
|
|
|
|
|
2007-03-28 18:36:01 +00:00
|
|
|
|
(let ((function (get mail-user-agent 'composefunc)))
|
2018-04-15 20:06:27 +02:00
|
|
|
|
(unless function
|
|
|
|
|
(error "Invalid value for `mail-user-agent'"))
|
2011-01-12 23:23:41 -05:00
|
|
|
|
(funcall function to subject other-headers continue switch-function
|
|
|
|
|
yank-action send-actions return-action)))
|
1997-04-29 02:07:02 +00:00
|
|
|
|
|
|
|
|
|
(defun compose-mail-other-window (&optional to subject other-headers continue
|
2011-01-12 23:23:41 -05:00
|
|
|
|
yank-action send-actions
|
|
|
|
|
return-action)
|
1997-04-29 02:07:02 +00:00
|
|
|
|
"Like \\[compose-mail], but edit the outgoing message in another window."
|
2011-01-12 23:23:41 -05:00
|
|
|
|
(interactive (list nil nil nil current-prefix-arg))
|
1997-04-29 02:07:02 +00:00
|
|
|
|
(compose-mail to subject other-headers continue
|
2011-01-12 23:23:41 -05:00
|
|
|
|
'switch-to-buffer-other-window yank-action send-actions
|
|
|
|
|
return-action))
|
1997-04-29 02:07:02 +00:00
|
|
|
|
|
|
|
|
|
(defun compose-mail-other-frame (&optional to subject other-headers continue
|
2011-01-12 23:23:41 -05:00
|
|
|
|
yank-action send-actions
|
|
|
|
|
return-action)
|
1997-04-29 02:07:02 +00:00
|
|
|
|
"Like \\[compose-mail], but edit the outgoing message in another frame."
|
2011-01-12 23:23:41 -05:00
|
|
|
|
(interactive (list nil nil nil current-prefix-arg))
|
1997-04-29 02:07:02 +00:00
|
|
|
|
(compose-mail to subject other-headers continue
|
2011-01-12 23:23:41 -05:00
|
|
|
|
'switch-to-buffer-other-frame yank-action send-actions
|
|
|
|
|
return-action))
|
|
|
|
|
|
2005-01-15 18:08:46 +00:00
|
|
|
|
|
1997-04-30 18:57:35 +00:00
|
|
|
|
(defvar set-variable-value-history nil
|
2007-12-22 17:15:48 +00:00
|
|
|
|
"History of values entered with `set-variable'.
|
|
|
|
|
|
|
|
|
|
Maximum length of the history list is determined by the value
|
|
|
|
|
of `history-length', which see.")
|
1997-04-30 18:57:35 +00:00
|
|
|
|
|
2005-06-23 21:26:31 +00:00
|
|
|
|
(defun set-variable (variable value &optional make-local)
|
1997-04-30 18:57:35 +00:00
|
|
|
|
"Set VARIABLE to VALUE. VALUE is a Lisp object.
|
2005-06-23 21:26:31 +00:00
|
|
|
|
VARIABLE should be a user option variable name, a Lisp variable
|
|
|
|
|
meant to be customized by users. You should enter VALUE in Lisp syntax,
|
|
|
|
|
so if you want VALUE to be a string, you must surround it with doublequotes.
|
1997-04-30 18:57:35 +00:00
|
|
|
|
VALUE is used literally, not evaluated.
|
|
|
|
|
|
|
|
|
|
If VARIABLE has a `variable-interactive' property, that is used as if
|
|
|
|
|
it were the arg to `interactive' (which see) to interactively read VALUE.
|
|
|
|
|
|
|
|
|
|
If VARIABLE has been defined with `defcustom', then the type information
|
2002-08-09 14:14:32 +00:00
|
|
|
|
in the definition is used to check that VALUE is valid.
|
|
|
|
|
|
2015-07-05 17:21:42 -07:00
|
|
|
|
Note that this function is at heart equivalent to the basic `set' function.
|
2015-07-06 16:35:45 -04:00
|
|
|
|
For a variable defined with `defcustom', it does not pay attention to
|
|
|
|
|
any :set property that the variable might have (if you want that, use
|
|
|
|
|
\\[customize-set-variable] instead).
|
2015-07-05 17:21:42 -07:00
|
|
|
|
|
2002-08-09 14:14:32 +00:00
|
|
|
|
With a prefix argument, set VARIABLE to VALUE buffer-locally."
|
1998-05-20 03:54:58 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(let* ((default-var (variable-at-point))
|
2012-04-09 20:36:01 +08:00
|
|
|
|
(var (if (custom-variable-p default-var)
|
2005-10-21 08:55:12 +00:00
|
|
|
|
(read-variable (format "Set variable (default %s): " default-var)
|
|
|
|
|
default-var)
|
|
|
|
|
(read-variable "Set variable: ")))
|
2018-10-25 10:55:53 +02:00
|
|
|
|
(minibuffer-help-form `(describe-variable ',var))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(prop (get var 'variable-interactive))
|
2005-06-29 23:50:29 +00:00
|
|
|
|
(obsolete (car (get var 'byte-obsolete-variable)))
|
|
|
|
|
(prompt (format "Set %s %s to value: " var
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(cond ((local-variable-p var)
|
2005-06-29 23:50:29 +00:00
|
|
|
|
"(buffer-local)")
|
2004-04-16 12:51:06 +00:00
|
|
|
|
((or current-prefix-arg
|
|
|
|
|
(local-variable-if-set-p var))
|
2005-06-29 23:50:29 +00:00
|
|
|
|
"buffer-locally")
|
|
|
|
|
(t "globally"))))
|
|
|
|
|
(val (progn
|
|
|
|
|
(when obsolete
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(message (concat "`%S' is obsolete; "
|
|
|
|
|
(if (symbolp obsolete) "use `%S' instead" "%s"))
|
2005-06-29 23:50:29 +00:00
|
|
|
|
var obsolete)
|
|
|
|
|
(sit-for 3))
|
|
|
|
|
(if prop
|
|
|
|
|
;; Use VAR's `variable-interactive' property
|
|
|
|
|
;; as an interactive spec for prompting.
|
|
|
|
|
(call-interactively `(lambda (arg)
|
|
|
|
|
(interactive ,prop)
|
|
|
|
|
arg))
|
2013-06-25 20:50:50 -04:00
|
|
|
|
(read-from-minibuffer prompt nil
|
|
|
|
|
read-expression-map t
|
|
|
|
|
'set-variable-value-history
|
|
|
|
|
(format "%S" (symbol-value var)))))))
|
2004-04-16 12:51:06 +00:00
|
|
|
|
(list var val current-prefix-arg)))
|
1997-04-30 18:57:35 +00:00
|
|
|
|
|
2005-06-23 21:26:31 +00:00
|
|
|
|
(and (custom-variable-p variable)
|
|
|
|
|
(not (get variable 'custom-type))
|
|
|
|
|
(custom-load-symbol variable))
|
|
|
|
|
(let ((type (get variable 'custom-type)))
|
1997-04-30 18:57:35 +00:00
|
|
|
|
(when type
|
|
|
|
|
;; Match with custom type.
|
2001-07-16 11:52:56 +00:00
|
|
|
|
(require 'cus-edit)
|
1997-04-30 18:57:35 +00:00
|
|
|
|
(setq type (widget-convert type))
|
2005-06-23 21:26:31 +00:00
|
|
|
|
(unless (widget-apply type :match value)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(user-error "Value `%S' does not match type %S of %S"
|
2015-07-06 15:30:51 -04:00
|
|
|
|
value (car type) variable))))
|
2002-08-09 14:14:32 +00:00
|
|
|
|
|
|
|
|
|
(if make-local
|
2005-06-23 21:26:31 +00:00
|
|
|
|
(make-local-variable variable))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
|
2005-06-23 21:26:31 +00:00
|
|
|
|
(set variable value)
|
2001-01-10 15:10:01 +00:00
|
|
|
|
|
|
|
|
|
;; Force a thorough redisplay for the case that the variable
|
|
|
|
|
;; has an effect on the display, like `tab-width' has.
|
|
|
|
|
(force-mode-line-update))
|
2005-01-15 18:08:46 +00:00
|
|
|
|
|
1993-07-13 21:34:05 +00:00
|
|
|
|
;; Define the major mode for lists of completions.
|
|
|
|
|
|
2008-04-13 22:12:02 +00:00
|
|
|
|
(defvar completion-list-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2014-04-22 22:22:06 -04:00
|
|
|
|
(define-key map [mouse-2] 'choose-completion)
|
2008-04-13 22:12:02 +00:00
|
|
|
|
(define-key map [follow-link] 'mouse-face)
|
|
|
|
|
(define-key map [down-mouse-2] nil)
|
|
|
|
|
(define-key map "\C-m" 'choose-completion)
|
|
|
|
|
(define-key map "\e\e\e" 'delete-completion-window)
|
|
|
|
|
(define-key map [left] 'previous-completion)
|
|
|
|
|
(define-key map [right] 'next-completion)
|
2014-06-13 11:50:38 -04:00
|
|
|
|
(define-key map [?\t] 'next-completion)
|
|
|
|
|
(define-key map [backtab] 'previous-completion)
|
2009-04-06 15:45:00 +00:00
|
|
|
|
(define-key map "q" 'quit-window)
|
2017-04-12 23:14:20 +03:00
|
|
|
|
(define-key map "z" 'kill-current-buffer)
|
2008-04-13 22:12:02 +00:00
|
|
|
|
map)
|
1995-04-08 22:42:47 +00:00
|
|
|
|
"Local map for completion list buffers.")
|
1993-07-13 21:34:05 +00:00
|
|
|
|
|
|
|
|
|
;; Completion mode is suitable only for specially formatted data.
|
1993-07-22 05:47:10 +00:00
|
|
|
|
(put 'completion-list-mode 'mode-class 'special)
|
1993-07-13 21:34:05 +00:00
|
|
|
|
|
1995-04-08 22:42:47 +00:00
|
|
|
|
(defvar completion-reference-buffer nil
|
|
|
|
|
"Record the buffer that was current when the completion list was requested.
|
|
|
|
|
This is a local variable in the completion list buffer.
|
1995-04-09 03:33:01 +00:00
|
|
|
|
Initial value is nil to avoid some compiler warnings.")
|
1994-03-02 23:09:40 +00:00
|
|
|
|
|
1997-01-24 03:51:57 +00:00
|
|
|
|
(defvar completion-no-auto-exit nil
|
|
|
|
|
"Non-nil means `choose-completion-string' should never exit the minibuffer.
|
2009-11-14 04:18:10 +00:00
|
|
|
|
This also applies to other functions such as `choose-completion'.")
|
1997-01-24 03:51:57 +00:00
|
|
|
|
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(defvar completion-base-position nil
|
|
|
|
|
"Position of the base of the text corresponding to the shown completions.
|
|
|
|
|
This variable is used in the *Completions* buffers.
|
|
|
|
|
Its value is a list of the form (START END) where START is the place
|
|
|
|
|
where the completion should be inserted and END (if non-nil) is the end
|
|
|
|
|
of the text to replace. If END is nil, point is used instead.")
|
|
|
|
|
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(defvar completion-list-insert-choice-function #'completion--replace
|
|
|
|
|
"Function to use to insert the text chosen in *Completions*.
|
2011-12-09 04:12:38 +01:00
|
|
|
|
Called with three arguments (BEG END TEXT), it should replace the text
|
2011-05-23 23:45:50 -03:00
|
|
|
|
between BEG and END with TEXT. Expected to be set buffer-locally
|
|
|
|
|
in the *Completions* buffer.")
|
|
|
|
|
|
1995-04-08 22:42:47 +00:00
|
|
|
|
(defvar completion-base-size nil
|
2008-08-14 23:44:29 +00:00
|
|
|
|
"Number of chars before point not involved in completion.
|
|
|
|
|
This is a local variable in the completion list buffer.
|
|
|
|
|
It refers to the chars in the minibuffer if completing in the
|
|
|
|
|
minibuffer, or in `completion-reference-buffer' otherwise.
|
|
|
|
|
Only characters in the field at point are included.
|
|
|
|
|
|
|
|
|
|
If nil, Emacs determines which part of the tail end of the
|
|
|
|
|
buffer's text is involved in completion by comparing the text
|
|
|
|
|
directly.")
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(make-obsolete-variable 'completion-base-size 'completion-base-position "23.2")
|
1994-08-07 18:11:58 +00:00
|
|
|
|
|
1994-12-15 02:02:04 +00:00
|
|
|
|
(defun delete-completion-window ()
|
|
|
|
|
"Delete the completion list window.
|
|
|
|
|
Go to the window from which completion was requested."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((buf completion-reference-buffer))
|
1997-01-09 07:59:03 +00:00
|
|
|
|
(if (one-window-p t)
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 18:26:57 +04:00
|
|
|
|
(if (window-dedicated-p) (delete-frame))
|
1997-01-09 07:59:03 +00:00
|
|
|
|
(delete-window (selected-window))
|
|
|
|
|
(if (get-buffer-window buf)
|
|
|
|
|
(select-window (get-buffer-window buf))))))
|
1994-12-15 02:02:04 +00:00
|
|
|
|
|
1994-12-29 18:53:25 +00:00
|
|
|
|
(defun previous-completion (n)
|
|
|
|
|
"Move to the previous item in the completion list."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(next-completion (- n)))
|
|
|
|
|
|
|
|
|
|
(defun next-completion (n)
|
|
|
|
|
"Move to the next item in the completion list.
|
1996-01-04 23:20:13 +00:00
|
|
|
|
With prefix argument N, move N items (negative N means move backward)."
|
1994-12-29 18:53:25 +00:00
|
|
|
|
(interactive "p")
|
2000-11-22 19:47:30 +00:00
|
|
|
|
(let ((beg (point-min)) (end (point-max)))
|
|
|
|
|
(while (and (> n 0) (not (eobp)))
|
1994-12-29 18:53:25 +00:00
|
|
|
|
;; If in a completion, move to the end of it.
|
2000-11-22 19:47:30 +00:00
|
|
|
|
(when (get-text-property (point) 'mouse-face)
|
|
|
|
|
(goto-char (next-single-property-change (point) 'mouse-face nil end)))
|
1994-12-29 18:53:25 +00:00
|
|
|
|
;; Move to start of next one.
|
2000-11-22 19:47:30 +00:00
|
|
|
|
(unless (get-text-property (point) 'mouse-face)
|
|
|
|
|
(goto-char (next-single-property-change (point) 'mouse-face nil end)))
|
|
|
|
|
(setq n (1- n)))
|
|
|
|
|
(while (and (< n 0) (not (bobp)))
|
|
|
|
|
(let ((prop (get-text-property (1- (point)) 'mouse-face)))
|
|
|
|
|
;; If in a completion, move to the start of it.
|
|
|
|
|
(when (and prop (eq prop (get-text-property (point) 'mouse-face)))
|
1995-10-11 03:11:11 +00:00
|
|
|
|
(goto-char (previous-single-property-change
|
2000-11-22 19:47:30 +00:00
|
|
|
|
(point) 'mouse-face nil beg)))
|
|
|
|
|
;; Move to end of the previous completion.
|
|
|
|
|
(unless (or (bobp) (get-text-property (1- (point)) 'mouse-face))
|
|
|
|
|
(goto-char (previous-single-property-change
|
|
|
|
|
(point) 'mouse-face nil beg)))
|
|
|
|
|
;; Move to the start of that one.
|
|
|
|
|
(goto-char (previous-single-property-change
|
|
|
|
|
(point) 'mouse-face nil beg))
|
|
|
|
|
(setq n (1+ n))))))
|
1994-12-29 18:53:25 +00:00
|
|
|
|
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(defun choose-completion (&optional event)
|
2014-02-09 22:58:34 -08:00
|
|
|
|
"Choose the completion at point.
|
2014-02-21 14:22:14 +01:00
|
|
|
|
If EVENT, use EVENT's position to determine the starting position."
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(interactive (list last-nonmenu-event))
|
|
|
|
|
;; In case this is run via the mouse, give temporary modes such as
|
|
|
|
|
;; isearch a chance to turn off.
|
|
|
|
|
(run-hooks 'mouse-leave-buffer-hook)
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(with-current-buffer (window-buffer (posn-window (event-start event)))
|
|
|
|
|
(let ((buffer completion-reference-buffer)
|
|
|
|
|
(base-size completion-base-size)
|
|
|
|
|
(base-position completion-base-position)
|
|
|
|
|
(insert-function completion-list-insert-choice-function)
|
|
|
|
|
(choice
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (posn-point (event-start event)))
|
|
|
|
|
(let (beg end)
|
|
|
|
|
(cond
|
|
|
|
|
((and (not (eobp)) (get-text-property (point) 'mouse-face))
|
|
|
|
|
(setq end (point) beg (1+ (point))))
|
|
|
|
|
((and (not (bobp))
|
|
|
|
|
(get-text-property (1- (point)) 'mouse-face))
|
|
|
|
|
(setq end (1- (point)) beg (point)))
|
|
|
|
|
(t (error "No completion here")))
|
|
|
|
|
(setq beg (previous-single-property-change beg 'mouse-face))
|
|
|
|
|
(setq end (or (next-single-property-change end 'mouse-face)
|
|
|
|
|
(point-max)))
|
2012-06-01 15:44:48 +02:00
|
|
|
|
(buffer-substring-no-properties beg end)))))
|
2011-05-23 23:45:50 -03:00
|
|
|
|
|
|
|
|
|
(unless (buffer-live-p buffer)
|
|
|
|
|
(error "Destination buffer is dead"))
|
2012-05-29 20:21:45 +08:00
|
|
|
|
(quit-window nil (posn-window (event-start event)))
|
2011-05-23 23:45:50 -03:00
|
|
|
|
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(choose-completion-string
|
|
|
|
|
choice buffer
|
|
|
|
|
(or base-position
|
|
|
|
|
(when base-size
|
|
|
|
|
;; Someone's using old completion code that doesn't know
|
|
|
|
|
;; about base-position yet.
|
|
|
|
|
(list (+ base-size (field-beginning))))
|
|
|
|
|
;; If all else fails, just guess.
|
|
|
|
|
(list (choose-completion-guess-base-position choice)))
|
|
|
|
|
insert-function)))))
|
1994-03-27 22:21:04 +00:00
|
|
|
|
|
|
|
|
|
;; Delete the longest partial match for STRING
|
|
|
|
|
;; that can be found before POINT.
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(defun choose-completion-guess-base-position (string)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((opoint (point))
|
|
|
|
|
len)
|
|
|
|
|
;; Try moving back by the length of the string.
|
|
|
|
|
(goto-char (max (- (point) (length string))
|
|
|
|
|
(minibuffer-prompt-end)))
|
|
|
|
|
;; See how far back we were actually able to move. That is the
|
|
|
|
|
;; upper bound on how much we can match and delete.
|
|
|
|
|
(setq len (- opoint (point)))
|
|
|
|
|
(if completion-ignore-case
|
|
|
|
|
(setq string (downcase string)))
|
|
|
|
|
(while (and (> len 0)
|
|
|
|
|
(let ((tail (buffer-substring (point) opoint)))
|
|
|
|
|
(if completion-ignore-case
|
|
|
|
|
(setq tail (downcase tail)))
|
|
|
|
|
(not (string= tail (substring string 0 len)))))
|
|
|
|
|
(setq len (1- len))
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(point))))
|
|
|
|
|
|
1994-03-27 22:21:04 +00:00
|
|
|
|
(defun choose-completion-delete-max-match (string)
|
Use declare forms, where possible, to mark obsolete functions.
* lisp/allout.el (allout-passphrase-hint-string): Likewise.
(allout-init): Use a declare form to mark obsolete.
* lisp/calendar/calendar.el (calendar-version):
* lisp/calendar/icalendar.el (icalendar-extract-ical-from-buffer)
(icalendar-convert-diary-to-ical):
* lisp/cus-edit.el (custom-mode):
* lisp/ansi-color.el (ansi-color-unfontify-region):
* lisp/international/latin1-disp.el (latin1-char-displayable-p):
* lisp/progmodes/cwarn.el (turn-on-cwarn-mode):
* lisp/progmodes/which-func.el (which-func-update-1): Use
define-obsolete-function-alias.
* lisp/bookmark.el (bookmark-jump-noselect): Use a declare form to mark
this function obsolete.
* lisp/calendar/cal-x.el (calendar-two-frame-setup)
(calendar-only-one-frame-setup, calendar-one-frame-setup):
* lisp/calendar/calendar.el (american-calendar, european-calendar)
(calendar-for-loop):
* lisp/comint.el (comint-dynamic-simple-complete)
(comint-dynamic-complete-as-filename, comint-unquote-filename):
* lisp/desktop.el (desktop-load-default):
* lisp/dired-x.el (dired-omit-here-always)
(dired-hack-local-variables, dired-default-directory):
* lisp/emacs-lisp/derived.el (derived-mode-class):
* lisp/emacs-lisp/timer.el (timer-set-time-with-usecs):
* lisp/emacs-lock.el (toggle-emacs-lock):
* lisp/epa.el (epa-display-verify-result):
* lisp/epg.el (epg-sign-keys, epg-start-sign-keys)
(epg-passphrase-callback-function):
* lisp/eshell/esh-util.el (eshell-for):
* lisp/eshell/eshell.el (eshell-remove-from-window-buffer-names)
(eshell-add-to-window-buffer-names):
* lisp/files.el (locate-file-completion):
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name)
(imenu-example--name-and-position):
* lisp/international/mule-cmds.el (princ-list):
* lisp/international/mule-diag.el (decode-codepage-char):
* lisp/international/mule-util.el (detect-coding-with-priority):
* lisp/iswitchb.el (iswitchb-read-buffer):
* lisp/mail/mailalias.el (mail-complete):
* lisp/mail/sendmail.el (mail-sent-via):
* lisp/mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar)
(mouse-major-mode-menu):
* lisp/password-cache.el (password-read-and-add):
* lisp/pcomplete.el (pcomplete-parse-comint-arguments):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-regexp-eval):
* lisp/savehist.el (savehist-load):
* lisp/simple.el (choose-completion-delete-max-match):
* lisp/term.el (term-dynamic-simple-complete):
* lisp/vc/ediff-init.el (ediff-check-version):
* lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically):
* lisp/vc/vc.el (vc-diff-switches-list):
* lisp/view.el (view-return-to-alist-update): Likewise.
* lisp/iswitchb.el (iswitchb-read-buffer): Move code of
iswitchb-define-mode-map here, and delete that obsolete function.
* lisp/subr.el (eval-next-after-load, makehash, insert-string)
(assoc-ignore-representation, assoc-ignore-case): Use declare to
mark obsolete.
(mode-line-inverse-video): Variable deleted.
* lisp/emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
this applies to functions.
* lisp/erc/erc.el (erc-send-command): Use define-obsolete-function-alias.
* lisp/international/mule-util.el (string-to-sequence): Remove.
* lisp/net/newst-backend.el (newsticker-cache-filename):
* lisp/net/newst-treeview.el (newsticker-groups-filename): Fix
incorrect obsolescence declaration.
* lisp/net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete
font-lock-reference-face.
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/url/url-util.el (url-generate-unique-filename): Use declare to mark
obsolete.
* src/xdisp.c (mode_line_inverse_video): Delete obsolete variable.
2012-09-25 12:13:02 +08:00
|
|
|
|
(declare (obsolete choose-completion-guess-base-position "23.2"))
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(delete-region (choose-completion-guess-base-position string) (point)))
|
1994-03-27 22:21:04 +00:00
|
|
|
|
|
2002-06-01 00:00:29 +00:00
|
|
|
|
(defvar choose-completion-string-functions nil
|
2002-06-01 21:56:40 +00:00
|
|
|
|
"Functions that may override the normal insertion of a completion choice.
|
2014-02-08 04:46:09 -08:00
|
|
|
|
These functions are called in order with three arguments:
|
2002-06-01 21:56:40 +00:00
|
|
|
|
CHOICE - the string to insert in the buffer,
|
|
|
|
|
BUFFER - the buffer in which the choice should be inserted,
|
2014-02-08 04:46:09 -08:00
|
|
|
|
BASE-POSITION - where to insert the completion.
|
2002-06-02 00:01:59 +00:00
|
|
|
|
|
2002-06-01 21:56:40 +00:00
|
|
|
|
If a function in the list returns non-nil, that function is supposed
|
|
|
|
|
to have inserted the CHOICE in the BUFFER, and possibly exited
|
2002-06-02 00:01:59 +00:00
|
|
|
|
the minibuffer; no further functions will be called.
|
2002-06-01 00:00:29 +00:00
|
|
|
|
|
2002-06-02 00:01:59 +00:00
|
|
|
|
If all functions in the list return nil, that means to use
|
|
|
|
|
the default method of inserting the completion in BUFFER.")
|
1996-06-22 04:50:32 +00:00
|
|
|
|
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(defun choose-completion-string (choice &optional
|
|
|
|
|
buffer base-position insert-function)
|
2002-06-02 00:01:59 +00:00
|
|
|
|
"Switch to BUFFER and insert the completion choice CHOICE.
|
2013-04-09 11:36:25 +02:00
|
|
|
|
BASE-POSITION says where to insert the completion.
|
|
|
|
|
INSERT-FUNCTION says how to insert the completion and falls
|
|
|
|
|
back on `completion-list-insert-choice-function' when nil."
|
2002-06-02 00:01:59 +00:00
|
|
|
|
|
|
|
|
|
;; If BUFFER is the minibuffer, exit the minibuffer
|
|
|
|
|
;; unless it is reading a file name and CHOICE is a directory,
|
|
|
|
|
;; or completion-no-auto-exit is non-nil.
|
|
|
|
|
|
2009-10-15 01:50:17 +00:00
|
|
|
|
;; Some older code may call us passing `base-size' instead of
|
|
|
|
|
;; `base-position'. It's difficult to make any use of `base-size',
|
|
|
|
|
;; so we just ignore it.
|
|
|
|
|
(unless (consp base-position)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
(message "Obsolete `base-size' passed to choose-completion-string")
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(setq base-position nil))
|
|
|
|
|
|
2003-07-25 12:18:04 +00:00
|
|
|
|
(let* ((buffer (or buffer completion-reference-buffer))
|
|
|
|
|
(mini-p (minibufferp buffer)))
|
1994-05-05 05:27:59 +00:00
|
|
|
|
;; If BUFFER is a minibuffer, barf unless it's the currently
|
|
|
|
|
;; active minibuffer.
|
1999-12-31 04:02:38 +00:00
|
|
|
|
(if (and mini-p
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(not (and (active-minibuffer-window)
|
|
|
|
|
(equal buffer
|
1995-03-31 01:48:40 +00:00
|
|
|
|
(window-buffer (active-minibuffer-window))))))
|
1994-05-05 05:27:59 +00:00
|
|
|
|
(error "Minibuffer is not active for completion")
|
2004-09-12 18:52:03 +00:00
|
|
|
|
;; Set buffer so buffer-local choose-completion-string-functions works.
|
|
|
|
|
(set-buffer buffer)
|
2003-02-04 12:29:42 +00:00
|
|
|
|
(unless (run-hook-with-args-until-success
|
2002-09-09 22:09:14 +00:00
|
|
|
|
'choose-completion-string-functions
|
2009-10-15 01:50:17 +00:00
|
|
|
|
;; The fourth arg used to be `mini-p' but was useless
|
|
|
|
|
;; (since minibufferp can be used on the `buffer' arg)
|
|
|
|
|
;; and indeed unused. The last used to be `base-size', so we
|
|
|
|
|
;; keep it to try and avoid breaking old code.
|
|
|
|
|
choice buffer base-position nil)
|
2011-05-23 23:45:50 -03:00
|
|
|
|
;; This remove-text-properties should be unnecessary since `choice'
|
|
|
|
|
;; comes from buffer-substring-no-properties.
|
2011-12-04 00:02:42 -08:00
|
|
|
|
;;(remove-text-properties 0 (length choice) '(mouse-face nil) choice)
|
2002-09-09 22:09:14 +00:00
|
|
|
|
;; Insert the completion into the buffer where it was requested.
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(funcall (or insert-function completion-list-insert-choice-function)
|
|
|
|
|
(or (car base-position) (point))
|
|
|
|
|
(or (cadr base-position) (point))
|
|
|
|
|
choice)
|
|
|
|
|
;; Update point in the window that BUFFER is showing in.
|
2002-06-01 21:56:40 +00:00
|
|
|
|
(let ((window (get-buffer-window buffer t)))
|
|
|
|
|
(set-window-point window (point)))
|
|
|
|
|
;; If completing for the minibuffer, exit it with this choice.
|
|
|
|
|
(and (not completion-no-auto-exit)
|
2008-04-29 05:36:55 +00:00
|
|
|
|
(minibufferp buffer)
|
2002-06-01 21:56:40 +00:00
|
|
|
|
minibuffer-completion-table
|
|
|
|
|
;; If this is reading a file name, and the file name chosen
|
|
|
|
|
;; is a directory, don't exit the minibuffer.
|
2009-08-19 02:31:59 +00:00
|
|
|
|
(let* ((result (buffer-substring (field-beginning) (point)))
|
|
|
|
|
(bounds
|
|
|
|
|
(completion-boundaries result minibuffer-completion-table
|
|
|
|
|
minibuffer-completion-predicate
|
|
|
|
|
"")))
|
|
|
|
|
(if (eq (car bounds) (length result))
|
|
|
|
|
;; The completion chosen leads to a new set of completions
|
|
|
|
|
;; (e.g. it's a directory): don't exit the minibuffer yet.
|
|
|
|
|
(let ((mini (active-minibuffer-window)))
|
|
|
|
|
(select-window mini)
|
|
|
|
|
(when minibuffer-auto-raise
|
|
|
|
|
(raise-frame (window-frame mini))))
|
|
|
|
|
(exit-minibuffer))))))))
|
1994-03-27 22:21:04 +00:00
|
|
|
|
|
2008-04-13 22:12:02 +00:00
|
|
|
|
(define-derived-mode completion-list-mode nil "Completion List"
|
1993-07-13 21:34:05 +00:00
|
|
|
|
"Major mode for buffers showing lists of possible completions.
|
1994-03-27 22:21:04 +00:00
|
|
|
|
Type \\<completion-list-mode-map>\\[choose-completion] in the completion list\
|
|
|
|
|
to select the completion near point.
|
2014-04-22 22:22:06 -04:00
|
|
|
|
Or click to select one with the mouse.
|
2008-02-11 04:03:25 +00:00
|
|
|
|
|
|
|
|
|
\\{completion-list-mode-map}"
|
2008-04-13 22:12:02 +00:00
|
|
|
|
(set (make-local-variable 'completion-base-size) nil))
|
1993-07-13 21:34:05 +00:00
|
|
|
|
|
2001-04-10 14:48:42 +00:00
|
|
|
|
(defun completion-list-mode-finish ()
|
|
|
|
|
"Finish setup of the completions buffer.
|
|
|
|
|
Called from `temp-buffer-show-hook'."
|
|
|
|
|
(when (eq major-mode 'completion-list-mode)
|
2012-06-28 00:21:41 -07:00
|
|
|
|
(setq buffer-read-only t)))
|
2001-04-10 14:48:42 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'temp-buffer-show-hook 'completion-list-mode-finish)
|
|
|
|
|
|
2005-10-16 09:31:48 +00:00
|
|
|
|
|
|
|
|
|
;; Variables and faces used in `completion-setup-function'.
|
1997-12-21 01:47:48 +00:00
|
|
|
|
|
2006-09-04 18:26:03 +00:00
|
|
|
|
(defcustom completion-show-help t
|
|
|
|
|
"Non-nil means show help message in *Completions* buffer."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "22.1"
|
|
|
|
|
:group 'completion)
|
|
|
|
|
|
2005-10-16 09:31:48 +00:00
|
|
|
|
;; This function goes in completion-setup-hook, so that it is called
|
|
|
|
|
;; after the text of the completion list buffer is written.
|
1993-07-13 21:34:05 +00:00
|
|
|
|
(defun completion-setup-function ()
|
2005-11-01 07:18:10 +00:00
|
|
|
|
(let* ((mainbuf (current-buffer))
|
2009-05-11 15:35:44 +00:00
|
|
|
|
(base-dir
|
2013-05-04 15:27:41 -04:00
|
|
|
|
;; FIXME: This is a bad hack. We try to set the default-directory
|
|
|
|
|
;; in the *Completions* buffer so that the relative file names
|
|
|
|
|
;; displayed there can be treated as valid file names, independently
|
|
|
|
|
;; from the completion context. But this suffers from many problems:
|
|
|
|
|
;; - It's not clear when the completions are file names. With some
|
|
|
|
|
;; completion tables (e.g. bzr revision specs), the listed
|
|
|
|
|
;; completions can mix file names and other things.
|
|
|
|
|
;; - It doesn't pay attention to possible quoting.
|
|
|
|
|
;; - With fancy completion styles, the code below will not always
|
|
|
|
|
;; find the right base directory.
|
2009-05-11 15:35:44 +00:00
|
|
|
|
(if minibuffer-completing-file-name
|
|
|
|
|
(file-name-as-directory
|
|
|
|
|
(expand-file-name
|
2013-05-04 15:27:41 -04:00
|
|
|
|
(buffer-substring (minibuffer-prompt-end)
|
|
|
|
|
(- (point) (or completion-base-size 0))))))))
|
2004-05-19 19:10:19 +00:00
|
|
|
|
(with-current-buffer standard-output
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(let ((base-size completion-base-size) ;Read before killing localvars.
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(base-position completion-base-position)
|
|
|
|
|
(insert-fun completion-list-insert-choice-function))
|
2008-04-13 22:12:02 +00:00
|
|
|
|
(completion-list-mode)
|
2009-10-15 01:50:17 +00:00
|
|
|
|
(set (make-local-variable 'completion-base-size) base-size)
|
2011-05-23 23:45:50 -03:00
|
|
|
|
(set (make-local-variable 'completion-base-position) base-position)
|
|
|
|
|
(set (make-local-variable 'completion-list-insert-choice-function)
|
|
|
|
|
insert-fun))
|
2005-11-01 07:18:10 +00:00
|
|
|
|
(set (make-local-variable 'completion-reference-buffer) mainbuf)
|
2009-05-11 15:35:44 +00:00
|
|
|
|
(if base-dir (setq default-directory base-dir))
|
2006-09-04 18:26:03 +00:00
|
|
|
|
;; Maybe insert help string.
|
|
|
|
|
(when completion-show-help
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (display-mouse-p)
|
2015-08-09 07:48:00 -07:00
|
|
|
|
(insert "Click on a completion to select it.\n"))
|
2006-09-04 18:26:03 +00:00
|
|
|
|
(insert (substitute-command-keys
|
|
|
|
|
"In this buffer, type \\[choose-completion] to \
|
|
|
|
|
select the completion near point.\n\n"))))))
|
1992-05-30 21:11:25 +00:00
|
|
|
|
|
1993-07-13 21:34:05 +00:00
|
|
|
|
(add-hook 'completion-setup-hook 'completion-setup-function)
|
1994-12-29 18:53:25 +00:00
|
|
|
|
|
2005-11-01 07:18:10 +00:00
|
|
|
|
(define-key minibuffer-local-completion-map [prior] 'switch-to-completions)
|
|
|
|
|
(define-key minibuffer-local-completion-map "\M-v" 'switch-to-completions)
|
1994-12-29 18:53:25 +00:00
|
|
|
|
|
|
|
|
|
(defun switch-to-completions ()
|
|
|
|
|
"Select the completion list window."
|
|
|
|
|
(interactive)
|
2009-10-22 15:27:17 +00:00
|
|
|
|
(let ((window (or (get-buffer-window "*Completions*" 0)
|
2009-11-19 17:40:14 +00:00
|
|
|
|
;; Make sure we have a completions window.
|
2009-10-22 15:27:17 +00:00
|
|
|
|
(progn (minibuffer-completion-help)
|
|
|
|
|
(get-buffer-window "*Completions*" 0)))))
|
1998-01-18 03:32:20 +00:00
|
|
|
|
(when window
|
|
|
|
|
(select-window window)
|
2009-11-19 17:40:14 +00:00
|
|
|
|
;; In the new buffer, go to the first completion.
|
|
|
|
|
;; FIXME: Perhaps this should be done in `minibuffer-completion-help'.
|
|
|
|
|
(when (bobp)
|
|
|
|
|
(next-completion 1)))))
|
2006-01-23 01:24:26 +00:00
|
|
|
|
|
|
|
|
|
;;; Support keyboard commands to turn on various modifiers.
|
1995-03-28 03:49:39 +00:00
|
|
|
|
|
|
|
|
|
;; These functions -- which are not commands -- each add one modifier
|
|
|
|
|
;; to the following event.
|
|
|
|
|
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun event-apply-alt-modifier (_ignore-prompt)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
"\\<function-key-map>Add the Alt modifier to the following event.
|
1998-06-01 21:10:43 +00:00
|
|
|
|
For example, type \\[event-apply-alt-modifier] & to enter Alt-&."
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(vector (event-apply-modifier (read-event) 'alt 22 "A-")))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun event-apply-super-modifier (_ignore-prompt)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
"\\<function-key-map>Add the Super modifier to the following event.
|
1998-06-01 21:10:43 +00:00
|
|
|
|
For example, type \\[event-apply-super-modifier] & to enter Super-&."
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(vector (event-apply-modifier (read-event) 'super 23 "s-")))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun event-apply-hyper-modifier (_ignore-prompt)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
"\\<function-key-map>Add the Hyper modifier to the following event.
|
1998-06-01 21:10:43 +00:00
|
|
|
|
For example, type \\[event-apply-hyper-modifier] & to enter Hyper-&."
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(vector (event-apply-modifier (read-event) 'hyper 24 "H-")))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun event-apply-shift-modifier (_ignore-prompt)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
"\\<function-key-map>Add the Shift modifier to the following event.
|
1998-06-01 21:10:43 +00:00
|
|
|
|
For example, type \\[event-apply-shift-modifier] & to enter Shift-&."
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(vector (event-apply-modifier (read-event) 'shift 25 "S-")))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun event-apply-control-modifier (_ignore-prompt)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
"\\<function-key-map>Add the Ctrl modifier to the following event.
|
1998-06-01 21:10:43 +00:00
|
|
|
|
For example, type \\[event-apply-control-modifier] & to enter Ctrl-&."
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(vector (event-apply-modifier (read-event) 'control 26 "C-")))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(defun event-apply-meta-modifier (_ignore-prompt)
|
2003-05-13 19:45:01 +00:00
|
|
|
|
"\\<function-key-map>Add the Meta modifier to the following event.
|
1998-06-01 21:10:43 +00:00
|
|
|
|
For example, type \\[event-apply-meta-modifier] & to enter Meta-&."
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(vector (event-apply-modifier (read-event) 'meta 27 "M-")))
|
|
|
|
|
|
|
|
|
|
(defun event-apply-modifier (event symbol lshiftby prefix)
|
|
|
|
|
"Apply a modifier flag to event EVENT.
|
|
|
|
|
SYMBOL is the name of this modifier, as a symbol.
|
|
|
|
|
LSHIFTBY is the numeric value of this modifier, in keyboard events.
|
|
|
|
|
PREFIX is the string that represents this modifier in an event type symbol."
|
|
|
|
|
(if (numberp event)
|
|
|
|
|
(cond ((eq symbol 'control)
|
2018-07-27 16:45:03 -04:00
|
|
|
|
(if (<= 64 (upcase event) 95)
|
|
|
|
|
(- (upcase event) 64)
|
Audit use of lsh and fix glitches
I audited use of lsh in the Lisp source code, and fixed the
glitches that I found. While I was at it, I replaced uses of lsh
with ash when either will do. Replacement is OK when either
argument is known to be nonnegative, or when only the low-order
bits of the result matter, and is a (minor) win since ash is a bit
more solid than lsh nowadays, and is a bit faster.
* lisp/calc/calc-ext.el (math-check-fixnum):
Prefer most-positive-fixnum to (lsh -1 -1).
* lisp/vc/vc-hg.el (vc-hg-state-fast): When testing fixnum width,
prefer (zerop (ash most-positive-fixnum -32)) to (zerop (lsh -1
32)) (Bug#32485#11).
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
Tighten sanity-check for bytecode overflow, by checking that the
result of (ash pc -8) is nonnegative. Formerly this check was not
needed since lsh was used and the number overflowed differently.
* lisp/net/dns.el (dns-write): Fix some obvious sign typos in
shift counts. Evidently this part of the code has never been
exercised.
* lisp/progmodes/hideif.el (hif-shiftleft, hif-shiftright):
* lisp/term/common-win.el (x-setup-function-keys):
Simplify.
* admin/unidata/unidata-gen.el, admin/unidata/uvs.el:
* doc/lispref/keymaps.texi, doc/lispref/syntax.texi:
* doc/misc/calc.texi, doc/misc/cl.texi, etc/NEWS.19:
* lisp/arc-mode.el, lisp/calc/calc-bin.el, lisp/calc/calc-comb.el:
* lisp/calc/calc-ext.el, lisp/calc/calc-math.el:
* lisp/cedet/semantic/wisent/comp.el, lisp/composite.el:
* lisp/disp-table.el, lisp/dos-fns.el, lisp/edmacro.el:
* lisp/emacs-lisp/bindat.el, lisp/emacs-lisp/byte-opt.el:
* lisp/emacs-lisp/bytecomp.el, lisp/emacs-lisp/cl-extra.el:
* lisp/erc/erc-dcc.el, lisp/facemenu.el, lisp/gnus/message.el:
* lisp/gnus/nndoc.el, lisp/gnus/nnmaildir.el, lisp/image.el:
* lisp/international/ccl.el, lisp/international/fontset.el:
* lisp/international/mule-cmds.el, lisp/international/mule.el:
* lisp/json.el, lisp/mail/binhex.el, lisp/mail/rmail.el:
* lisp/mail/uudecode.el, lisp/md4.el, lisp/net/dns.el:
* lisp/net/ntlm.el, lisp/net/sasl.el, lisp/net/socks.el:
* lisp/net/tramp.el, lisp/obsolete/levents.el:
* lisp/obsolete/pgg-parse.el, lisp/org/org.el:
* lisp/org/ox-publish.el, lisp/progmodes/cc-defs.el:
* lisp/progmodes/ebnf2ps.el, lisp/progmodes/hideif.el:
* lisp/ps-bdf.el, lisp/ps-print.el, lisp/simple.el:
* lisp/tar-mode.el, lisp/term/common-win.el:
* lisp/term/tty-colors.el, lisp/term/xterm.el, lisp/vc/vc-git.el:
* lisp/vc/vc-hg.el, lisp/x-dnd.el, test/src/data-tests.el:
Prefer ash to lsh when either will do.
2018-08-21 13:44:03 -07:00
|
|
|
|
(logior (ash 1 lshiftby) event)))
|
1995-03-28 03:49:39 +00:00
|
|
|
|
((eq symbol 'shift)
|
2018-07-27 16:45:03 -04:00
|
|
|
|
;; FIXME: Should we also apply this "upcase" behavior of shift
|
|
|
|
|
;; to non-ascii letters?
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(if (and (<= (downcase event) ?z)
|
|
|
|
|
(>= (downcase event) ?a))
|
|
|
|
|
(upcase event)
|
Audit use of lsh and fix glitches
I audited use of lsh in the Lisp source code, and fixed the
glitches that I found. While I was at it, I replaced uses of lsh
with ash when either will do. Replacement is OK when either
argument is known to be nonnegative, or when only the low-order
bits of the result matter, and is a (minor) win since ash is a bit
more solid than lsh nowadays, and is a bit faster.
* lisp/calc/calc-ext.el (math-check-fixnum):
Prefer most-positive-fixnum to (lsh -1 -1).
* lisp/vc/vc-hg.el (vc-hg-state-fast): When testing fixnum width,
prefer (zerop (ash most-positive-fixnum -32)) to (zerop (lsh -1
32)) (Bug#32485#11).
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
Tighten sanity-check for bytecode overflow, by checking that the
result of (ash pc -8) is nonnegative. Formerly this check was not
needed since lsh was used and the number overflowed differently.
* lisp/net/dns.el (dns-write): Fix some obvious sign typos in
shift counts. Evidently this part of the code has never been
exercised.
* lisp/progmodes/hideif.el (hif-shiftleft, hif-shiftright):
* lisp/term/common-win.el (x-setup-function-keys):
Simplify.
* admin/unidata/unidata-gen.el, admin/unidata/uvs.el:
* doc/lispref/keymaps.texi, doc/lispref/syntax.texi:
* doc/misc/calc.texi, doc/misc/cl.texi, etc/NEWS.19:
* lisp/arc-mode.el, lisp/calc/calc-bin.el, lisp/calc/calc-comb.el:
* lisp/calc/calc-ext.el, lisp/calc/calc-math.el:
* lisp/cedet/semantic/wisent/comp.el, lisp/composite.el:
* lisp/disp-table.el, lisp/dos-fns.el, lisp/edmacro.el:
* lisp/emacs-lisp/bindat.el, lisp/emacs-lisp/byte-opt.el:
* lisp/emacs-lisp/bytecomp.el, lisp/emacs-lisp/cl-extra.el:
* lisp/erc/erc-dcc.el, lisp/facemenu.el, lisp/gnus/message.el:
* lisp/gnus/nndoc.el, lisp/gnus/nnmaildir.el, lisp/image.el:
* lisp/international/ccl.el, lisp/international/fontset.el:
* lisp/international/mule-cmds.el, lisp/international/mule.el:
* lisp/json.el, lisp/mail/binhex.el, lisp/mail/rmail.el:
* lisp/mail/uudecode.el, lisp/md4.el, lisp/net/dns.el:
* lisp/net/ntlm.el, lisp/net/sasl.el, lisp/net/socks.el:
* lisp/net/tramp.el, lisp/obsolete/levents.el:
* lisp/obsolete/pgg-parse.el, lisp/org/org.el:
* lisp/org/ox-publish.el, lisp/progmodes/cc-defs.el:
* lisp/progmodes/ebnf2ps.el, lisp/progmodes/hideif.el:
* lisp/ps-bdf.el, lisp/ps-print.el, lisp/simple.el:
* lisp/tar-mode.el, lisp/term/common-win.el:
* lisp/term/tty-colors.el, lisp/term/xterm.el, lisp/vc/vc-git.el:
* lisp/vc/vc-hg.el, lisp/x-dnd.el, test/src/data-tests.el:
Prefer ash to lsh when either will do.
2018-08-21 13:44:03 -07:00
|
|
|
|
(logior (ash 1 lshiftby) event)))
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(t
|
Audit use of lsh and fix glitches
I audited use of lsh in the Lisp source code, and fixed the
glitches that I found. While I was at it, I replaced uses of lsh
with ash when either will do. Replacement is OK when either
argument is known to be nonnegative, or when only the low-order
bits of the result matter, and is a (minor) win since ash is a bit
more solid than lsh nowadays, and is a bit faster.
* lisp/calc/calc-ext.el (math-check-fixnum):
Prefer most-positive-fixnum to (lsh -1 -1).
* lisp/vc/vc-hg.el (vc-hg-state-fast): When testing fixnum width,
prefer (zerop (ash most-positive-fixnum -32)) to (zerop (lsh -1
32)) (Bug#32485#11).
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
Tighten sanity-check for bytecode overflow, by checking that the
result of (ash pc -8) is nonnegative. Formerly this check was not
needed since lsh was used and the number overflowed differently.
* lisp/net/dns.el (dns-write): Fix some obvious sign typos in
shift counts. Evidently this part of the code has never been
exercised.
* lisp/progmodes/hideif.el (hif-shiftleft, hif-shiftright):
* lisp/term/common-win.el (x-setup-function-keys):
Simplify.
* admin/unidata/unidata-gen.el, admin/unidata/uvs.el:
* doc/lispref/keymaps.texi, doc/lispref/syntax.texi:
* doc/misc/calc.texi, doc/misc/cl.texi, etc/NEWS.19:
* lisp/arc-mode.el, lisp/calc/calc-bin.el, lisp/calc/calc-comb.el:
* lisp/calc/calc-ext.el, lisp/calc/calc-math.el:
* lisp/cedet/semantic/wisent/comp.el, lisp/composite.el:
* lisp/disp-table.el, lisp/dos-fns.el, lisp/edmacro.el:
* lisp/emacs-lisp/bindat.el, lisp/emacs-lisp/byte-opt.el:
* lisp/emacs-lisp/bytecomp.el, lisp/emacs-lisp/cl-extra.el:
* lisp/erc/erc-dcc.el, lisp/facemenu.el, lisp/gnus/message.el:
* lisp/gnus/nndoc.el, lisp/gnus/nnmaildir.el, lisp/image.el:
* lisp/international/ccl.el, lisp/international/fontset.el:
* lisp/international/mule-cmds.el, lisp/international/mule.el:
* lisp/json.el, lisp/mail/binhex.el, lisp/mail/rmail.el:
* lisp/mail/uudecode.el, lisp/md4.el, lisp/net/dns.el:
* lisp/net/ntlm.el, lisp/net/sasl.el, lisp/net/socks.el:
* lisp/net/tramp.el, lisp/obsolete/levents.el:
* lisp/obsolete/pgg-parse.el, lisp/org/org.el:
* lisp/org/ox-publish.el, lisp/progmodes/cc-defs.el:
* lisp/progmodes/ebnf2ps.el, lisp/progmodes/hideif.el:
* lisp/ps-bdf.el, lisp/ps-print.el, lisp/simple.el:
* lisp/tar-mode.el, lisp/term/common-win.el:
* lisp/term/tty-colors.el, lisp/term/xterm.el, lisp/vc/vc-git.el:
* lisp/vc/vc-hg.el, lisp/x-dnd.el, test/src/data-tests.el:
Prefer ash to lsh when either will do.
2018-08-21 13:44:03 -07:00
|
|
|
|
(logior (ash 1 lshiftby) event)))
|
1995-03-28 03:49:39 +00:00
|
|
|
|
(if (memq symbol (event-modifiers event))
|
|
|
|
|
event
|
|
|
|
|
(let ((event-type (if (symbolp event) event (car event))))
|
|
|
|
|
(setq event-type (intern (concat prefix (symbol-name event-type))))
|
|
|
|
|
(if (symbolp event)
|
|
|
|
|
event-type
|
|
|
|
|
(cons event-type (cdr event)))))))
|
|
|
|
|
|
1995-04-05 03:34:40 +00:00
|
|
|
|
(define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier)
|
|
|
|
|
(define-key function-key-map [?\C-x ?@ ?s] 'event-apply-super-modifier)
|
|
|
|
|
(define-key function-key-map [?\C-x ?@ ?m] 'event-apply-meta-modifier)
|
|
|
|
|
(define-key function-key-map [?\C-x ?@ ?a] 'event-apply-alt-modifier)
|
|
|
|
|
(define-key function-key-map [?\C-x ?@ ?S] 'event-apply-shift-modifier)
|
|
|
|
|
(define-key function-key-map [?\C-x ?@ ?c] 'event-apply-control-modifier)
|
2006-01-23 01:24:26 +00:00
|
|
|
|
|
1993-07-01 20:34:13 +00:00
|
|
|
|
;;;; Keypad support.
|
|
|
|
|
|
2007-06-29 04:37:34 +00:00
|
|
|
|
;; Make the keypad keys act like ordinary typing keys. If people add
|
|
|
|
|
;; bindings for the function key symbols, then those bindings will
|
|
|
|
|
;; override these, so this shouldn't interfere with any existing
|
|
|
|
|
;; bindings.
|
1993-07-01 20:34:13 +00:00
|
|
|
|
|
1993-12-25 00:45:07 +00:00
|
|
|
|
;; Also tell read-char how to handle these keys.
|
2001-10-31 00:57:04 +00:00
|
|
|
|
(mapc
|
1993-07-01 20:34:13 +00:00
|
|
|
|
(lambda (keypad-normal)
|
|
|
|
|
(let ((keypad (nth 0 keypad-normal))
|
|
|
|
|
(normal (nth 1 keypad-normal)))
|
1993-12-25 00:45:07 +00:00
|
|
|
|
(put keypad 'ascii-character normal)
|
1993-07-01 20:34:13 +00:00
|
|
|
|
(define-key function-key-map (vector keypad) (vector normal))))
|
2013-12-13 03:03:04 +02:00
|
|
|
|
;; See also kp-keys bound in bindings.el.
|
|
|
|
|
'((kp-space ?\s)
|
1993-07-01 20:34:13 +00:00
|
|
|
|
(kp-tab ?\t)
|
|
|
|
|
(kp-enter ?\r)
|
|
|
|
|
(kp-separator ?,)
|
2009-09-14 01:22:42 +00:00
|
|
|
|
(kp-equal ?=)
|
|
|
|
|
;; Do the same for various keys that are represented as symbols under
|
|
|
|
|
;; GUIs but naturally correspond to characters.
|
|
|
|
|
(backspace 127)
|
|
|
|
|
(delete 127)
|
|
|
|
|
(tab ?\t)
|
|
|
|
|
(linefeed ?\n)
|
|
|
|
|
(clear ?\C-l)
|
|
|
|
|
(return ?\C-m)
|
|
|
|
|
(escape ?\e)
|
|
|
|
|
))
|
2002-04-27 23:16:18 +00:00
|
|
|
|
|
1999-11-15 16:11:14 +00:00
|
|
|
|
;;;;
|
1999-10-13 00:48:17 +00:00
|
|
|
|
;;;; forking a twin copy of a buffer.
|
1999-11-15 16:11:14 +00:00
|
|
|
|
;;;;
|
1999-10-13 00:48:17 +00:00
|
|
|
|
|
|
|
|
|
(defvar clone-buffer-hook nil
|
|
|
|
|
"Normal hook to run in the new buffer at the end of `clone-buffer'.")
|
|
|
|
|
|
2008-02-12 02:25:10 +00:00
|
|
|
|
(defvar clone-indirect-buffer-hook nil
|
|
|
|
|
"Normal hook to run in the new buffer at the end of `clone-indirect-buffer'.")
|
|
|
|
|
|
1999-10-13 00:48:17 +00:00
|
|
|
|
(defun clone-process (process &optional newname)
|
|
|
|
|
"Create a twin copy of PROCESS.
|
|
|
|
|
If NEWNAME is nil, it defaults to PROCESS' name;
|
|
|
|
|
NEWNAME is modified by adding or incrementing <N> at the end as necessary.
|
|
|
|
|
If PROCESS is associated with a buffer, the new process will be associated
|
|
|
|
|
with the current buffer instead.
|
|
|
|
|
Returns nil if PROCESS has already terminated."
|
|
|
|
|
(setq newname (or newname (process-name process)))
|
|
|
|
|
(if (string-match "<[0-9]+>\\'" newname)
|
|
|
|
|
(setq newname (substring newname 0 (match-beginning 0))))
|
|
|
|
|
(when (memq (process-status process) '(run stop open))
|
|
|
|
|
(let* ((process-connection-type (process-tty-name process))
|
|
|
|
|
(new-process
|
|
|
|
|
(if (memq (process-status process) '(open))
|
2002-03-17 20:28:53 +00:00
|
|
|
|
(let ((args (process-contact process t)))
|
|
|
|
|
(setq args (plist-put args :name newname))
|
|
|
|
|
(setq args (plist-put args :buffer
|
2003-01-14 10:16:00 +00:00
|
|
|
|
(if (process-buffer process)
|
|
|
|
|
(current-buffer))))
|
2002-03-17 20:28:53 +00:00
|
|
|
|
(apply 'make-network-process args))
|
1999-10-13 00:48:17 +00:00
|
|
|
|
(apply 'start-process newname
|
|
|
|
|
(if (process-buffer process) (current-buffer))
|
|
|
|
|
(process-command process)))))
|
2002-03-17 20:28:53 +00:00
|
|
|
|
(set-process-query-on-exit-flag
|
|
|
|
|
new-process (process-query-on-exit-flag process))
|
1999-10-13 00:48:17 +00:00
|
|
|
|
(set-process-inherit-coding-system-flag
|
|
|
|
|
new-process (process-inherit-coding-system-flag process))
|
|
|
|
|
(set-process-filter new-process (process-filter process))
|
|
|
|
|
(set-process-sentinel new-process (process-sentinel process))
|
2003-01-14 10:16:00 +00:00
|
|
|
|
(set-process-plist new-process (copy-sequence (process-plist process)))
|
1999-10-13 00:48:17 +00:00
|
|
|
|
new-process)))
|
|
|
|
|
|
2002-03-26 06:29:01 +00:00
|
|
|
|
;; things to maybe add (currently partly covered by `funcall mode'):
|
1999-10-13 00:48:17 +00:00
|
|
|
|
;; - syntax-table
|
|
|
|
|
;; - overlays
|
|
|
|
|
(defun clone-buffer (&optional newname display-flag)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
"Create and return a twin copy of the current buffer.
|
|
|
|
|
Unlike an indirect buffer, the new buffer can be edited
|
|
|
|
|
independently of the old one (if it is not read-only).
|
|
|
|
|
NEWNAME is the name of the new buffer. It may be modified by
|
|
|
|
|
adding or incrementing <N> at the end as necessary to create a
|
|
|
|
|
unique buffer name. If nil, it defaults to the name of the
|
|
|
|
|
current buffer, with the proper suffix. If DISPLAY-FLAG is
|
|
|
|
|
non-nil, the new buffer is shown with `pop-to-buffer'. Trying to
|
|
|
|
|
clone a file-visiting buffer, or a buffer whose major mode symbol
|
|
|
|
|
has a non-nil `no-clone' property, results in an error.
|
|
|
|
|
|
|
|
|
|
Interactively, DISPLAY-FLAG is t and NEWNAME is the name of the
|
|
|
|
|
current buffer with appropriate suffix. However, if a prefix
|
|
|
|
|
argument is given, then the command prompts for NEWNAME in the
|
|
|
|
|
minibuffer.
|
1999-10-13 00:48:17 +00:00
|
|
|
|
|
|
|
|
|
This runs the normal hook `clone-buffer-hook' in the new buffer
|
|
|
|
|
after it has been set up properly in other respects."
|
2001-11-13 02:09:59 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(progn
|
|
|
|
|
(if buffer-file-name
|
|
|
|
|
(error "Cannot clone a file-visiting buffer"))
|
|
|
|
|
(if (get major-mode 'no-clone)
|
|
|
|
|
(error "Cannot clone a buffer in %s mode" mode-name))
|
2006-01-23 01:24:26 +00:00
|
|
|
|
(list (if current-prefix-arg
|
|
|
|
|
(read-buffer "Name of new cloned buffer: " (current-buffer)))
|
2001-11-13 02:09:59 +00:00
|
|
|
|
t)))
|
1999-10-13 00:48:17 +00:00
|
|
|
|
(if buffer-file-name
|
|
|
|
|
(error "Cannot clone a file-visiting buffer"))
|
|
|
|
|
(if (get major-mode 'no-clone)
|
|
|
|
|
(error "Cannot clone a buffer in %s mode" mode-name))
|
|
|
|
|
(setq newname (or newname (buffer-name)))
|
|
|
|
|
(if (string-match "<[0-9]+>\\'" newname)
|
|
|
|
|
(setq newname (substring newname 0 (match-beginning 0))))
|
|
|
|
|
(let ((buf (current-buffer))
|
|
|
|
|
(ptmin (point-min))
|
|
|
|
|
(ptmax (point-max))
|
|
|
|
|
(pt (point))
|
|
|
|
|
(mk (if mark-active (mark t)))
|
|
|
|
|
(modified (buffer-modified-p))
|
|
|
|
|
(mode major-mode)
|
|
|
|
|
(lvars (buffer-local-variables))
|
|
|
|
|
(process (get-buffer-process (current-buffer)))
|
|
|
|
|
(new (generate-new-buffer (or newname (buffer-name)))))
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(with-current-buffer new
|
|
|
|
|
(insert-buffer-substring buf)))
|
|
|
|
|
(with-current-buffer new
|
|
|
|
|
(narrow-to-region ptmin ptmax)
|
|
|
|
|
(goto-char pt)
|
|
|
|
|
(if mk (set-mark mk))
|
|
|
|
|
(set-buffer-modified-p modified)
|
|
|
|
|
|
|
|
|
|
;; Clone the old buffer's process, if any.
|
|
|
|
|
(when process (clone-process process))
|
|
|
|
|
|
|
|
|
|
;; Now set up the major mode.
|
|
|
|
|
(funcall mode)
|
|
|
|
|
|
|
|
|
|
;; Set up other local variables.
|
2007-09-25 11:13:24 +00:00
|
|
|
|
(mapc (lambda (v)
|
2017-11-23 13:35:15 -05:00
|
|
|
|
(condition-case ()
|
2007-09-25 11:13:24 +00:00
|
|
|
|
(if (symbolp v)
|
|
|
|
|
(makunbound v)
|
|
|
|
|
(set (make-local-variable (car v)) (cdr v)))
|
2017-11-23 13:35:15 -05:00
|
|
|
|
(setting-constant nil))) ;E.g. for enable-multibyte-characters.
|
2007-09-25 11:13:24 +00:00
|
|
|
|
lvars)
|
1999-10-13 00:48:17 +00:00
|
|
|
|
|
2017-11-23 13:35:15 -05:00
|
|
|
|
(setq mark-ring (mapcar (lambda (mk) (copy-marker (marker-position mk)))
|
|
|
|
|
mark-ring))
|
|
|
|
|
|
1999-10-13 00:48:17 +00:00
|
|
|
|
;; Run any hooks (typically set up by the major mode
|
|
|
|
|
;; for cloning to work properly).
|
|
|
|
|
(run-hooks 'clone-buffer-hook))
|
2006-01-23 04:05:59 +00:00
|
|
|
|
(if display-flag
|
|
|
|
|
;; Presumably the current buffer is shown in the selected frame, so
|
|
|
|
|
;; we want to display the clone elsewhere.
|
|
|
|
|
(let ((same-window-regexps nil)
|
|
|
|
|
(same-window-buffer-names))
|
|
|
|
|
(pop-to-buffer new)))
|
1999-10-13 00:48:17 +00:00
|
|
|
|
new))
|
|
|
|
|
|
2000-04-17 15:24:58 +00:00
|
|
|
|
|
2000-04-19 20:40:46 +00:00
|
|
|
|
(defun clone-indirect-buffer (newname display-flag &optional norecord)
|
2000-04-17 15:24:58 +00:00
|
|
|
|
"Create an indirect buffer that is a twin copy of the current buffer.
|
|
|
|
|
|
2005-06-20 10:29:02 +00:00
|
|
|
|
Give the indirect buffer name NEWNAME. Interactively, read NEWNAME
|
2000-04-17 15:24:58 +00:00
|
|
|
|
from the minibuffer when invoked with a prefix arg. If NEWNAME is nil
|
|
|
|
|
or if not called with a prefix arg, NEWNAME defaults to the current
|
|
|
|
|
buffer's name. The name is modified by adding a `<N>' suffix to it
|
* simple.el (idle-update-delay, next-error-highlight)
(next-error-highlight-no-select, next-error-recenter, next-error-hook)
(minibuffer-history-case-insensitive-variables, kill-ring-max)
(kill-read-only-ok, backward-delete-char-untabify-method)
(kill-whole-line, mark-ring-max, global-mark-ring-max)
(set-mark-command-repeat-pop, next-line-add-newlines, track-eol)
(goal-column, line-move-ignore-invisible, fill-prefix)
(auto-fill-inhibit-regexp, blink-matching-paren)
(blink-matching-paren-on-screen, blink-matching-paren-distance)
(blink-matching-delay, blink-matching-paren-dont-ignore-comments)
(read-mail-command, mail-user-agent): Remove * in defcustom docstrings.
(minibuffer-history-isearch-wrap, transient-mark-mode)
(next-logical-line, auto-fill-mode, line-number-mode)
(column-number-mode, size-indication-mode, clone-indirect-buffer)
(normal-erase-is-backspace-mode): Doc fixes.
(current-kill, transient-mark-mode, toggle-truncate-lines)
(visible-mode): Reflow docstrings.
(minibuffer-local-shell-command-map, interprogram-paste-function):
Fix typos in docstrings.
2008-10-30 17:03:30 +00:00
|
|
|
|
or by incrementing the N in an existing suffix. Trying to clone a
|
|
|
|
|
buffer whose major mode symbol has a non-nil `no-clone-indirect'
|
|
|
|
|
property results in an error.
|
2000-04-17 15:24:58 +00:00
|
|
|
|
|
|
|
|
|
DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'.
|
2000-04-19 20:40:46 +00:00
|
|
|
|
This is always done when called interactively.
|
|
|
|
|
|
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
2005-07-20 22:29:53 +00:00
|
|
|
|
Optional third arg NORECORD non-nil means do not put this buffer at the
|
2014-09-21 18:09:40 -04:00
|
|
|
|
front of the list of recently selected ones.
|
|
|
|
|
|
|
|
|
|
Returns the newly created indirect buffer."
|
2001-11-13 02:09:59 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(progn
|
|
|
|
|
(if (get major-mode 'no-clone-indirect)
|
|
|
|
|
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
|
|
|
|
|
(list (if current-prefix-arg
|
2006-01-23 01:24:26 +00:00
|
|
|
|
(read-buffer "Name of indirect buffer: " (current-buffer)))
|
2001-11-13 02:09:59 +00:00
|
|
|
|
t)))
|
|
|
|
|
(if (get major-mode 'no-clone-indirect)
|
|
|
|
|
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
|
2000-04-17 15:24:58 +00:00
|
|
|
|
(setq newname (or newname (buffer-name)))
|
|
|
|
|
(if (string-match "<[0-9]+>\\'" newname)
|
|
|
|
|
(setq newname (substring newname 0 (match-beginning 0))))
|
|
|
|
|
(let* ((name (generate-new-buffer-name newname))
|
|
|
|
|
(buffer (make-indirect-buffer (current-buffer) name t)))
|
2008-02-12 02:25:10 +00:00
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(run-hooks 'clone-indirect-buffer-hook))
|
2000-04-17 15:24:58 +00:00
|
|
|
|
(when display-flag
|
2016-08-25 11:04:46 +02:00
|
|
|
|
(pop-to-buffer buffer nil norecord))
|
2000-04-17 15:24:58 +00:00
|
|
|
|
buffer))
|
|
|
|
|
|
|
|
|
|
|
2006-01-26 17:56:54 +00:00
|
|
|
|
(defun clone-indirect-buffer-other-window (newname display-flag &optional norecord)
|
|
|
|
|
"Like `clone-indirect-buffer' but display in another window."
|
2006-01-20 01:22:07 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(progn
|
|
|
|
|
(if (get major-mode 'no-clone-indirect)
|
|
|
|
|
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
|
|
|
|
|
(list (if current-prefix-arg
|
2006-01-23 01:24:26 +00:00
|
|
|
|
(read-buffer "Name of indirect buffer: " (current-buffer)))
|
2006-01-20 01:22:07 +00:00
|
|
|
|
t)))
|
2002-05-01 15:08:25 +00:00
|
|
|
|
(let ((pop-up-windows t))
|
2006-01-26 17:56:54 +00:00
|
|
|
|
(clone-indirect-buffer newname display-flag norecord)))
|
2000-04-19 20:40:46 +00:00
|
|
|
|
|
2002-04-27 23:16:18 +00:00
|
|
|
|
|
2000-12-14 13:36:59 +00:00
|
|
|
|
;;; Handling of Backspace and Delete keys.
|
|
|
|
|
|
2005-10-23 22:11:22 +00:00
|
|
|
|
(defcustom normal-erase-is-backspace 'maybe
|
2007-11-15 16:42:43 +00:00
|
|
|
|
"Set the default behavior of the Delete and Backspace keys.
|
2005-10-23 22:11:22 +00:00
|
|
|
|
|
|
|
|
|
If set to t, Delete key deletes forward and Backspace key deletes
|
|
|
|
|
backward.
|
|
|
|
|
|
|
|
|
|
If set to nil, both Delete and Backspace keys delete backward.
|
|
|
|
|
|
2015-11-17 15:28:50 -08:00
|
|
|
|
If set to `maybe' (which is the default), Emacs automatically
|
2007-11-15 16:42:43 +00:00
|
|
|
|
selects a behavior. On window systems, the behavior depends on
|
2005-10-23 22:11:22 +00:00
|
|
|
|
the keyboard used. If the keyboard has both a Backspace key and
|
|
|
|
|
a Delete key, and both are mapped to their usual meanings, the
|
|
|
|
|
option's default value is set to t, so that Backspace can be used
|
|
|
|
|
to delete backward, and Delete can be used to delete forward.
|
|
|
|
|
|
|
|
|
|
If not running under a window system, customizing this option
|
|
|
|
|
accomplishes a similar effect by mapping C-h, which is usually
|
|
|
|
|
generated by the Backspace key, to DEL, and by mapping DEL to C-d
|
|
|
|
|
via `keyboard-translate'. The former functionality of C-h is
|
|
|
|
|
available on the F1 key. You should probably not use this
|
|
|
|
|
setting if you don't have both Backspace, Delete and F1 keys.
|
2000-12-22 12:50:39 +00:00
|
|
|
|
|
|
|
|
|
Setting this variable with setq doesn't take effect. Programmatically,
|
2001-04-04 14:07:13 +00:00
|
|
|
|
call `normal-erase-is-backspace-mode' (which see) instead."
|
2005-10-23 22:11:22 +00:00
|
|
|
|
:type '(choice (const :tag "Off" nil)
|
|
|
|
|
(const :tag "Maybe" maybe)
|
|
|
|
|
(other :tag "On" t))
|
2000-12-14 13:36:59 +00:00
|
|
|
|
:group 'editing-basics
|
|
|
|
|
:version "21.1"
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
;; The fboundp is because of a problem with :set when
|
|
|
|
|
;; dumping Emacs. It doesn't really matter.
|
2001-04-04 14:07:13 +00:00
|
|
|
|
(if (fboundp 'normal-erase-is-backspace-mode)
|
|
|
|
|
(normal-erase-is-backspace-mode (or value 0))
|
2000-12-14 13:36:59 +00:00
|
|
|
|
(set-default symbol value))))
|
|
|
|
|
|
2005-10-23 22:11:22 +00:00
|
|
|
|
(defun normal-erase-is-backspace-setup-frame (&optional frame)
|
|
|
|
|
"Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
|
|
|
|
|
(unless frame (setq frame (selected-frame)))
|
|
|
|
|
(with-selected-frame frame
|
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
* lisp/termdev.el (terminal-parameter-alist, terminal-parameters, terminal-parameter-p)
(terminal-parameter, set-terminal-parameter, terminal-handle-delete-frame): Remove.
* src/term.c (Vring_bell_function, device_list, initial_device)
(next_device_id, ring_bell, update_begin, update_end)
(set_terminal_window, cursor_to, raw_cursor_to)
(clear_to_end, clear_frame, clear_end_of_line)
(write_glyphs, insert_glyphs, delete_glyphs, ins_del_lines)
(get_device, Fdisplay_name, create_device, delete_device)
(Fdelete_display, Fdisplay_live_p, Fdisplay_list)
Move to terminal.c.
(syms_of_term): Move their initialization to terminal.c.
* src/terminal.c: New file.
(device_list, next_device_id, initial_device, Vring_bell_function)
(ring_bell, update_begin, update_end, set_terminal_window)
(cursor_to, raw_cursor_to, clear_to_end, clear_frame)
(clear_end_of_line, write_glyphs, insert_glyphs, delete_glyphs)
(ins_del_lines, get_device, create_device, delete_device)
(Fdelete_display, Fdisplay_live_p, Fdisplay_list, Fdisplay_name): Move here.
(mark_devices, get_terminal_param, store_terminal_param)
(Fterminal_parameters, Fterminal_parameter)
(Fmodify_terminal_parameters, Fset_terminal_parameter)
(init_initial_device, delete_initial_device)
(syms_of_terminal): New functions.
* lisp/simple.el (normal-erase-is-backspace-setup-frame)
(normal-erase-is-backspace-mode): Rephrase things
without terminal-parameter-p.
* lisp/termdev.el (terminal-getenv, terminal-setenv)
(with-terminal-environment): Ditto.
* mac/makefile.MPW (EmacsObjects): Add terminal.c.x.
({Src}terminal.c.x): Add dependencies.
* src/Makefile.in (obj): Add terminal.o.
(terminal.o): Add dependencies.
[HAVE_CARBON]: Make terminal.o depend on macgui.h.
* src/alloc.c (mark_devices): Declare.
(Fgarbage_collect): Call `mark_devices'.
* src/dispextern.h (set_scroll_region, turn_off_insert)
(turn_off_highlight, background_highlight, clear_end_of_line_raw)
(tty_clear_end_of_line, tty_setup_colors, delete_tty): Remove.
(raw_cursor_to, clear_to_end, tty_turn_off_insert)
(tty_turn_off_highlight): Add declaration.
* src/emacs.c (main): Call `syms_of_terminal'.
* src/frame.c (get_future_frame_param): New function.
(Fmake_terminal_frame): Use it.
* src/keyboard.c (pop_kboard): Remove unused variable.
(Fset_output_flow_control): Return nil.
* src/keymap.h (Fset_keymap_parent): Add EXFUN.
* src/lisp.h (syms_of_terminal): Declare it.
* src/sysdep.c (reset_sys_modes): Update for renames.
* src/term.c (set_scroll_region): Rename to `tty_set_scroll_region'.
(turn_on_insert): Rename to `tty_turn_on_insert'.
(turn_off_insert): Rename to `tty_turn_off_insert'.
(turn_off_highlight): Rename to `tty_turn_off_highlight'.
(turn_on_highlight): Rename to `tty_turn_on_highlight'.
(toggle_highligh): Rename to `tty_toggle_highlight'.
(background_highlight): Rename to `tty_background_highlight'.
(highlight_if_desired): Rename to `tty_highlight_if_desired'.
(tty_ring_bell, tty_update_end, tty_set_terminal_window)
(tty_set_scroll_region, tty_background_highlight)
(tty_cursor_to, tty_raw_cursor_to, tty_clear_to_end)
(tty_clear_frame, tty_clear_end_of_line, tty_write_glyphs)
(tty_insert_glyphs, tty_delete_glyphs, tty_ins_del_lines)
(term_get_fkeys, tty_setup_colors, dissociate_if_controlling_tty)
(delete_tty): Add static modifier.
(tty_reset_terminal_modes, tty_set_terminal_window)
(tty_set_scroll_region, tty_background_highlight)
(tty_highlight_if_desired, tty_cursor_to)
(tty_raw_cursor_to, tty_clear_to_end, tty_clear_frame)
(tty_clear_end_of_line, tty_write_glyphs, tty_insert_glyphs)
(tty_delete_glyphs, tty_ins_del_lines, turn_on_face):
Update for renames.
* src/termhooks.h (param_alist): New member to struct device.
* src/xterm.h (x_delete_device): Declare.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-460
2005-12-25 20:06:58 +00:00
|
|
|
|
(unless (terminal-parameter nil 'normal-erase-is-backspace)
|
2007-09-07 19:49:17 +00:00
|
|
|
|
(normal-erase-is-backspace-mode
|
|
|
|
|
(if (if (eq normal-erase-is-backspace 'maybe)
|
|
|
|
|
(and (not noninteractive)
|
|
|
|
|
(or (memq system-type '(ms-dos windows-nt))
|
2012-09-17 03:55:02 -08:00
|
|
|
|
(memq window-system '(w32 ns))
|
2007-09-07 19:49:17 +00:00
|
|
|
|
(and (memq window-system '(x))
|
|
|
|
|
(fboundp 'x-backspace-delete-keys-p)
|
|
|
|
|
(x-backspace-delete-keys-p))
|
|
|
|
|
;; If the terminal Emacs is running on has erase char
|
|
|
|
|
;; set to ^H, use the Backspace key for deleting
|
|
|
|
|
;; backward, and the Delete key for deleting forward.
|
|
|
|
|
(and (null window-system)
|
|
|
|
|
(eq tty-erase-char ?\^H))))
|
|
|
|
|
normal-erase-is-backspace)
|
|
|
|
|
1 0)))))
|
2000-12-14 13:36:59 +00:00
|
|
|
|
|
2010-05-04 23:45:21 -04:00
|
|
|
|
(define-minor-mode normal-erase-is-backspace-mode
|
2001-04-04 14:07:13 +00:00
|
|
|
|
"Toggle the Erase and Delete mode of the Backspace and Delete keys.
|
|
|
|
|
|
2005-10-23 22:11:22 +00:00
|
|
|
|
On window systems, when this mode is on, Delete is mapped to C-d
|
|
|
|
|
and Backspace is mapped to DEL; when this mode is off, both
|
|
|
|
|
Delete and Backspace are mapped to DEL. (The remapping goes via
|
|
|
|
|
`local-function-key-map', so binding Delete or Backspace in the
|
|
|
|
|
global or local keymap will override that.)
|
2001-04-04 14:07:13 +00:00
|
|
|
|
|
|
|
|
|
In addition, on window systems, the bindings of C-Delete, M-Delete,
|
|
|
|
|
C-M-Delete, C-Backspace, M-Backspace, and C-M-Backspace are changed in
|
|
|
|
|
the global keymap in accordance with the functionality of Delete and
|
|
|
|
|
Backspace. For example, if Delete is remapped to C-d, which deletes
|
|
|
|
|
forward, C-Delete is bound to `kill-word', but if Delete is remapped
|
|
|
|
|
to DEL, which deletes backward, C-Delete is bound to
|
|
|
|
|
`backward-kill-word'.
|
|
|
|
|
|
|
|
|
|
If not running on a window system, a similar effect is accomplished by
|
|
|
|
|
remapping C-h (normally produced by the Backspace key) and DEL via
|
|
|
|
|
`keyboard-translate': if this mode is on, C-h is mapped to DEL and DEL
|
|
|
|
|
to C-d; if it's off, the keys are not remapped.
|
|
|
|
|
|
|
|
|
|
When not running on a window system, and this mode is turned on, the
|
|
|
|
|
former functionality of C-h is available on the F1 key. You should
|
|
|
|
|
probably not turn on this mode on a text-only terminal if you don't
|
|
|
|
|
have both Backspace, Delete and F1 keys.
|
|
|
|
|
|
|
|
|
|
See also `normal-erase-is-backspace'."
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 09:42:38 -04:00
|
|
|
|
:variable ((eq (terminal-parameter nil 'normal-erase-is-backspace) 1)
|
|
|
|
|
. (lambda (v)
|
|
|
|
|
(setf (terminal-parameter nil 'normal-erase-is-backspace)
|
|
|
|
|
(if v 1 0))))
|
2010-05-04 23:45:21 -04:00
|
|
|
|
(let ((enabled (eq 1 (terminal-parameter
|
|
|
|
|
nil 'normal-erase-is-backspace))))
|
2006-01-03 01:22:02 +00:00
|
|
|
|
|
2008-07-27 18:24:48 +00:00
|
|
|
|
(cond ((or (memq window-system '(x w32 ns pc))
|
2006-01-03 01:22:02 +00:00
|
|
|
|
(memq system-type '(ms-dos windows-nt)))
|
2011-04-19 15:44:55 +02:00
|
|
|
|
(let ((bindings
|
2018-11-05 01:22:15 +01:00
|
|
|
|
'(([M-delete] [M-backspace])
|
2011-04-19 15:44:55 +02:00
|
|
|
|
([C-M-delete] [C-M-backspace])
|
|
|
|
|
([?\e C-delete] [?\e C-backspace]))))
|
2006-01-03 01:22:02 +00:00
|
|
|
|
|
|
|
|
|
(if enabled
|
|
|
|
|
(progn
|
2010-10-19 11:43:27 -04:00
|
|
|
|
(define-key local-function-key-map [delete] [deletechar])
|
2013-12-11 09:22:26 -05:00
|
|
|
|
(define-key local-function-key-map [kp-delete] [deletechar])
|
2009-10-22 19:31:43 +00:00
|
|
|
|
(define-key local-function-key-map [backspace] [?\C-?])
|
|
|
|
|
(dolist (b bindings)
|
|
|
|
|
;; Not sure if input-decode-map is really right, but
|
|
|
|
|
;; keyboard-translate-table (used below) only works
|
|
|
|
|
;; for integer events, and key-translation-table is
|
|
|
|
|
;; global (like the global-map, used earlier).
|
|
|
|
|
(define-key input-decode-map (car b) nil)
|
|
|
|
|
(define-key input-decode-map (cadr b) nil)))
|
2006-01-03 01:22:02 +00:00
|
|
|
|
(define-key local-function-key-map [delete] [?\C-?])
|
|
|
|
|
(define-key local-function-key-map [kp-delete] [?\C-?])
|
2009-10-22 19:31:43 +00:00
|
|
|
|
(define-key local-function-key-map [backspace] [?\C-?])
|
|
|
|
|
(dolist (b bindings)
|
|
|
|
|
(define-key input-decode-map (car b) (cadr b))
|
|
|
|
|
(define-key input-decode-map (cadr b) (car b))))))
|
2006-01-03 01:22:02 +00:00
|
|
|
|
(t
|
|
|
|
|
(if enabled
|
2001-01-16 20:25:23 +00:00
|
|
|
|
(progn
|
2006-01-03 01:22:02 +00:00
|
|
|
|
(keyboard-translate ?\C-h ?\C-?)
|
|
|
|
|
(keyboard-translate ?\C-? ?\C-d))
|
|
|
|
|
(keyboard-translate ?\C-h ?\C-h)
|
|
|
|
|
(keyboard-translate ?\C-? ?\C-?))))
|
|
|
|
|
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2006-01-03 01:22:02 +00:00
|
|
|
|
(message "Delete key deletes %s"
|
2009-12-01 18:06:06 +00:00
|
|
|
|
(if (eq 1 (terminal-parameter nil 'normal-erase-is-backspace))
|
2006-01-03 01:22:02 +00:00
|
|
|
|
"forward" "backward")))))
|
2003-05-25 01:45:14 +00:00
|
|
|
|
|
2003-06-17 18:40:06 +00:00
|
|
|
|
(defvar vis-mode-saved-buffer-invisibility-spec nil
|
2003-07-07 21:00:26 +00:00
|
|
|
|
"Saved value of `buffer-invisibility-spec' when Visible mode is on.")
|
2001-04-04 14:07:13 +00:00
|
|
|
|
|
2012-08-29 13:36:49 -04:00
|
|
|
|
(define-minor-mode read-only-mode
|
|
|
|
|
"Change whether the current buffer is read-only.
|
2018-07-01 23:34:53 -04:00
|
|
|
|
|
|
|
|
|
If buffer is read-only and `view-read-only' is non-nil, enter
|
|
|
|
|
view mode.
|
2012-08-29 13:36:49 -04:00
|
|
|
|
|
|
|
|
|
Do not call this from a Lisp program unless you really intend to
|
2012-09-22 23:46:57 +08:00
|
|
|
|
do the same thing as the \\[read-only-mode] command, including
|
2012-08-29 13:36:49 -04:00
|
|
|
|
possibly enabling or disabling View mode. Also, note that this
|
|
|
|
|
command works by setting the variable `buffer-read-only', which
|
|
|
|
|
does not affect read-only regions caused by text properties. To
|
|
|
|
|
ignore read-only status in a Lisp program (whether due to text
|
|
|
|
|
properties or buffer state), bind `inhibit-read-only' temporarily
|
|
|
|
|
to a non-nil value."
|
|
|
|
|
:variable buffer-read-only
|
|
|
|
|
(cond
|
|
|
|
|
((and (not buffer-read-only) view-mode)
|
|
|
|
|
(View-exit-and-edit)
|
|
|
|
|
(make-local-variable 'view-read-only)
|
|
|
|
|
(setq view-read-only t)) ; Must leave view mode.
|
|
|
|
|
((and buffer-read-only view-read-only
|
|
|
|
|
;; If view-mode is already active, `view-mode-enter' is a nop.
|
|
|
|
|
(not view-mode)
|
|
|
|
|
(not (eq (get major-mode 'mode-class) 'special)))
|
|
|
|
|
(view-mode-enter))))
|
|
|
|
|
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(define-minor-mode visible-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
"Toggle making all invisible text temporarily visible (Visible mode).
|
2000-12-14 13:36:59 +00:00
|
|
|
|
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
|
|
|
|
This mode works by saving the value of `buffer-invisibility-spec'
|
|
|
|
|
and setting it to nil."
|
2003-06-17 02:35:46 +00:00
|
|
|
|
:lighter " Vis"
|
2005-04-02 19:24:26 +00:00
|
|
|
|
:group 'editing-basics
|
2003-06-17 18:40:06 +00:00
|
|
|
|
(when (local-variable-p 'vis-mode-saved-buffer-invisibility-spec)
|
|
|
|
|
(setq buffer-invisibility-spec vis-mode-saved-buffer-invisibility-spec)
|
|
|
|
|
(kill-local-variable 'vis-mode-saved-buffer-invisibility-spec))
|
2003-07-07 21:00:26 +00:00
|
|
|
|
(when visible-mode
|
2003-06-17 18:40:06 +00:00
|
|
|
|
(set (make-local-variable 'vis-mode-saved-buffer-invisibility-spec)
|
|
|
|
|
buffer-invisibility-spec)
|
|
|
|
|
(setq buffer-invisibility-spec nil)))
|
2003-06-17 02:35:46 +00:00
|
|
|
|
|
2013-09-17 16:27:10 -04:00
|
|
|
|
(defvar messages-buffer-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(set-keymap-parent map special-mode-map)
|
|
|
|
|
(define-key map "g" nil) ; nothing to revert
|
|
|
|
|
map))
|
|
|
|
|
|
2013-09-17 00:39:54 -07:00
|
|
|
|
(define-derived-mode messages-buffer-mode special-mode "Messages"
|
|
|
|
|
"Major mode used in the \"*Messages*\" buffer.")
|
|
|
|
|
|
|
|
|
|
(defun messages-buffer ()
|
|
|
|
|
"Return the \"*Messages*\" buffer.
|
|
|
|
|
If it does not exist, create and it switch it to `messages-buffer-mode'."
|
|
|
|
|
(or (get-buffer "*Messages*")
|
|
|
|
|
(with-current-buffer (get-buffer-create "*Messages*")
|
|
|
|
|
(messages-buffer-mode)
|
|
|
|
|
(current-buffer))))
|
|
|
|
|
|
|
|
|
|
|
2001-10-31 00:57:04 +00:00
|
|
|
|
;; Minibuffer prompt stuff.
|
2001-09-13 10:02:35 +00:00
|
|
|
|
|
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let.
(eval-after-load): Obey lexical-binding.
* lisp/simple.el (apply-partially): Move to subr.el.
* lisp/makefile.w32-in: Match changes in Makefile.in.
(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
(COMPILE_FIRST): Add pcase, macroexp, and cconv.
* lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
calling CL's `compiler-macroexpand'.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
(byte-compile-initial-macro-environment)
(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it.
(byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding.
(byte-compile--for-effect): Rename from `for-effect'.
(display-call-tree): Use case.
* lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
(byte-optimize-form-code-walker, byte-optimize-form):
Revert to old arg name.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var.
(compile-onefile, .el.elc, compile-calc, recompile): Use it.
2011-03-11 22:32:43 -05:00
|
|
|
|
;;(defun minibuffer-prompt-modification (start end)
|
|
|
|
|
;; (error "You cannot modify the prompt"))
|
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;;(defun minibuffer-prompt-insertion (start end)
|
|
|
|
|
;; (let ((inhibit-modification-hooks t))
|
|
|
|
|
;; (delete-region start end)
|
|
|
|
|
;; ;; Discard undo information for the text insertion itself
|
|
|
|
|
;; ;; and for the text deletion.above.
|
|
|
|
|
;; (when (consp buffer-undo-list)
|
|
|
|
|
;; (setq buffer-undo-list (cddr buffer-undo-list)))
|
|
|
|
|
;; (message "You cannot modify the prompt")))
|
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;;(setq minibuffer-prompt-properties
|
|
|
|
|
;; (list 'modification-hooks '(minibuffer-prompt-modification)
|
|
|
|
|
;; 'insert-in-front-hooks '(minibuffer-prompt-insertion)))
|
2001-09-13 10:02:35 +00:00
|
|
|
|
|
2007-08-14 07:41:59 +00:00
|
|
|
|
|
|
|
|
|
;;;; Problematic external packages.
|
|
|
|
|
|
|
|
|
|
;; rms says this should be done by specifying symbols that define
|
|
|
|
|
;; versions together with bad values. This is therefore not as
|
|
|
|
|
;; flexible as it could be. See the thread:
|
2017-11-25 22:45:41 -08:00
|
|
|
|
;; https://lists.gnu.org/r/emacs-devel/2007-08/msg00300.html
|
2007-08-14 07:41:59 +00:00
|
|
|
|
(defconst bad-packages-alist
|
|
|
|
|
;; Not sure exactly which semantic versions have problems.
|
|
|
|
|
;; Definitely 2.0pre3, probably all 2.0pre's before this.
|
2007-11-03 03:08:29 +00:00
|
|
|
|
'((semantic semantic-version "\\`2\\.0pre[1-3]\\'"
|
2007-08-14 07:41:59 +00:00
|
|
|
|
"The version of `semantic' loaded does not work in Emacs 22.
|
2007-10-07 00:31:20 +00:00
|
|
|
|
It can cause constant high CPU load.
|
|
|
|
|
Upgrade to at least Semantic 2.0pre4 (distributed with CEDET 1.0pre4).")
|
2007-08-14 07:41:59 +00:00
|
|
|
|
;; CUA-mode does not work with GNU Emacs version 22.1 and newer.
|
|
|
|
|
;; Except for version 1.2, all of the 1.x and 2.x version of cua-mode
|
|
|
|
|
;; provided the `CUA-mode' feature. Since this is no longer true,
|
|
|
|
|
;; we can warn the user if the `CUA-mode' feature is ever provided.
|
|
|
|
|
(CUA-mode t nil
|
|
|
|
|
"CUA-mode is now part of the standard GNU Emacs distribution,
|
|
|
|
|
so you can now enable CUA via the Options menu or by customizing `cua-mode'.
|
|
|
|
|
|
|
|
|
|
You have loaded an older version of CUA-mode which does not work
|
|
|
|
|
correctly with this version of Emacs. You should remove the old
|
|
|
|
|
version and use the one distributed with Emacs."))
|
|
|
|
|
"Alist of packages known to cause problems in this version of Emacs.
|
|
|
|
|
Each element has the form (PACKAGE SYMBOL REGEXP STRING).
|
|
|
|
|
PACKAGE is either a regular expression to match file names, or a
|
2013-06-13 18:24:52 -04:00
|
|
|
|
symbol (a feature name), like for `with-eval-after-load'.
|
2015-05-21 10:04:45 -07:00
|
|
|
|
SYMBOL is either the name of a string variable, or t. Upon
|
2007-08-14 07:41:59 +00:00
|
|
|
|
loading PACKAGE, if SYMBOL is t or matches REGEXP, display a
|
|
|
|
|
warning using STRING as the message.")
|
|
|
|
|
|
|
|
|
|
(defun bad-package-check (package)
|
|
|
|
|
"Run a check using the element from `bad-packages-alist' matching PACKAGE."
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(let* ((list (assoc package bad-packages-alist))
|
|
|
|
|
(symbol (nth 1 list)))
|
|
|
|
|
(and list
|
|
|
|
|
(boundp symbol)
|
|
|
|
|
(or (eq symbol t)
|
|
|
|
|
(and (stringp (setq symbol (eval symbol)))
|
2008-12-15 12:52:16 +00:00
|
|
|
|
(string-match-p (nth 2 list) symbol)))
|
|
|
|
|
(display-warning package (nth 3 list) :warning)))
|
2007-08-14 07:41:59 +00:00
|
|
|
|
(error nil)))
|
|
|
|
|
|
2013-06-13 18:24:52 -04:00
|
|
|
|
(dolist (elem bad-packages-alist)
|
|
|
|
|
(let ((pkg (car elem)))
|
|
|
|
|
(with-eval-after-load pkg
|
|
|
|
|
(bad-package-check pkg))))
|
2007-08-14 07:41:59 +00:00
|
|
|
|
|
2013-07-06 11:35:37 +02:00
|
|
|
|
|
|
|
|
|
;;; Generic dispatcher commands
|
|
|
|
|
|
2013-07-15 02:49:22 +02:00
|
|
|
|
;; Macro `define-alternatives' is used to create generic commands.
|
2013-07-06 11:35:37 +02:00
|
|
|
|
;; Generic commands are these (like web, mail, news, encrypt, irc, etc.)
|
|
|
|
|
;; that can have different alternative implementations where choosing
|
|
|
|
|
;; among them is exclusively a matter of user preference.
|
|
|
|
|
|
2013-07-15 02:49:22 +02:00
|
|
|
|
;; (define-alternatives COMMAND) creates a new interactive command
|
2013-07-06 11:35:37 +02:00
|
|
|
|
;; M-x COMMAND and a customizable variable COMMAND-alternatives.
|
|
|
|
|
;; Typically, the user will not need to customize this variable; packages
|
|
|
|
|
;; wanting to add alternative implementations should use
|
|
|
|
|
;;
|
|
|
|
|
;; ;;;###autoload (push '("My impl name" . my-impl-symbol) COMMAND-alternatives
|
|
|
|
|
|
2013-07-15 02:49:22 +02:00
|
|
|
|
(defmacro define-alternatives (command &rest customizations)
|
2014-01-13 23:13:44 +01:00
|
|
|
|
"Define the new command `COMMAND'.
|
|
|
|
|
|
|
|
|
|
The argument `COMMAND' should be a symbol.
|
|
|
|
|
|
|
|
|
|
Running `M-x COMMAND RET' for the first time prompts for which
|
2014-01-13 23:24:29 +01:00
|
|
|
|
alternative to use and records the selected command as a custom
|
2014-01-13 23:13:44 +01:00
|
|
|
|
variable.
|
|
|
|
|
|
2014-01-13 23:24:29 +01:00
|
|
|
|
Running `C-u M-x COMMAND RET' prompts again for an alternative
|
|
|
|
|
and overwrites the previous choice.
|
2014-01-13 23:13:44 +01:00
|
|
|
|
|
|
|
|
|
The variable `COMMAND-alternatives' contains an alist with
|
2014-01-17 15:58:34 +01:00
|
|
|
|
alternative implementations of COMMAND. `define-alternatives'
|
|
|
|
|
does not have any effect until this variable is set.
|
2014-01-13 23:13:44 +01:00
|
|
|
|
|
2013-07-06 11:35:37 +02:00
|
|
|
|
CUSTOMIZATIONS, if non-nil, should be composed of alternating
|
|
|
|
|
`defcustom' keywords and values to add to the declaration of
|
2013-07-06 15:31:59 +02:00
|
|
|
|
`COMMAND-alternatives' (typically :group and :version)."
|
2013-07-06 11:35:37 +02:00
|
|
|
|
(let* ((command-name (symbol-name command))
|
|
|
|
|
(varalt-name (concat command-name "-alternatives"))
|
|
|
|
|
(varalt-sym (intern varalt-name))
|
|
|
|
|
(varimp-sym (intern (concat command-name "--implementation"))))
|
|
|
|
|
`(progn
|
|
|
|
|
|
|
|
|
|
(defcustom ,varalt-sym nil
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
,(format "Alist of alternative implementations for the `%s' command.
|
2013-07-06 11:35:37 +02:00
|
|
|
|
|
|
|
|
|
Each entry must be a pair (ALTNAME . ALTFUN), where:
|
|
|
|
|
ALTNAME - The name shown at user to describe the alternative implementation.
|
|
|
|
|
ALTFUN - The function called to implement this alternative."
|
|
|
|
|
command-name)
|
|
|
|
|
:type '(alist :key-type string :value-type function)
|
|
|
|
|
,@customizations)
|
|
|
|
|
|
2014-01-14 23:30:42 +01:00
|
|
|
|
(put ',varalt-sym 'definition-name ',command)
|
2013-07-06 11:35:37 +02:00
|
|
|
|
(defvar ,varimp-sym nil "Internal use only.")
|
|
|
|
|
|
|
|
|
|
(defun ,command (&optional arg)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
,(format "Run generic command `%s'.
|
2013-07-06 11:35:37 +02:00
|
|
|
|
If used for the first time, or with interactive ARG, ask the user which
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
implementation to use for `%s'. The variable `%s'
|
2013-07-06 11:35:37 +02:00
|
|
|
|
contains the list of implementations currently supported for this command."
|
|
|
|
|
command-name command-name varalt-name)
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(when (or arg (null ,varimp-sym))
|
|
|
|
|
(let ((val (completing-read
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
,(format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"Select implementation for command `%s': "
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
command-name)
|
2014-01-13 23:13:44 +01:00
|
|
|
|
,varalt-sym nil t)))
|
2013-07-06 11:35:37 +02:00
|
|
|
|
(unless (string-equal val "")
|
2014-01-13 23:13:44 +01:00
|
|
|
|
(when (null ,varimp-sym)
|
|
|
|
|
(message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"Use C-u M-x %s RET`to select another implementation"
|
2014-01-13 23:13:44 +01:00
|
|
|
|
,command-name)
|
|
|
|
|
(sit-for 3))
|
|
|
|
|
(customize-save-variable ',varimp-sym
|
|
|
|
|
(cdr (assoc-string val ,varalt-sym))))))
|
2013-07-06 11:35:37 +02:00
|
|
|
|
(if ,varimp-sym
|
2014-01-13 23:13:44 +01:00
|
|
|
|
(call-interactively ,varimp-sym)
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
(message "%s" ,(format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 08:41:44 -07:00
|
|
|
|
"No implementation selected for command `%s'"
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:38:02 -07:00
|
|
|
|
command-name)))))))
|
2013-07-06 11:35:37 +02:00
|
|
|
|
|
2015-09-26 11:09:19 +03:00
|
|
|
|
|
|
|
|
|
;;; Functions for changing capitalization that Do What I Mean
|
|
|
|
|
(defun upcase-dwim (arg)
|
|
|
|
|
"Upcase words in the region, if active; if not, upcase word at point.
|
|
|
|
|
If the region is active, this function calls `upcase-region'.
|
|
|
|
|
Otherwise, it calls `upcase-word', with prefix argument passed to it
|
|
|
|
|
to upcase ARG words."
|
|
|
|
|
(interactive "*p")
|
|
|
|
|
(if (use-region-p)
|
2018-01-28 23:48:11 +02:00
|
|
|
|
(upcase-region (region-beginning) (region-end) (region-noncontiguous-p))
|
2015-09-26 11:09:19 +03:00
|
|
|
|
(upcase-word arg)))
|
|
|
|
|
|
|
|
|
|
(defun downcase-dwim (arg)
|
|
|
|
|
"Downcase words in the region, if active; if not, downcase word at point.
|
|
|
|
|
If the region is active, this function calls `downcase-region'.
|
|
|
|
|
Otherwise, it calls `downcase-word', with prefix argument passed to it
|
|
|
|
|
to downcase ARG words."
|
|
|
|
|
(interactive "*p")
|
|
|
|
|
(if (use-region-p)
|
2018-01-28 23:48:11 +02:00
|
|
|
|
(downcase-region (region-beginning) (region-end) (region-noncontiguous-p))
|
2015-09-26 11:09:19 +03:00
|
|
|
|
(downcase-word arg)))
|
|
|
|
|
|
|
|
|
|
(defun capitalize-dwim (arg)
|
|
|
|
|
"Capitalize words in the region, if active; if not, capitalize word at point.
|
|
|
|
|
If the region is active, this function calls `capitalize-region'.
|
|
|
|
|
Otherwise, it calls `capitalize-word', with prefix argument passed to it
|
|
|
|
|
to capitalize ARG words."
|
|
|
|
|
(interactive "*p")
|
|
|
|
|
(if (use-region-p)
|
|
|
|
|
(capitalize-region (region-beginning) (region-end))
|
|
|
|
|
(capitalize-word arg)))
|
|
|
|
|
|
2014-02-06 19:22:34 -08:00
|
|
|
|
|
|
|
|
|
|
2002-09-13 13:56:41 +00:00
|
|
|
|
(provide 'simple)
|
2004-04-16 12:51:06 +00:00
|
|
|
|
|
1992-05-30 21:11:25 +00:00
|
|
|
|
;;; simple.el ends here
|