summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-03-22 11:01:30 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-03-22 11:01:30 -0700
commit37b9099068c10383e959ee366a52a22516846163 (patch)
treef135528cdacc4313be84f7bf1ceade19327d5fe7 /lisp
parent6bd1e2203486ace170f5de15cf7d66146fc8cc87 (diff)
parent56df61712ac446d3dcd9c897f687cc74a04be314 (diff)
downloademacs-37b9099068c10383e959ee366a52a22516846163.tar.gz
-
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired-x.el7
-rw-r--r--lisp/emacs-lisp/smie.el5
-rw-r--r--lisp/forms.el9
-rw-r--r--lisp/gnus/mml-sec.el4
-rw-r--r--lisp/gnus/mml-smime.el4
-rw-r--r--lisp/gnus/mml1991.el5
-rw-r--r--lisp/gnus/mml2015.el5
-rw-r--r--lisp/international/characters.el90
-rw-r--r--lisp/international/fontset.el50
-rw-r--r--lisp/international/mule-cmds.el5
-rw-r--r--lisp/isearch.el19
-rw-r--r--lisp/loadup.el17
-rw-r--r--lisp/progmodes/cc-cmds.el245
-rw-r--r--lisp/progmodes/cc-defs.el23
-rw-r--r--lisp/progmodes/cc-engine.el200
-rw-r--r--lisp/progmodes/elisp-mode.el2
-rw-r--r--lisp/progmodes/ruby-mode.el49
-rw-r--r--lisp/xml.el2
18 files changed, 463 insertions, 278 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index e8cea85d988..be762e6e306 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -816,12 +816,11 @@ If in a Dired buffer, reverts it."
(interactive)
(if (file-exists-p dired-local-variables-file)
(error "Old-style dired-local-variables-file `./%s' found;
-replace it with a dir-locals-file `./%s.el'"
+replace it with a dir-locals-file `./%s'"
dired-local-variables-file
dir-locals-file))
- (if (dir-locals--all-files default-directory)
- (message "File `./%s' already exists."
- (car (dir-locals--all-files default-directory)))
+ (if (file-exists-p dir-locals-file)
+ (message "File `./%s' already exists." dir-locals-file)
(add-dir-local-variable 'dired-mode 'subdirs nil)
(add-dir-local-variable 'dired-mode 'dired-omit-mode t)
;; Run extra-hooks and revert directory.
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 495ba7cb859..1d8f0cb8f5d 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1493,7 +1493,10 @@ should not be computed on the basis of the following token."
(let ((endpos (point)))
(goto-char pos)
(forward-line 1)
- (and (equal res (smie-indent-forward-token))
+ ;; As seen in bug#22960, pos may be inside
+ ;; a string, and forward-token may then stumble.
+ (and (ignore-errors
+ (equal res (smie-indent-forward-token)))
(eq (point) endpos)))))
nil
(goto-char pos)
diff --git a/lisp/forms.el b/lisp/forms.el
index c141188788b..c0b48fd3b63 100644
--- a/lisp/forms.el
+++ b/lisp/forms.el
@@ -589,7 +589,14 @@ Commands: Equivalent keys in read-only mode:
(make-local-variable 'forms--dynamic-text)
;; Prevent accidental overwrite of the control file and auto-save.
- (set-visited-file-name nil)
+ ;; We bind change-major-mode-with-file-name to nil to prevent
+ ;; set-visited-file-name from calling set-auto-mode, which
+ ;; might kill all local variables and set forms-file nil,
+ ;; which will then barf in find-file-noselect below. This can
+ ;; hapen when the user sets the default major mode that is
+ ;; different from the Fundamental mode.
+ (let (change-major-mode-with-file-name)
+ (set-visited-file-name nil))
;; Prepare this buffer for further processing.
(setq buffer-read-only nil)
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index 576eceecf4b..0e2d4381993 100644
--- a/lisp/gnus/mml-sec.el
+++ b/lisp/gnus/mml-sec.el
@@ -38,6 +38,7 @@
(autoload 'mml1991-encrypt "mml1991")
(autoload 'message-fetch-field "message")
(autoload 'message-goto-body "message")
+(autoload 'message-options-get "message")
(autoload 'mml-insert-tag "mml")
(autoload 'mml-smime-sign "mml-smime")
(autoload 'mml-smime-encrypt "mml-smime")
@@ -49,6 +50,8 @@
(autoload 'message-options-get "message")
(autoload 'message-options-set "message")
+(declare-function message-options-set "message" (symbol value))
+
(defvar mml-sign-alist
'(("smime" mml-smime-sign-buffer mml-smime-sign-query)
("pgp" mml-pgp-sign-buffer list)
@@ -115,6 +118,7 @@ details."
:group 'message
:type 'boolean)
+;; FIXME If it's "NOT recommended", why is it the default?
(defcustom mml-secure-cache-passphrase password-cache
"If t, cache OpenPGP or S/MIME passphrases inside Emacs.
Passphrase caching in Emacs is NOT recommended. Use gpg-agent instead.
diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el
index e473a6d3ff3..b15accd631c 100644
--- a/lisp/gnus/mml-smime.el
+++ b/lisp/gnus/mml-smime.el
@@ -349,10 +349,6 @@ Whether the passphrase is cached at all is controlled by
(autoload 'mml-compute-boundary "mml")
-;; We require mm-decode, which requires mm-bodies, which autoloads
-;; message-options-get (!).
-(declare-function message-options-set "message" (symbol value))
-
(defun mml-smime-epg-sign (cont)
(let ((inhibit-redisplay t)
(boundary (mml-compute-boundary cont)))
diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el
index 140f7201d80..f98984c1cdf 100644
--- a/lisp/gnus/mml1991.el
+++ b/lisp/gnus/mml1991.el
@@ -25,11 +25,6 @@
;;; Code:
-(eval-and-compile
- (if (locate-library "password-cache")
- (require 'password-cache)
- (require 'password)))
-
(eval-when-compile
(require 'cl)
(require 'mm-util))
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 0d64849673e..774821320f1 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -27,11 +27,6 @@
;;; Code:
-(eval-and-compile
- (if (locate-library "password-cache")
- (require 'password-cache)
- (require 'password)))
-
(eval-when-compile (require 'cl))
(require 'mm-decode)
(require 'mm-util)
diff --git a/lisp/international/characters.el b/lisp/international/characters.el
index 56f6c80fe81..58695654665 100644
--- a/lisp/international/characters.el
+++ b/lisp/international/characters.el
@@ -290,6 +290,7 @@ with L, LRE, or LRO Unicode bidi character type.")
(map-charset-chars #'modify-category-entry (car charsets) ?b)
(setq charsets (cdr charsets))))
(modify-category-entry '(#x600 . #x6ff) ?b)
+(modify-category-entry '(#x8a0 . #x8ff) ?b)
(modify-category-entry '(#xfb50 . #xfdff) ?b)
(modify-category-entry '(#xfe70 . #xfefe) ?b)
@@ -700,6 +701,7 @@ with L, LRE, or LRO Unicode bidi character type.")
(set-case-syntax-pair ?Ɜ ?ɜ tbl)
(set-case-syntax-pair ?Ɡ ?ɡ tbl)
(set-case-syntax-pair ?Ɬ ?ɬ tbl)
+ (set-case-syntax-pair ?Ɪ ?ɪ tbl)
(set-case-syntax-pair ?Ʞ ?ʞ tbl)
(set-case-syntax-pair ?Ʇ ?ʇ tbl)
(set-case-syntax-pair ?Ʝ ?ʝ tbl)
@@ -810,6 +812,9 @@ with L, LRE, or LRO Unicode bidi character type.")
(set-case-syntax-pair c (+ c #x1C60) tbl)
(setq c (1+ c)))
+ ;; Cyrillic Extended-C
+ (modify-category-entry '(#x1C80 . #x1C8F) ?y)
+
;; general punctuation
(setq c #x2000)
(while (<= c #x200b)
@@ -903,6 +908,12 @@ with L, LRE, or LRO Unicode bidi character type.")
(set-case-syntax-pair c (+ c 28) tbl)
(setq c (1+ c)))
+ ;; Osage
+ (setq c #x104B0)
+ (while (<= c #x104D3)
+ (set-case-syntax-pair c (+ c 40) tbl)
+ (setq c (1+ c)))
+
;; Old Hungarian
(setq c #x10c80)
(while (<= c #x10cb2)
@@ -915,6 +926,12 @@ with L, LRE, or LRO Unicode bidi character type.")
(set-case-syntax-pair c (+ c #x20) tbl)
(setq c (1+ c)))
+ ;; Adlam
+ (setq c #x1e900)
+ (while (<= c #x1e921)
+ (set-case-syntax-pair c (+ c #x22) tbl)
+ (setq c (1+ c)))
+
;; Combining diacritics
(modify-category-entry '(#x300 . #x362) ?^)
;; Combining marks
@@ -1183,7 +1200,40 @@ with L, LRE, or LRO Unicode bidi character type.")
;; 2: East Asian Wide and Full-width characters.
(let ((l '((#x1100 . #x115F)
+ (#x231A . #x231B)
(#x2329 . #x232A)
+ (#x23E9 . #x23EC)
+ (#x23F0 . #x23F0)
+ (#x23F3 . #x23F3)
+ (#x25FD . #x25FE)
+ (#x2614 . #x2615)
+ (#x2648 . #x2653)
+ (#x267F . #x267F)
+ (#x2693 . #x2693)
+ (#x26A1 . #x26A1)
+ (#x26AA . #x26AB)
+ (#x26BD . #x26BE)
+ (#x26C4 . #x26C5)
+ (#x26CE . #x26CE)
+ (#x26D4 . #x26D4)
+ (#x26EA . #x26EA)
+ (#x26F2 . #x26F3)
+ (#x26F5 . #x26F5)
+ (#x26FA . #x26FA)
+ (#x26FD . #x26FD)
+ (#x2705 . #x2705)
+ (#x270A . #x270B)
+ (#x2728 . #x2728)
+ (#x274C . #x274C)
+ (#x274E . #x274E)
+ (#x2753 . #x2755)
+ (#x2757 . #x2757)
+ (#x2795 . #x2797)
+ (#x27B0 . #x27B0)
+ (#x27BF . #x27BF)
+ (#x2B1B . #x2B1C)
+ (#x2B50 . #x2B50)
+ (#x2B55 . #x2B55)
(#x2E80 . #x303E)
(#x3040 . #xA4CF)
(#xAC00 . #xD7A3)
@@ -1191,6 +1241,46 @@ with L, LRE, or LRO Unicode bidi character type.")
(#xFE30 . #xFE6F)
(#xFF01 . #xFF60)
(#xFFE0 . #xFFE6)
+ (#x16FE0 . #x16FE0)
+ (#x17000 . #x187EC)
+ (#x18800 . #x18AF2)
+ (#x1F18E . #x1F18E)
+ (#x1F191 . #x1F19A)
+ (#x1F200 . #x1F202)
+ (#x1F210 . #x1F23B)
+ (#x1F300 . #x1F320)
+ (#x1F32D . #x1F335)
+ (#x1F337 . #x1F37C)
+ (#x1F37E . #x1F393)
+ (#x1F3A0 . #x1F3CA)
+ (#x1F3CF . #x1F3D3)
+ (#x1F3E0 . #x1F3F0)
+ (#x1F3F4 . #x1F3F4)
+ (#x1F3F8 . #x1F3FA)
+ (#x1F3FB . #x1F3FF)
+ (#x1F440 . #x1F440)
+ (#x1F442 . #x1F4FC)
+ (#x1F4FF . #x1F53D)
+ (#x1F54B . #x1F54E)
+ (#x1F550 . #x1F567)
+ (#x1F57A . #x1F57A)
+ (#x1F595 . #x1F596)
+ (#x1F5A4 . #x1F5A4)
+ (#x1F5FB . #x1F5FF)
+ (#x1F600 . #x1F64F)
+ (#x1F680 . #x1F6C5)
+ (#x1F6CC . #x1F6CC)
+ (#x1F6D0 . #x1F6D2)
+ (#x1F6EB . #x1F6EC)
+ (#x1F6F4 . #x1F6F6)
+ (#x1F910 . #x1F91E)
+ (#x1F920 . #x1F927)
+ (#x1F930 . #x1F930)
+ (#x1F933 . #x1F93E)
+ (#x1F940 . #x1F94B)
+ (#x1F950 . #x1F95E)
+ (#x1F980 . #x1F991)
+ (#x1F9C0 . #x1F9C0)
(#x20000 . #x2FFFF)
(#x30000 . #x3FFFF))))
(dolist (elt l)
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 2ecfa7e53af..90905a2ade9 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -205,6 +205,7 @@
(deseret #x10400)
(shavian #x10450)
(osmanya #x10480)
+ (osage #x104B0)
(elbasan #x10500)
(caucasian-albanian #x10530)
(linear-a #x10600)
@@ -220,17 +221,22 @@
(khojki #x11200)
(khudawadi #x112B0)
(grantha #x11305)
+ (newa #x11400)
(tirhuta #x11481)
(siddham #x11580)
(modi #x11600)
(takri #x11680)
(warang-citi #x118A1)
(pau-cin-hau #x11AC0)
+ (bhaiksuki #x11C00)
+ (marchen #x11C72)
(cuneiform #x12000)
(cuneiform-numbers-and-punctuation #x12400)
(mro #x16A40)
(bassa-vah #x16AD0)
(pahawh-hmong #x16B11)
+ (tangut #x17000)
+ (tangut-components #x18800)
(duployan-shorthand #x1BC20)
(byzantine-musical-symbol #x1D000)
(musical-symbol #x1D100)
@@ -238,31 +244,38 @@
(tai-xuan-jing-symbol #x1D300)
(counting-rod-numeral #x1D360)
(mende-kikakui #x1E810)
+ (adlam #x1E900)
(mahjong-tile #x1F000)
(domino-tile #x1F030)))
(defvar otf-script-alist)
-;; The below was synchronized with the latest Jan 3, 2013 version of
+;; The below was synchronized with the latest Feb 25, 2016 version of
;; https://www.microsoft.com/typography/otspec/scripttags.htm.
(setq otf-script-alist
- '((arab . arabic)
+ '((adlm . adlam)
+ (ahom . ahom)
+ (hluw . anatolian)
+ (arab . arabic)
(armi . aramaic)
(armn . armenian)
(avst . avestan)
(bali . balinese)
(bamu . bamum)
+ (bass . bassa-vah)
(batk . batak)
(bng2 . bengali)
(beng . bengali)
+ (bhks . bhaiksuki)
(bopo . bopomofo)
- (brai . braille)
(brah . brahmi)
+ (brai . braille)
(bugi . buginese)
(buhd . buhid)
(byzm . byzantine-musical-symbol)
(cans . canadian-aboriginal)
(cari . carian)
+ (aghb . caucasian-albanian)
(cakm . chakma)
(cham . cham)
(cher . cherokee)
@@ -273,11 +286,14 @@
(dsrt . deseret)
(deva . devanagari)
(dev2 . devanagari)
+ (dupl . duployan-shorthand)
(egyp . egyptian)
+ (elba . elbasan)
(ethi . ethiopic)
(geor . georgian)
(glag . glagolitic)
(goth . gothic)
+ (gran . grantha)
(grek . greek)
(gujr . gujarati)
(gjr2 . gujarati)
@@ -287,6 +303,7 @@
(hang . hangul)
(jamo . hangul)
(hano . hanunoo)
+ (hatr . hatran)
(hebr . hebrew)
(phli . inscriptional-pahlavi)
(prti . inscriptional-parthian)
@@ -298,43 +315,67 @@
(kali . kayah-li)
(khar . kharoshthi)
(khmr . khmer)
+ (khoj . khojki)
+ (sind . khudawadi)
(lao\ . lao)
(latn . latin)
(lepc . lepcha)
(limb . limbu)
+ (lina . linear_a)
(linb . linear_b)
(lisu . lisu)
(lyci . lycian)
(lydi . lydian)
+ (mahj . mahajani)
+ (marc . marchen)
(mlym . malayalam)
(mlm2 . malayalam)
(mand . mandaic)
+ (mani . manichaean)
(math . mathematical)
(mtei . meetei-mayek)
+ (mend . mende-kikakui)
(merc . meroitic)
(mero . meroitic)
+ (plrd . miao)
+ (modi . modi)
(mong . mongolian)
+ (mroo . mro)
+ (mult . multani)
(musc . musical-symbol)
(mym2 . burmese)
(mymr . burmese)
+ (nbat . nabataean)
+ (newa . newa)
(nko\ . nko)
(ogam . ogham)
(olck . ol-chiki)
(ital . old_italic)
(xpeo . old_persian)
+ (narb . old-north-arabian)
+ (perm . old-permic)
(sarb . old-south-arabian)
(orkh . old-turkic)
(orya . oriya)
(ory2 . oriya)
+ (osge . osage)
(osma . osmanya)
+ (hmng . pahawh-hmong)
+ (palm . palmyrene)
+ (pauc . pau-cin-hau)
(phag . phags-pa)
+ (phli . inscriptional-pahlavi)
(phnx . phoenician)
+ (phlp . psalter-pahlavi)
+ (prti . inscriptional-parthian)
(rjng . rejang)
(runr . runic)
(samr . samaritan)
(saur . saurashtra)
(shrd . sharada)
(shaw . shavian)
+ (sidd . siddham)
+ (sgnw . sutton-sign-writing)
(sinh . sinhala)
(sora . sora-sompeng)
(sund . sundanese)
@@ -349,14 +390,17 @@
(takr . takri)
(taml . tamil)
(tml2 . tamil)
+ (tang . tangut)
(telu . telugu)
(tel2 . telugu)
(thaa . thaana)
(thai . thai)
(tibt . tibetan)
(tfng . tifinagh)
+ (tirh . tirhuta)
(ugar . ugaritic)
(vai\ . vai)
+ (wara . warang-citi)
(yi\ \ . yi)))
;; Set standard fontname specification of characters in the default
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 5501fa1afc4..8eb320acea5 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2939,7 +2939,10 @@ on encoding."
(#x14400 . #x14646)
;; (#x14647 . #x167FF) unused
(#x16800 . #x16F9F)
- ;; (#x16FA0 . #x1AFFF) unused
+ (#x16FE0 . #x16FE0)
+ ;; (#x17000 . #x187FF) Tangut Ideographs
+ ;; (#x18800 . #x18AFF) Tangut Components
+ ;; (#x18B00 . #x1AFFF) unused
(#x1B000 . #x1B0FF)
;; (#x1B100 . #x1BBFF) unused
(#x1BC00 . #x1BCAF)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index b8ada2c766a..988503eaa4f 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2574,15 +2574,26 @@ the word mode."
(when (eq regexp-function t)
(setq regexp-function #'word-search-regexp))
(let ((description
- ;; Don't use a description on the default search mode.
- (cond ((equal regexp-function search-default-mode) "")
+ (cond
+ ;; 1. Do not use a description on the default search mode,
+ ;; but only if the default search mode is non-nil.
+ ((or (and search-default-mode
+ (equal search-default-mode regexp-function))
+ ;; Special case where `search-default-mode' is t
+ ;; (defaults to regexp searches).
+ (and (eq search-default-mode t)
+ (eq search-default-mode isearch-regexp))) "")
+ ;; 2. Use the `isearch-message-prefix' set for
+ ;; `regexp-function' if available.
(regexp-function
(and (symbolp regexp-function)
(or (get regexp-function 'isearch-message-prefix)
"")))
+ ;; 3. Else if `isearch-regexp' is non-nil, set description
+ ;; to "regexp ".
(isearch-regexp "regexp ")
- ;; We're in literal mode. If the default mode is not
- ;; literal, then describe it.
+ ;; 4. And finally, if we're in literal mode (and if the
+ ;; default mode is also not literal), describe it.
((functionp search-default-mode) "literal "))))
(if space-before
;; Move space from the end to the beginning.
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 5f29c01c77e..53fc2215a90 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -47,6 +47,13 @@
;;; Code:
+;; This is used in xdisp.c to determine when bidi reordering is safe.
+;; (It starts non-nil in temacs, but we set it non-nil here anyway, in
+;; case someone loads loadup one more time.) We reset it after
+;; successfully loading charprop.el, which defines the Unicode tables
+;; bidi.c needs for its job.
+(setq redisplay--inhibit-bidi t)
+
;; Add subdirectories to the load-path for files that might get
;; autoloaded when bootstrapping.
;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
@@ -114,6 +121,10 @@
(load "format")
(load "bindings")
(load "window") ; Needed here for `replace-buffer-in-windows'.
+;; We are now capable of resizing the mini-windows, so give the
+;; variable its advertised default value (it starts as nil, see
+;; xdisp.c).
+(setq resize-mini-windows 'grow-only)
(setq load-source-file-function 'load-with-code-conversion)
(load "files")
@@ -167,7 +178,8 @@
(load "case-table")
;; This file doesn't exist when building a development version of Emacs
;; from the repository. It is generated just after temacs is built.
-(load "international/charprop.el" t)
+(if (load "international/charprop.el" t)
+ (setq redisplay--inhibit-bidi nil))
(load "international/characters")
(load "composite")
@@ -420,6 +432,9 @@ lost after dumping")))
(if (null (garbage-collect))
(setq pure-space-overflow t))
+;; Make sure we will attempt bidi reordering henceforth.
+(setq redisplay--inhibit-bidi nil)
+
(if (member (car (last command-line-args)) '("dump" "bootstrap"))
(progn
(message "Dumping under the name emacs")
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 6761de11700..764f44a8dd8 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1594,69 +1594,70 @@ defun."
(c-region-is-active-p)
(push-mark))
- (c-save-buffer-state
- (beginning-of-defun-function end-of-defun-function
- (start (point))
- (paren-state (copy-tree (c-parse-state))) ; This must not share list
- ; structure with other users of c-state-cache.
- (orig-point-min (point-min)) (orig-point-max (point-max))
- lim ; Position of { which has been widened to.
- where pos case-fold-search)
-
- (save-restriction
- (if (eq c-defun-tactic 'go-outward)
- (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace.
- paren-state orig-point-min orig-point-max)))
-
- ;; Move back out of any macro/comment/string we happen to be in.
- (c-beginning-of-macro)
- (setq pos (c-literal-limits))
- (if pos (goto-char (car pos)))
-
- (setq where (c-where-wrt-brace-construct))
-
- (if (< arg 0)
- ;; Move forward to the closing brace of a function.
- (progn
- (if (memq where '(at-function-end outwith-function))
- (setq arg (1+ arg)))
- (if (< arg 0)
- (c-while-widening-to-decl-block
- (< (setq arg (- (c-forward-to-nth-EOF-} (- arg) where))) 0)))
- ;; Move forward to the next opening brace....
- (when (and (= arg 0)
- (progn
- (c-while-widening-to-decl-block
- (not (c-syntactic-re-search-forward "{" nil 'eob)))
- (eq (char-before) ?{)))
- (backward-char)
- ;; ... and backward to the function header.
- (c-beginning-of-decl-1)
- t))
-
- ;; Move backward to the opening brace of a function, making successively
- ;; larger portions of the buffer visible as necessary.
- (when (> arg 0)
- (c-while-widening-to-decl-block
- (> (setq arg (c-backward-to-nth-BOF-{ arg where)) 0)))
-
- (when (eq arg 0)
- ;; Go backward to this function's header.
- (c-beginning-of-decl-1)
-
- (setq pos (point))
- ;; We're now there, modulo comments and whitespace.
- ;; Try to be line oriented; position point at the closest
- ;; preceding boi that isn't inside a comment, but if we hit
- ;; the previous declaration then we use the current point
- ;; instead.
- (while (and (/= (point) (c-point 'boi))
- (c-backward-single-comment)))
- (if (/= (point) (c-point 'boi))
- (goto-char pos)))
-
- (c-keep-region-active)
- (= arg 0)))))
+ (c-self-bind-state-cache ; We must not share with other users of c-state-cache.
+ (c-save-buffer-state
+ (beginning-of-defun-function
+ end-of-defun-function
+ (start (point))
+ (paren-state (c-parse-state))
+ (orig-point-min (point-min)) (orig-point-max (point-max))
+ lim ; Position of { which has been widened to.
+ where pos case-fold-search)
+
+ (save-restriction
+ (if (eq c-defun-tactic 'go-outward)
+ (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace.
+ paren-state orig-point-min orig-point-max)))
+
+ ;; Move back out of any macro/comment/string we happen to be in.
+ (c-beginning-of-macro)
+ (setq pos (c-literal-limits))
+ (if pos (goto-char (car pos)))
+
+ (setq where (c-where-wrt-brace-construct))
+
+ (if (< arg 0)
+ ;; Move forward to the closing brace of a function.
+ (progn
+ (if (memq where '(at-function-end outwith-function))
+ (setq arg (1+ arg)))
+ (if (< arg 0)
+ (c-while-widening-to-decl-block
+ (< (setq arg (- (c-forward-to-nth-EOF-} (- arg) where))) 0)))
+ ;; Move forward to the next opening brace....
+ (when (and (= arg 0)
+ (progn
+ (c-while-widening-to-decl-block
+ (not (c-syntactic-re-search-forward "{" nil 'eob)))
+ (eq (char-before) ?{)))
+ (backward-char)
+ ;; ... and backward to the function header.
+ (c-beginning-of-decl-1)
+ t))
+
+ ;; Move backward to the opening brace of a function, making successively
+ ;; larger portions of the buffer visible as necessary.
+ (when (> arg 0)
+ (c-while-widening-to-decl-block
+ (> (setq arg (c-backward-to-nth-BOF-{ arg where)) 0)))
+
+ (when (eq arg 0)
+ ;; Go backward to this function's header.
+ (c-beginning-of-decl-1)
+
+ (setq pos (point))
+ ;; We're now there, modulo comments and whitespace.
+ ;; Try to be line oriented; position point at the closest
+ ;; preceding boi that isn't inside a comment, but if we hit
+ ;; the previous declaration then we use the current point
+ ;; instead.
+ (while (and (/= (point) (c-point 'boi))
+ (c-backward-single-comment)))
+ (if (/= (point) (c-point 'boi))
+ (goto-char pos)))
+
+ (c-keep-region-active)
+ (= arg 0))))))
(defun c-forward-to-nth-EOF-} (n where)
;; Skip to the closing brace of the Nth function after point. If
@@ -1718,66 +1719,68 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'."
(c-region-is-active-p)
(push-mark))
- (c-save-buffer-state
- (beginning-of-defun-function end-of-defun-function
- (start (point))
- (paren-state (copy-tree (c-parse-state))) ; This must not share list
- ; structure with other users of c-state-cache.
- (orig-point-min (point-min)) (orig-point-max (point-max))
- lim
- where pos case-fold-search)
-
- (save-restriction
- (if (eq c-defun-tactic 'go-outward)
- (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace
- paren-state orig-point-min orig-point-max)))
-
- ;; Move back out of any macro/comment/string we happen to be in.
- (c-beginning-of-macro)
- (setq pos (c-literal-limits))
- (if pos (goto-char (car pos)))
-
- (setq where (c-where-wrt-brace-construct))
+ (c-self-bind-state-cache ; c-state-cache's list structure must not be shared
+ ; with other users.
+ (c-save-buffer-state
+ (beginning-of-defun-function
+ end-of-defun-function
+ (start (point))
+ (paren-state (c-parse-state))
+ (orig-point-min (point-min)) (orig-point-max (point-max))
+ lim
+ where pos case-fold-search)
+
+ (save-restriction
+ (if (eq c-defun-tactic 'go-outward)
+ (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace
+ paren-state orig-point-min orig-point-max)))
+
+ ;; Move back out of any macro/comment/string we happen to be in.
+ (c-beginning-of-macro)
+ (setq pos (c-literal-limits))
+ (if pos (goto-char (car pos)))
+
+ (setq where (c-where-wrt-brace-construct))
+
+ (if (< arg 0)
+ ;; Move backwards to the } of a function
+ (progn
+ (if (memq where '(at-header outwith-function))
+ (setq arg (1+ arg)))
+ (if (< arg 0)
+ (c-while-widening-to-decl-block
+ (< (setq arg (- (c-backward-to-nth-BOF-{ (- arg) where))) 0)))
+ (if (= arg 0)
+ (c-while-widening-to-decl-block
+ (progn (c-syntactic-skip-backward "^}")
+ (not (eq (char-before) ?}))))))
+
+ ;; Move forward to the } of a function
+ (if (> arg 0)
+ (c-while-widening-to-decl-block
+ (> (setq arg (c-forward-to-nth-EOF-} arg where)) 0))))
+
+ ;; Do we need to move forward from the brace to the semicolon?
+ (when (eq arg 0)
+ (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc.
+ (c-syntactic-re-search-forward ";"))
- (if (< arg 0)
- ;; Move backwards to the } of a function
- (progn
- (if (memq where '(at-header outwith-function))
- (setq arg (1+ arg)))
- (if (< arg 0)
- (c-while-widening-to-decl-block
- (< (setq arg (- (c-backward-to-nth-BOF-{ (- arg) where))) 0)))
- (if (= arg 0)
- (c-while-widening-to-decl-block
- (progn (c-syntactic-skip-backward "^}")
- (not (eq (char-before) ?}))))))
-
- ;; Move forward to the } of a function
- (if (> arg 0)
- (c-while-widening-to-decl-block
- (> (setq arg (c-forward-to-nth-EOF-} arg where)) 0))))
-
- ;; Do we need to move forward from the brace to the semicolon?
- (when (eq arg 0)
- (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc.
- (c-syntactic-re-search-forward ";"))
+ (setq pos (point))
+ ;; We're there now, modulo comments and whitespace.
+ ;; Try to be line oriented; position point after the next
+ ;; newline that isn't inside a comment, but if we hit the
+ ;; next declaration then we use the current point instead.
+ (while (and (not (bolp))
+ (not (looking-at "\\s *$"))
+ (c-forward-single-comment)))
+ (cond ((bolp))
+ ((looking-at "\\s *$")
+ (forward-line 1))
+ (t
+ (goto-char pos))))
- (setq pos (point))
- ;; We're there now, modulo comments and whitespace.
- ;; Try to be line oriented; position point after the next
- ;; newline that isn't inside a comment, but if we hit the
- ;; next declaration then we use the current point instead.
- (while (and (not (bolp))
- (not (looking-at "\\s *$"))
- (c-forward-single-comment)))
- (cond ((bolp))
- ((looking-at "\\s *$")
- (forward-line 1))
- (t
- (goto-char pos))))
-
- (c-keep-region-active)
- (= arg 0))))
+ (c-keep-region-active)
+ (= arg 0)))))
(defun c-defun-name ()
"Return the name of the current defun, or NIL if there isn't one.
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 2056f3907b8..7365f695f3b 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1260,7 +1260,8 @@ been put there by c-put-char-property. POINT remains unchanged."
(def-edebug-spec c-clear-char-property t)
(def-edebug-spec c-clear-char-properties t)
(def-edebug-spec c-put-overlay t)
-(def-edebug-spec c-delete-overlay t) ;))
+(def-edebug-spec c-delete-overlay t)
+(def-edebug-spec c-self-bind-state-cache t);))
;;; Functions.
@@ -1399,6 +1400,26 @@ been put there by c-put-char-property. POINT remains unchanged."
(save-restriction
(widen)
(c-set-cpp-delimiters ,beg ,end)))))
+
+(defmacro c-self-bind-state-cache (&rest forms)
+ ;; Bind the state cache to itself and execute the FORMS. It is assumed that no
+ ;; buffer changes will happen in FORMS, and no hidden buffer changes which could
+ ;; affect the parsing will be made by FORMS.
+ `(let ((c-state-cache (copy-tree c-state-cache))
+ (c-state-cache-good-pos c-state-cache-good-pos)
+ ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache))
+ ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit)
+ ;(c-state-semi-nonlit-pos-cache (copy-treec c-state-semi-nonlit-pos-cache))
+ ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache)
+ (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert))
+ (c-state-point-min c-state-point-min)
+ (c-state-point-min-lit-type c-state-point-min-lit-type)
+ (c-state-point-min-lit-start c-state-point-min-lit-start)
+ (c-state-min-scan-pos c-state-min-scan-pos)
+ (c-state-old-cpp-beg c-state-old-cpp-beg)
+ (c-state-old-cpp-end c-state-old-cpp-end))
+ ,@forms))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The following macros are to be used only in `c-parse-state' and its
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 380ea15cc89..f9eae213ca8 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -4288,8 +4288,7 @@ comment at the start of cc-engine.el for more info."
(setq safe-pos-list (cdr safe-pos-list)))
(unless (setq safe-pos (car-safe safe-pos-list))
(setq safe-pos (max (or (c-safe-position
- (point) (or c-state-cache
- (c-parse-state)))
+ (point) (c-parse-state))
0)
(point-min))
safe-pos-list (list safe-pos)))
@@ -4337,107 +4336,108 @@ Non-nil is returned if the point moved, nil otherwise.
Note that this function might do hidden buffer changes. See the
comment at the start of cc-engine.el for more info."
- (let ((start (point))
- state-2
- ;; A list of syntactically relevant positions in descending
- ;; order. It's used to avoid scanning repeatedly over
- ;; potentially large regions with `parse-partial-sexp' to verify
- ;; each position. Used in `c-ssb-lit-begin'
- safe-pos-list
- ;; The result from `c-beginning-of-macro' at the start position or the
- ;; start position itself if it isn't within a macro. Evaluated on
- ;; demand.
- start-macro-beg
- ;; The earliest position after the current one with the same paren
- ;; level. Used only when `paren-level' is set.
- lit-beg
- (paren-level-pos (point)))
-
- (while
- (progn
- ;; The next loop "tries" to find the end point each time round,
- ;; loops when it hasn't succeeded.
- (while
- (and
- (let ((pos (point)))
- (while (and
- (< (skip-chars-backward skip-chars limit) 0)
- ;; Don't stop inside a literal.
- (when (setq lit-beg (c-ssb-lit-begin))
- (goto-char lit-beg)
- t)))
- (< (point) pos))
+ (c-self-bind-state-cache
+ (let ((start (point))
+ state-2
+ ;; A list of syntactically relevant positions in descending
+ ;; order. It's used to avoid scanning repeatedly over
+ ;; potentially large regions with `parse-partial-sexp' to verify
+ ;; each position. Used in `c-ssb-lit-begin'
+ safe-pos-list
+ ;; The result from `c-beginning-of-macro' at the start position or the
+ ;; start position itself if it isn't within a macro. Evaluated on
+ ;; demand.
+ start-macro-beg
+ ;; The earliest position after the current one with the same paren
+ ;; level. Used only when `paren-level' is set.
+ lit-beg
+ (paren-level-pos (point)))
+
+ (while
+ (progn
+ ;; The next loop "tries" to find the end point each time round,
+ ;; loops when it hasn't succeeded.
+ (while
+ (and
+ (let ((pos (point)))
+ (while (and
+ (< (skip-chars-backward skip-chars limit) 0)
+ ;; Don't stop inside a literal.
+ (when (setq lit-beg (c-ssb-lit-begin))
+ (goto-char lit-beg)
+ t)))
+ (< (point) pos))
+
+ (let ((pos (point)) state-2 pps-end-pos)
- (let ((pos (point)) state-2 pps-end-pos)
+ (cond
+ ((and paren-level
+ (save-excursion
+ (setq state-2 (parse-partial-sexp
+ pos paren-level-pos -1)
+ pps-end-pos (point))
+ (/= (car state-2) 0)))
+ ;; Not at the right level.
+
+ (if (and (< (car state-2) 0)
+ ;; We stop above if we go out of a paren.
+ ;; Now check whether it precedes or is
+ ;; nested in the starting sexp.
+ (save-excursion
+ (setq state-2
+ (parse-partial-sexp
+ pps-end-pos paren-level-pos
+ nil nil state-2))
+ (< (car state-2) 0)))
+
+ ;; We've stopped short of the starting position
+ ;; so the hit was inside a nested list. Go up
+ ;; until we are at the right level.
+ (condition-case nil
+ (progn
+ (goto-char (scan-lists pos -1
+ (- (car state-2))))
+ (setq paren-level-pos (point))
+ (if (and limit (>= limit paren-level-pos))
+ (progn
+ (goto-char limit)
+ nil)
+ t))
+ (error
+ (goto-char (or limit (point-min)))
+ nil))
+
+ ;; The hit was outside the list at the start
+ ;; position. Go to the start of the list and exit.
+ (goto-char (1+ (elt state-2 1)))
+ nil))
+
+ ((c-beginning-of-macro limit)
+ ;; Inside a macro.
+ (if (< (point)
+ (or start-macro-beg
+ (setq start-macro-beg
+ (save-excursion
+ (goto-char start)
+ (c-beginning-of-macro limit)
+ (point)))))
+ t
+
+ ;; It's inside the same macro we started in so it's
+ ;; a relevant match.
+ (goto-char pos)
+ nil))))))
- (cond
- ((and paren-level
- (save-excursion
- (setq state-2 (parse-partial-sexp
- pos paren-level-pos -1)
- pps-end-pos (point))
- (/= (car state-2) 0)))
- ;; Not at the right level.
-
- (if (and (< (car state-2) 0)
- ;; We stop above if we go out of a paren.
- ;; Now check whether it precedes or is
- ;; nested in the starting sexp.
- (save-excursion
- (setq state-2
- (parse-partial-sexp
- pps-end-pos paren-level-pos
- nil nil state-2))
- (< (car state-2) 0)))
-
- ;; We've stopped short of the starting position
- ;; so the hit was inside a nested list. Go up
- ;; until we are at the right level.
- (condition-case nil
- (progn
- (goto-char (scan-lists pos -1
- (- (car state-2))))
- (setq paren-level-pos (point))
- (if (and limit (>= limit paren-level-pos))
- (progn
- (goto-char limit)
- nil)
- t))
- (error
- (goto-char (or limit (point-min)))
- nil))
-
- ;; The hit was outside the list at the start
- ;; position. Go to the start of the list and exit.
- (goto-char (1+ (elt state-2 1)))
- nil))
-
- ((c-beginning-of-macro limit)
- ;; Inside a macro.
- (if (< (point)
- (or start-macro-beg
- (setq start-macro-beg
- (save-excursion
- (goto-char start)
- (c-beginning-of-macro limit)
- (point)))))
- t
-
- ;; It's inside the same macro we started in so it's
- ;; a relevant match.
- (goto-char pos)
- nil))))))
-
- (> (point)
- (progn
- ;; Skip syntactic ws afterwards so that we don't stop at the
- ;; end of a comment if `skip-chars' is something like "^/".
- (c-backward-syntactic-ws)
- (point)))))
+ (> (point)
+ (progn
+ ;; Skip syntactic ws afterwards so that we don't stop at the
+ ;; end of a comment if `skip-chars' is something like "^/".
+ (c-backward-syntactic-ws)
+ (point)))))
- ;; We might want to extend this with more useful return values in
- ;; the future.
- (/= (point) start)))
+ ;; We might want to extend this with more useful return values in
+ ;; the future.
+ (/= (point) start))))
;; The following is an alternative implementation of
;; `c-syntactic-skip-backward' that uses backward movement to keep
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 8f0b4f13b9e..ca85980c28e 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -572,7 +572,7 @@ It can be quoted, or be inside a quoted form."
" " (cadr table-etc)))
(cddr table-etc)))))))))
-(defun lisp-completion-at-point (_predicate)
+(defun lisp-completion-at-point (&optional _predicate)
(declare (obsolete elisp-completion-at-point "25.1"))
(elisp-completion-at-point))
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index be8f96dcfd9..2389f742937 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -368,7 +368,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(exp (exp1) (exp "," exp) (exp "=" exp)
(id " @ " exp))
(exp1 (exp2) (exp2 "?" exp1 ":" exp1))
- (exp2 (exp3) (exp3 "." exp2))
+ (exp2 (exp3) (exp3 "." exp3))
(exp3 ("def" insts "end")
("begin" insts-rescue-insts "end")
("do" insts "end")
@@ -388,7 +388,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(cases (exp "then" insts)
(cases "when" cases) (insts "else" insts))
(expseq (exp) );;(expseq "," expseq)
- (hashvals (id "=>" exp1) (hashvals "," hashvals))
+ (hashvals (exp1 "=>" exp1) (hashvals "," hashvals))
(insts-rescue-insts (insts)
(insts-rescue-insts "rescue" insts-rescue-insts)
(insts-rescue-insts "ensure" insts-rescue-insts))
@@ -406,17 +406,18 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
'((right "=")
(right "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^="
"<<=" ">>=" "&&=" "||=")
- (left ".." "...")
- (left "+" "-")
- (left "*" "/" "%" "**")
+ (nonassoc ".." "...")
(left "&&" "||")
- (left "^" "&" "|")
(nonassoc "<=>")
- (nonassoc ">" ">=" "<" "<=")
(nonassoc "==" "===" "!=")
(nonassoc "=~" "!~")
+ (nonassoc ">" ">=" "<" "<=")
+ (left "^" "&" "|")
(left "<<" ">>")
- (right "."))))))
+ (left "+" "-")
+ (left "*" "/" "%")
+ (left "**")
+ (assoc "."))))))
(defun ruby-smie--bosp ()
(save-excursion (skip-chars-backward " \t")
@@ -443,8 +444,8 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(member (save-excursion (ruby-smie--backward-token))
'("iuwu-mod" "and" "or")))
(save-excursion
- (forward-comment 1)
- (eq (char-after) ?.))))))
+ (forward-comment (point-max))
+ (looking-at "&?\\."))))))
(defun ruby-smie--redundant-do-p (&optional skip)
(save-excursion
@@ -535,6 +536,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(line-end-position))
(ruby-smie--forward-token)) ;Fully redundant.
(t ";")))
+ ((equal tok "&.") ".")
(t tok)))))))))
(defun ruby-smie--backward-token ()
@@ -580,6 +582,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(line-end-position))
(ruby-smie--backward-token)) ;Fully redundant.
(t ";")))
+ ((equal tok "&.") ".")
(t tok)))))))
(defun ruby-smie--indent-to-stmt ()
@@ -627,19 +630,13 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
;; because when `.' is inside the line, the
;; additional indentation from it looks out of place.
((smie-rule-parent-p ".")
- (let (smie--parent)
- (save-excursion
- ;; Traverse up the parents until the parent is "." at
- ;; indentation, or any other token.
- (while (and (let ((parent (smie-indent--parent)))
- (goto-char (cadr parent))
- (save-excursion
- (unless (integerp (car parent)) (forward-char -1))
- (not (ruby-smie--bosp))))
- (progn
- (setq smie--parent nil)
- (smie-rule-parent-p "."))))
- (smie-rule-parent))))
+ ;; Traverse up the call chain until the parent is not `.',
+ ;; or `.' at indentation, or at eol.
+ (while (and (not (ruby-smie--bosp))
+ (equal (nth 2 (smie-backward-sexp ".")) ".")
+ (not (ruby-smie--bosp)))
+ (forward-char -1))
+ (smie-indent-virtual))
(t (smie-rule-parent))))))
(`(:after . ,(or `"(" "[" "{"))
;; FIXME: Shouldn't this be the default behavior of
@@ -659,7 +656,9 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(`(:before . ".")
(if (smie-rule-sibling-p)
(and ruby-align-chained-calls 0)
- ruby-indent-level))
+ (smie-backward-sexp ".")
+ (cons 'column (+ (current-column)
+ ruby-indent-level))))
(`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure"))
(smie-rule-parent))
(`(:before . "when")
@@ -1375,7 +1374,7 @@ delimiter."
(goto-char ruby-indent-point)
(beginning-of-line)
(skip-syntax-forward " ")
- (if (looking-at "\\.[^.]")
+ (if (looking-at "\\.[^.]\\|&\\.")
(+ indent ruby-indent-level)
indent))))
diff --git a/lisp/xml.el b/lisp/xml.el
index 1802d04dfaf..414300cb402 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -580,7 +580,7 @@ Return one of:
;; However, if we're parsing incrementally, then we need to deal
;; with stray CDATA.
(let ((s (xml-parse-string)))
- (when (string-empty-p s)
+ (when (zerop (length s))
;; We haven't consumed any input! We must throw an error in
;; order to prevent looping forever.
(error "XML: (Not Well-Formed) Could not parse: %s"