aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/cursor-sensor.el26
-rw-r--r--lisp/simple.el22
2 files changed, 37 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el
index 7e3088dd91e..21c48f830f2 100644
--- a/lisp/emacs-lisp/cursor-sensor.el
+++ b/lisp/emacs-lisp/cursor-sensor.el
@@ -22,17 +22,29 @@
22 22
23;;; Commentary: 23;;; Commentary:
24 24
25;; This package implements the `cursor-intangible' property, which is 25;; This package implements the `cursor-intangible' and
26;; meant to replace the old `intangible' property. To use it, just enable the 26;; `cursor-sensor-functions' properties, which are meant to replace
27;; `cursor-intangible-mode', after which this package will move point away from 27;; the old `intangible', `point-entered', and `point-left' properties.
28;; any position that has a non-nil `cursor-intangible' property. This is only 28
29;; done just before redisplay happens, contrary to the old `intangible' 29;; To use `cursor-intangible', just enable the
30;; property which was done at a much lower level. 30;; `cursor-intangible-mode' minor mode, after which this package will
31;; move point away from any position that has a non-nil
32;; `cursor-intangible' property. This is only done just before
33;; redisplay happens, contrary to the old `intangible' property which
34;; was done at a much lower level.
35
36;; To use `cursor-sensor-functions', enable the `cursor-sensor-mode'
37;; minor mode, after which the `cursor-sensor-functions' will be
38;; called just before redisplay happens, according to the movement of
39;; the cursor since the last redisplay.
31 40
32;;; Code: 41;;; Code:
33 42
34;;;###autoload 43;;;###autoload
35(defvar cursor-sensor-inhibit nil) 44(defvar cursor-sensor-inhibit nil
45 "When non-nil, suspend `cursor-sensor-mode' and `cursor-intangible-mode'.
46By convention, this is a list of symbols where each symbol stands for the
47\"cause\" of the suspension.")
36 48
37(defun cursor-sensor--intangible-p (pos) 49(defun cursor-sensor--intangible-p (pos)
38 (let ((p (get-pos-property pos 'cursor-intangible))) 50 (let ((p (get-pos-property pos 'cursor-intangible)))
diff --git a/lisp/simple.el b/lisp/simple.el
index db59b9f5bc3..6eb56b73c09 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2172,7 +2172,11 @@ next element of the minibuffer history in the minibuffer."
2172 (prompt-end (minibuffer-prompt-end)) 2172 (prompt-end (minibuffer-prompt-end))
2173 (old-column (unless (and (eolp) (> (point) prompt-end)) 2173 (old-column (unless (and (eolp) (> (point) prompt-end))
2174 (if (= (line-number-at-pos) 1) 2174 (if (= (line-number-at-pos) 1)
2175 (max (- (current-column) (1- prompt-end)) 0) 2175 (max (- (current-column)
2176 (save-excursion
2177 (goto-char (1- prompt-end))
2178 (current-column)))
2179 0)
2176 (current-column))))) 2180 (current-column)))))
2177 (condition-case nil 2181 (condition-case nil
2178 (with-no-warnings 2182 (with-no-warnings
@@ -2191,7 +2195,10 @@ next element of the minibuffer history in the minibuffer."
2191 (goto-char (point-max)) 2195 (goto-char (point-max))
2192 (when old-column 2196 (when old-column
2193 (if (= (line-number-at-pos) 1) 2197 (if (= (line-number-at-pos) 1)
2194 (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) 2198 (move-to-column (+ old-column
2199 (save-excursion
2200 (goto-char (1- (minibuffer-prompt-end)))
2201 (current-column))))
2195 (move-to-column old-column))))))) 2202 (move-to-column old-column)))))))
2196 2203
2197(defun previous-line-or-history-element (&optional arg) 2204(defun previous-line-or-history-element (&optional arg)
@@ -2206,7 +2213,11 @@ previous element of the minibuffer history in the minibuffer."
2206 (prompt-end (minibuffer-prompt-end)) 2213 (prompt-end (minibuffer-prompt-end))
2207 (old-column (unless (and (eolp) (> (point) prompt-end)) 2214 (old-column (unless (and (eolp) (> (point) prompt-end))
2208 (if (= (line-number-at-pos) 1) 2215 (if (= (line-number-at-pos) 1)
2209 (max (- (current-column) (1- prompt-end)) 0) 2216 (max (- (current-column)
2217 (save-excursion
2218 (goto-char (1- prompt-end))
2219 (current-column)))
2220 0)
2210 (current-column))))) 2221 (current-column)))))
2211 (condition-case nil 2222 (condition-case nil
2212 (with-no-warnings 2223 (with-no-warnings
@@ -2225,7 +2236,10 @@ previous element of the minibuffer history in the minibuffer."
2225 (goto-char (minibuffer-prompt-end)) 2236 (goto-char (minibuffer-prompt-end))
2226 (if old-column 2237 (if old-column
2227 (if (= (line-number-at-pos) 1) 2238 (if (= (line-number-at-pos) 1)
2228 (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) 2239 (move-to-column (+ old-column
2240 (save-excursion
2241 (goto-char (1- (minibuffer-prompt-end)))
2242 (current-column))))
2229 (move-to-column old-column)) 2243 (move-to-column old-column))
2230 ;; Put the cursor at the end of the visual line instead of the 2244 ;; Put the cursor at the end of the visual line instead of the
2231 ;; logical line, so the next `previous-line-or-history-element' 2245 ;; logical line, so the next `previous-line-or-history-element'