diff options
| author | Glenn Morris | 2018-12-10 09:43:05 -0800 |
|---|---|---|
| committer | Glenn Morris | 2018-12-10 09:43:05 -0800 |
| commit | e60fc320e3cf72327544d17db2542f56ab042e5a (patch) | |
| tree | a86980b6e98691d78f96702a8804f4162e4aa9f0 | |
| parent | 63838449521ca1abf5acb2c1b8ab59841a4b2727 (diff) | |
| parent | 5a7451c383be5e6be52c986a9392ff551e656f6a (diff) | |
| download | emacs-e60fc320e3cf72327544d17db2542f56ab042e5a.tar.gz emacs-e60fc320e3cf72327544d17db2542f56ab042e5a.zip | |
Merge from origin/emacs-26
5a7451c CC Mode: stop wrongly recognizing "func(a * 9)" as "pointer t...
b0ed9d1 * lisp/emacs-lisp/cursor-sensor.el: Add motivation
| -rw-r--r-- | lisp/emacs-lisp/cursor-sensor.el | 21 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 8 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el index 21c48f830f2..6c33d04dedd 100644 --- a/lisp/emacs-lisp/cursor-sensor.el +++ b/lisp/emacs-lisp/cursor-sensor.el | |||
| @@ -38,6 +38,27 @@ | |||
| 38 | ;; called just before redisplay happens, according to the movement of | 38 | ;; called just before redisplay happens, according to the movement of |
| 39 | ;; the cursor since the last redisplay. | 39 | ;; the cursor since the last redisplay. |
| 40 | 40 | ||
| 41 | ;;;; Motivation | ||
| 42 | |||
| 43 | ;; The old properties were very problematic in practice because they | ||
| 44 | ;; operate at a much lower level and hence affect all motion | ||
| 45 | ;; *functions* like goto-char, forward-char, ... hence breaking | ||
| 46 | ;; invariants like: | ||
| 47 | ;; | ||
| 48 | ;; (forward-char N) == (progn (forward-char N1) (forward-char (- N N1))) | ||
| 49 | ;; (point) == (progn (forward-char N) (forward-char -N) (point)) | ||
| 50 | ;; (+ N (point)) == (progn (forward-char N) (point)) | ||
| 51 | ;; | ||
| 52 | ;; The problems would usually show up due to interaction between | ||
| 53 | ;; unrelated code working in the same buffer, where one code used those | ||
| 54 | ;; properties and the other (unknowingly) assumed those aren't used. | ||
| 55 | ;; In practice a *lot* of code assumes there's no such funny business. | ||
| 56 | ;; | ||
| 57 | ;; Worse: all(?) packages using those properties don't actually want those | ||
| 58 | ;; properties to affect motion at such a low-level, they only want to | ||
| 59 | ;; affect the overall effect of commands, but not the effect of every | ||
| 60 | ;; single point-motion that a given command happened to use internally. | ||
| 61 | |||
| 41 | ;;; Code: | 62 | ;;; Code: |
| 42 | 63 | ||
| 43 | ;;;###autoload | 64 | ;;;###autoload |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 376d0bb3d3a..d71a8299cf6 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -8550,6 +8550,8 @@ comment at the start of cc-engine.el for more info." | |||
| 8550 | got-parens | 8550 | got-parens |
| 8551 | ;; True if there is an identifier in the declarator. | 8551 | ;; True if there is an identifier in the declarator. |
| 8552 | got-identifier | 8552 | got-identifier |
| 8553 | ;; True if we find a number where an identifier was expected. | ||
| 8554 | got-number | ||
| 8553 | ;; True if there's a non-close-paren match of | 8555 | ;; True if there's a non-close-paren match of |
| 8554 | ;; `c-type-decl-suffix-key'. | 8556 | ;; `c-type-decl-suffix-key'. |
| 8555 | got-suffix | 8557 | got-suffix |
| @@ -8627,7 +8629,9 @@ comment at the start of cc-engine.el for more info." | |||
| 8627 | (and (looking-at c-identifier-start) | 8629 | (and (looking-at c-identifier-start) |
| 8628 | (setq pos (point)) | 8630 | (setq pos (point)) |
| 8629 | (setq got-identifier (c-forward-name)) | 8631 | (setq got-identifier (c-forward-name)) |
| 8630 | (setq name-start pos))) | 8632 | (setq name-start pos)) |
| 8633 | (when (looking-at "[0-9]") | ||
| 8634 | (setq got-number t))) ; We've probably got an arithmetic expression. | ||
| 8631 | 8635 | ||
| 8632 | ;; Skip over type decl suffix operators and trailing noise macros. | 8636 | ;; Skip over type decl suffix operators and trailing noise macros. |
| 8633 | (while | 8637 | (while |
| @@ -9101,7 +9105,7 @@ comment at the start of cc-engine.el for more info." | |||
| 9101 | 9105 | ||
| 9102 | ;; CASE 18 | 9106 | ;; CASE 18 |
| 9103 | (when (and (not (memq context '(nil top))) | 9107 | (when (and (not (memq context '(nil top))) |
| 9104 | (or got-prefix | 9108 | (or (and got-prefix (not got-number)) |
| 9105 | (and (eq context 'decl) | 9109 | (and (eq context 'decl) |
| 9106 | (not c-recognize-paren-inits) | 9110 | (not c-recognize-paren-inits) |
| 9107 | (or got-parens got-suffix)))) | 9111 | (or got-parens got-suffix)))) |