1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Don't quote self-quoting pcase patterns

* admin/bzrmerge.el:
* lisp/char-fold.el:
* lisp/dired.el:
* lisp/emacs-lisp/derived.el:
* lisp/emacs-lisp/easy-mmode.el:
* lisp/emacs-lisp/easymenu.el:
* lisp/emacs-lisp/eieio-core.el:
* lisp/emacs-lisp/package.el:
* lisp/emacs-lisp/smie.el:
* lisp/faces.el:
* lisp/filesets.el:
* lisp/progmodes/modula2.el:
* lisp/progmodes/octave.el:
* lisp/progmodes/opascal.el:
* lisp/progmodes/perl-mode.el:
* lisp/progmodes/prolog.el:
* lisp/progmodes/ruby-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/server.el:
* lisp/subr.el:
* lisp/textmodes/css-mode.el:
* test/lisp/emacs-lisp/pcase-tests.el: Don't quote self-quoting
'pcase' patterns.
This commit is contained in:
Michael Heerdegen 2018-10-27 01:48:35 +02:00
parent 607cc2901b
commit 049bd5d267
22 changed files with 167 additions and 167 deletions

View File

@ -150,12 +150,12 @@ Type `y' to skip this revision,
(format "%s: Skip (y/n/N/q/%s)? " str
(key-description (vector help-char)))
'(?y ?n ?N ?q)))
(`?y (setq skip t))
(`?q (keyboard-quit))
(?y (setq skip t))
(?q (keyboard-quit))
;; A single log entry can match skip-regexp multiple
;; times. If you are sure you don't want to skip it,
;; you don't want to be asked multiple times.
(`?N (setq skip 'no))))))
(?N (setq skip 'no))))))
(if (eq skip t)
(push revno skipped)
(push revno revnos)))))

View File

@ -170,7 +170,7 @@ from which to start."
;; need to keep them grouped together like this: "\\( \\|[ ...][ ...]\\)".
(while (< i end)
(pcase (aref string i)
(`?\s (setq spaces (1+ spaces)))
(?\s (setq spaces (1+ spaces)))
(c (when (> spaces 0)
(push (char-fold--make-space-string spaces) out)
(setq spaces 0))

View File

@ -3046,10 +3046,10 @@ TRASH non-nil means to trash the file instead of deleting, provided
("no" ?n "skip to next")
("all" ?! "delete all remaining directories with no more questions")
("quit" ?q "exit")))
('"all" (setq recursive 'always dired-recursive-deletes recursive))
('"yes" (if (eq recursive 'top) (setq recursive 'always)))
('"no" (setq recursive nil))
('"quit" (keyboard-quit))
("all" (setq recursive 'always dired-recursive-deletes recursive))
("yes" (if (eq recursive 'top) (setq recursive 'always)))
("no" (setq recursive nil))
("quit" (keyboard-quit))
(_ (keyboard-quit))))) ; catch all unknown answers
(setq recursive nil)) ; Empty dir or recursive is nil.
(delete-directory file recursive trash))))

View File

@ -193,10 +193,10 @@ See Info node `(elisp)Derived Modes' for more details."
;; Process the keyword args.
(while (keywordp (car body))
(pcase (pop body)
(`:group (setq group (pop body)))
(`:abbrev-table (setq abbrev (pop body)) (setq declare-abbrev nil))
(`:syntax-table (setq syntax (pop body)) (setq declare-syntax nil))
(`:after-hook (setq after-hook (pop body)))
(:group (setq group (pop body)))
(:abbrev-table (setq abbrev (pop body)) (setq declare-abbrev nil))
(:syntax-table (setq syntax (pop body)) (setq declare-syntax nil))
(:after-hook (setq after-hook (pop body)))
(_ (pop body))))
(setq docstring (derived-mode-make-docstring

View File

@ -217,30 +217,30 @@ For example, you could write
(while (keywordp (setq keyw (car body)))
(setq body (cdr body))
(pcase keyw
(`:init-value (setq init-value (pop body)))
(`:lighter (setq lighter (purecopy (pop body))))
(`:global (setq globalp (pop body))
(when (and globalp (symbolp mode))
(setq setter `(setq-default ,mode))
(setq getter `(default-value ',mode))))
(`:extra-args (setq extra-args (pop body)))
(`:set (setq set (list :set (pop body))))
(`:initialize (setq initialize (list :initialize (pop body))))
(`:group (setq group (nconc group (list :group (pop body)))))
(`:type (setq type (list :type (pop body))))
(`:require (setq require (pop body)))
(`:keymap (setq keymap (pop body)))
(`:variable (setq variable (pop body))
(if (not (and (setq tmp (cdr-safe variable))
(or (symbolp tmp)
(functionp tmp))))
;; PLACE is not of the form (GET . SET).
(progn
(setq setter `(setf ,variable))
(setq getter variable))
(setq getter (car variable))
(setq setter `(funcall #',(cdr variable)))))
(`:after-hook (setq after-hook (pop body)))
(:init-value (setq init-value (pop body)))
(:lighter (setq lighter (purecopy (pop body))))
(:global (setq globalp (pop body))
(when (and globalp (symbolp mode))
(setq setter `(setq-default ,mode))
(setq getter `(default-value ',mode))))
(:extra-args (setq extra-args (pop body)))
(:set (setq set (list :set (pop body))))
(:initialize (setq initialize (list :initialize (pop body))))
(:group (setq group (nconc group (list :group (pop body)))))
(:type (setq type (list :type (pop body))))
(:require (setq require (pop body)))
(:keymap (setq keymap (pop body)))
(:variable (setq variable (pop body))
(if (not (and (setq tmp (cdr-safe variable))
(or (symbolp tmp)
(functionp tmp))))
;; PLACE is not of the form (GET . SET).
(progn
(setq setter `(setf ,variable))
(setq getter variable))
(setq getter (car variable))
(setq setter `(funcall #',(cdr variable)))))
(:after-hook (setq after-hook (pop body)))
(_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
(setq keymap-sym (if (and keymap (symbolp keymap)) keymap
@ -407,8 +407,8 @@ on if the hook has explicitly disabled it."
(while (keywordp (setq keyw (car keys)))
(setq keys (cdr keys))
(pcase keyw
(`:group (setq group (nconc group (list :group (pop keys)))))
(`:global (setq keys (cdr keys)))
(:group (setq group (nconc group (list :group (pop keys)))))
(:global (setq keys (cdr keys)))
(_ (push keyw extra-keywords) (push (pop keys) extra-keywords))))
(unless group
@ -533,11 +533,11 @@ Valid keywords and arguments are:
(let ((key (pop args))
(val (pop args)))
(pcase key
(`:name (setq name val))
(`:dense (setq dense val))
(`:inherit (setq inherit val))
(`:suppress (setq suppress val))
(`:group)
(:name (setq name val))
(:dense (setq dense val))
(:inherit (setq inherit val))
(:suppress (setq suppress val))
(:group)
(_ (message "Unknown argument %s in defmap" key)))))
(unless (keymapp m)
(setq bs (append m bs))

View File

@ -226,14 +226,14 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
(let ((arg (cadr menu-items)))
(setq menu-items (cddr menu-items))
(pcase keyword
(`:filter
(:filter
(setq filter (lambda (menu)
(easy-menu-filter-return (funcall arg menu)
menu-name))))
((or `:enable `:active) (setq enable (or arg ''nil)))
(`:label (setq label arg))
(`:help (setq help arg))
((or `:included `:visible) (setq visible (or arg ''nil))))))
((or :enable :active) (setq enable (or arg ''nil)))
(:label (setq label arg))
(:help (setq help arg))
((or :included :visible) (setq visible (or arg ''nil))))))
(if (equal visible ''nil)
nil ; Invisible menu entry, return nil.
(if (and visible (not (easy-menu-always-true-p visible)))
@ -325,15 +325,15 @@ ITEM defines an item as in `easy-menu-define'."
(setq arg (aref item (1+ count)))
(setq count (+ 2 count))
(pcase keyword
((or `:included `:visible) (setq visible (or arg ''nil)))
(`:key-sequence (setq cache arg cache-specified t))
(`:keys (setq keys arg no-name nil))
(`:label (setq label arg))
((or `:active `:enable) (setq active (or arg ''nil)))
(`:help (setq prop (cons :help (cons arg prop))))
(`:suffix (setq suffix arg))
(`:style (setq style arg))
(`:selected (setq selected (or arg ''nil)))))
((or :included :visible) (setq visible (or arg ''nil)))
(:key-sequence (setq cache arg cache-specified t))
(:keys (setq keys arg no-name nil))
(:label (setq label arg))
((or :active :enable) (setq active (or arg ''nil)))
(:help (setq prop (cons :help (cons arg prop))))
(:suffix (setq suffix arg))
(:style (setq style arg))
(:selected (setq selected (or arg ''nil)))))
(if suffix
(setq label
(if (stringp suffix)

View File

@ -388,9 +388,9 @@ See `defclass' for more information."
;; Clean up the meaning of protection.
(setq prot
(pcase prot
((or 'nil 'public ':public) nil)
((or 'protected ':protected) 'protected)
((or 'private ':private) 'private)
((or 'nil 'public :public) nil)
((or 'protected :protected) 'protected)
((or 'private :private) 'private)
(_ (signal 'invalid-slot-type (list :protection prot)))))
;; The default type specifier is supposed to be t, meaning anything.

View File

@ -2911,17 +2911,17 @@ PKG is a `package-desc' object.
Return (PKG-DESC [NAME VERSION STATUS DOC])."
(let* ((status (package-desc-status pkg))
(face (pcase status
(`"built-in" 'package-status-built-in)
(`"external" 'package-status-external)
(`"available" 'package-status-available)
(`"avail-obso" 'package-status-avail-obso)
(`"new" 'package-status-new)
(`"held" 'package-status-held)
(`"disabled" 'package-status-disabled)
(`"installed" 'package-status-installed)
(`"dependency" 'package-status-dependency)
(`"unsigned" 'package-status-unsigned)
(`"incompat" 'package-status-incompat)
("built-in" 'package-status-built-in)
("external" 'package-status-external)
("available" 'package-status-available)
("avail-obso" 'package-status-avail-obso)
("new" 'package-status-new)
("held" 'package-status-held)
("disabled" 'package-status-disabled)
("installed" 'package-status-installed)
("dependency" 'package-status-dependency)
("unsigned" 'package-status-unsigned)
("incompat" 'package-status-incompat)
(_ 'font-lock-warning-face)))) ; obsolete.
(list pkg
`[(,(symbol-name (package-desc-name pkg))

View File

@ -1856,9 +1856,9 @@ KEYWORDS are additional arguments, which can use the following keywords:
(let ((k (pop keywords))
(v (pop keywords)))
(pcase k
(`:forward-token
(:forward-token
(set (make-local-variable 'smie-forward-token-function) v))
(`:backward-token
(:backward-token
(set (make-local-variable 'smie-backward-token-function) v))
(_ (message "smie-setup: ignoring unknown keyword %s" k)))))
(let ((ca (cdr (assq :smie-closer-alist grammar))))

View File

@ -1084,27 +1084,27 @@ of a set of discrete values. Value is `integerp' if ATTRIBUTE expects
an integer value."
(let ((valid
(pcase attribute
(`:family
(:family
(if (window-system frame)
(mapcar (lambda (x) (cons x x))
(font-family-list))
;; Only one font on TTYs.
(list (cons "default" "default"))))
(`:foundry
(:foundry
(list nil))
(`:width
(:width
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-width-table))
(`:weight
(:weight
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-weight-table))
(`:slant
(:slant
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-slant-table))
(`:inverse-video
(:inverse-video
(mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute)))
((or `:underline `:overline `:strike-through `:box)
((or :underline :overline :strike-through :box)
(if (window-system frame)
(nconc (mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute))
@ -1112,12 +1112,12 @@ an integer value."
(defined-colors frame)))
(mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute))))
((or `:foreground `:background)
((or :foreground :background)
(mapcar #'(lambda (c) (cons c c))
(defined-colors frame)))
(`:height
(:height
'integerp)
(`:stipple
(:stipple
(and (memq (window-system frame) '(x ns)) ; No stipple on w32
(mapcar #'list
(apply #'nconc
@ -1126,7 +1126,7 @@ an integer value."
(file-directory-p dir)
(directory-files dir)))
x-bitmap-file-path)))))
(`:inherit
(:inherit
(cons '("none" . nil)
(mapcar #'(lambda (c) (cons (symbol-name c) c))
(face-list))))

View File

@ -1559,7 +1559,7 @@ SAVE-FUNCTION takes no argument, but works on the current buffer."
(defun filesets-get-fileset-from-name (name &optional mode)
"Get fileset definition for NAME."
(pcase mode
((or `:ingroup `:tree) name)
((or :ingroup :tree) name)
(_ (assoc name filesets-data))))

View File

@ -232,11 +232,11 @@
;; FIXME: "^." are two tokens, not one.
(defun m2-smie-forward-token ()
(pcase (smie-default-forward-token)
(`"VAR" (if (zerop (car (syntax-ppss))) "VAR" "VAR-arg"))
(`"CONST" (if (zerop (car (syntax-ppss))) "CONST" "CONST-arg"))
(`";" (save-excursion (m2-smie-refine-semi)))
(`"OF" (save-excursion (forward-char -2) (m2-smie-refine-of)))
(`":" (save-excursion (forward-char -1) (m2-smie-refine-colon)))
("VAR" (if (zerop (car (syntax-ppss))) "VAR" "VAR-arg"))
("CONST" (if (zerop (car (syntax-ppss))) "CONST" "CONST-arg"))
(";" (save-excursion (m2-smie-refine-semi)))
("OF" (save-excursion (forward-char -2) (m2-smie-refine-of)))
(":" (save-excursion (forward-char -1) (m2-smie-refine-colon)))
;; (`"END" (if (and (looking-at "[ \t\n]*\\(\\(?:\\sw\\|\\s_\\)+\\)")
;; (not (assoc (match-string 1) m2-smie-grammar)))
;; "END-proc" "END"))
@ -244,11 +244,11 @@
(defun m2-smie-backward-token ()
(pcase (smie-default-backward-token)
(`"VAR" (if (zerop (car (syntax-ppss))) "VAR" "VAR-arg"))
(`"CONST" (if (zerop (car (syntax-ppss))) "CONST" "CONST-arg"))
(`";" (save-excursion (forward-char 1) (m2-smie-refine-semi)))
(`"OF" (save-excursion (m2-smie-refine-of)))
(`":" (save-excursion (m2-smie-refine-colon)))
("VAR" (if (zerop (car (syntax-ppss))) "VAR" "VAR-arg"))
("CONST" (if (zerop (car (syntax-ppss))) "CONST" "CONST-arg"))
(";" (save-excursion (forward-char 1) (m2-smie-refine-semi)))
("OF" (save-excursion (m2-smie-refine-of)))
(":" (save-excursion (m2-smie-refine-colon)))
;; (`"END" (if (and (looking-at "\\sw+[ \t\n]+\\(\\(?:\\sw\\|\\s_\\)+\\)")
;; (not (assoc (match-string 1) m2-smie-grammar)))
;; "END-proc" "END"))
@ -272,7 +272,7 @@
(pcase (cons kind token)
(`(:elem . basic) m2-indent)
(`(:after . ":=") (or m2-indent smie-indent-basic))
(`(:after . ,(or `"CONST" `"VAR" `"TYPE"))
(`(:after . ,(or "CONST" "VAR" "TYPE"))
(or m2-indent smie-indent-basic))
;; (`(:before . ,(or `"VAR" `"TYPE" `"CONST"))
;; (if (smie-rule-parent-p "PROCEDURE") 0))

View File

@ -1065,8 +1065,8 @@ directory and makes this the current buffer's default directory."
(unless found (goto-char orig))
found))))
(pcase (and buffer-file-name (file-name-extension buffer-file-name))
(`"cc" (funcall search
"\\_<DEFUN\\(?:_DLD\\)?\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1))
("cc" (funcall search
"\\_<DEFUN\\(?:_DLD\\)?\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1))
(_ (funcall search octave-function-header-regexp 3)))))
(defun octave-function-file-p ()
@ -1135,19 +1135,19 @@ q: Don't fix\n" func file))
(read-char-choice
"Which name to use? (a/b/q) " '(?a ?b ?q))))))
(pcase c
(`?a (let ((newname (expand-file-name
(concat func (file-name-extension
buffer-file-name t)))))
(when (or (not (file-exists-p newname))
(yes-or-no-p
(format "Target file %s exists; proceed? " newname)))
(when (file-exists-p buffer-file-name)
(rename-file buffer-file-name newname t))
(set-visited-file-name newname))))
(`?b (save-excursion
(goto-char name-start)
(delete-region name-start name-end)
(insert file)))))))))
(?a (let ((newname (expand-file-name
(concat func (file-name-extension
buffer-file-name t)))))
(when (or (not (file-exists-p newname))
(yes-or-no-p
(format "Target file %s exists; proceed? " newname)))
(when (file-exists-p buffer-file-name)
(rename-file buffer-file-name newname t))
(set-visited-file-name newname))))
(?b (save-excursion
(goto-char name-start)
(delete-region name-start name-end)
(insert file)))))))))
(defun octave-update-function-file-comment (beg end)
"Query replace function names in function file comment."
@ -1801,19 +1801,19 @@ If the environment variable OCTAVE_SRCDIR is set, it is searched first."
(defun octave-find-definition-default-filename (name)
"Default value for `octave-find-definition-filename-function'."
(pcase (file-name-extension name)
(`"oct"
("oct"
(octave-find-definition-default-filename
(concat "libinterp/dldfcn/"
(file-name-sans-extension (file-name-nondirectory name))
".cc")))
(`"cc"
("cc"
(let ((file (or (locate-file name (octave-source-directories))
(locate-file (file-name-nondirectory name)
(octave-source-directories)))))
(or (and file (file-exists-p file))
(error "File `%s' not found" name))
file))
(`"mex"
("mex"
(if (yes-or-no-p (format-message "File `%s' may be binary; open? "
(file-name-nondirectory name)))
name

View File

@ -393,17 +393,17 @@ routine.")
(if (null (nth 8 ppss))
(when (looking-at opascal--literal-start-re)
(pcase (char-after)
(`?/ 'comment-single-line)
(`?\{ 'comment-multi-line-1)
(`?\( 'comment-multi-line-2)
(`?\' 'string)
(`?\" 'double-quoted-string)))
(?/ 'comment-single-line)
(?\{ 'comment-multi-line-1)
(?\( 'comment-multi-line-2)
(?\' 'string)
(?\" 'double-quoted-string)))
(if (nth 3 ppss) ;String.
(if (eq (nth 3 ppss) ?\")
'double-quoted-string 'string)
(pcase (nth 7 ppss)
(`2 'comment-single-line)
(`1 'comment-multi-line-2)
(2 'comment-single-line)
(1 'comment-multi-line-2)
(_ 'comment-multi-line-1))))))))
(defun opascal-literal-start-pattern (literal-kind)

View File

@ -323,8 +323,8 @@
(cons (car (string-to-syntax "< c"))
;; Remember the names of heredocs found on this line.
(cons (cons (pcase (aref name 0)
(`?\\ (substring name 1))
((or `?\" `?\' `?\`) (substring name 1 -1))
(?\\ (substring name 1))
((or ?\" ?\' ?\`) (substring name 1 -1))
(_ name))
indented)
(cdr st)))))))

View File

@ -954,9 +954,9 @@ This is really kludgy, and unneeded (i.e. obsolete) in Emacs>=24."
;; -> thenrule
;; ; elserule
;; )
(`(:before . ,(or `"->" `";"))
(`(:before . ,(or "->" ";"))
(and (smie-rule-bolp) (smie-rule-parent-p "(") (smie-rule-parent 0)))
(`(:after . ,(or `"->" `"*->"))
(`(:after . ,(or "->" "*->"))
;; We distinguish
;;
;; (a ->
@ -3247,11 +3247,11 @@ the following comma and whitespace, if any."
(defun prolog-post-self-insert ()
(pcase last-command-event
(`?_ (prolog-electric--underscore))
(`?- (prolog-electric--dash))
(`?: (prolog-electric--colon))
((or `?\( `?\; `?>) (prolog-electric--if-then-else))
(`?. (prolog-electric--dot))))
(?_ (prolog-electric--underscore))
(?- (prolog-electric--dash))
(?: (prolog-electric--colon))
((or ?\( ?\; ?>) (prolog-electric--if-then-else))
(?. (prolog-electric--dot))))
(defun prolog-find-term (functor arity &optional prefix)
"Go to the position at the start of the next occurrence of a term.

View File

@ -612,7 +612,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
;; For (invalid) code between switch and case.
;; (if (smie-parent-p "switch") 4)
))
(`(:before . ,(or `"(" `"[" `"{"))
(`(:before . ,(or "(" "[" "{"))
(cond
((and (equal token "{")
(not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";"))
@ -639,7 +639,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(forward-char -1))
(smie-indent-virtual))
(t (smie-rule-parent))))))
(`(:after . ,(or `"(" "[" "{"))
(`(:after . ,(or "(" "[" "{"))
;; FIXME: Shouldn't this be the default behavior of
;; `smie-indent-after-keyword'?
(save-excursion
@ -660,7 +660,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(smie-backward-sexp ".")
(cons 'column (+ (current-column)
ruby-indent-level))))
(`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure"))
(`(:before . ,(or "else" "then" "elsif" "rescue" "ensure"))
(smie-rule-parent))
(`(:before . "when")
;; Align to the previous `when', but look up the virtual
@ -1544,8 +1544,8 @@ With ARG, do it many times. Negative ARG means move forward."
(cond ((looking-at "\\s)")
(goto-char (scan-sexps (1+ (point)) -1))
(pcase (char-before)
(`?% (forward-char -1))
((or `?q `?Q `?w `?W `?r `?x)
(?% (forward-char -1))
((or ?q ?Q ?w ?W ?r ?x)
(if (eq (char-before (1- (point))) ?%)
(forward-char -2))))
nil)
@ -1562,13 +1562,13 @@ With ARG, do it many times. Negative ARG means move forward."
(forward-char 1)
(while (progn (forward-word-strictly -1)
(pcase (char-before)
(`?_ t)
(`?. (forward-char -1) t)
((or `?$ `?@)
(?_ t)
(?. (forward-char -1) t)
((or ?$ ?@)
(forward-char -1)
(and (eq (char-before) (char-after))
(forward-char -1)))
(`?:
(?:
(forward-char -1)
(eq (char-before) :)))))
(if (looking-at ruby-block-end-re)

View File

@ -959,8 +959,8 @@ See `sh-feature'.")
;; ((...)) or $((...)) or $[...] or ${...}. Nested
;; parenthesis can occur inside the first of these forms, so
;; parse backward recursively.
(`?\( (eq ?\( (char-before)))
((or `?\{ `?\[) (eq ?\$ (char-before))))
(?\( (eq ?\( (char-before)))
((or ?\{ ?\[) (eq ?\$ (char-before))))
(sh--inside-noncommand-expression (1- (point))))))))
(defun sh-font-lock-open-heredoc (start string eol)
@ -2038,7 +2038,7 @@ May return nil if the line should not be treated as continued."
(`(:elem . basic) sh-basic-offset)
(`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt)
(sh-var-value 'sh-indent-for-case-label)))
(`(:before . ,(or `"(" `"{" `"[" "while" "if" "for" "case"))
(`(:before . ,(or "(" "{" "[" "while" "if" "for" "case"))
(if (not (smie-rule-prev-p "&&" "||" "|"))
(when (smie-rule-hanging-p)
(smie-rule-parent))
@ -2047,11 +2047,11 @@ May return nil if the line should not be treated as continued."
`(column . ,(smie-indent-virtual)))))
;; FIXME: Maybe this handling of ;; should be made into
;; a smie-rule-terminator function that takes the substitute ";" as arg.
(`(:before . ,(or `";;" `";&" `";;&"))
(`(:before . ,(or ";;" ";&" ";;&"))
(if (and (smie-rule-bolp) (looking-at ";;?&?[ \t]*\\(#\\|$\\)"))
(cons 'column (smie-indent-keyword ";"))
(smie-rule-separator kind)))
(`(:after . ,(or `";;" `";&" `";;&"))
(`(:after . ,(or ";;" ";&" ";;&"))
(with-demoted-errors
(smie-backward-sexp token)
(cons 'column
@ -2062,7 +2062,7 @@ May return nil if the line should not be treated as continued."
(smie-rule-bolp))))
(current-column)
(smie-indent-calculate)))))
(`(:before . ,(or `"|" `"&&" `"||"))
(`(:before . ,(or "|" "&&" "||"))
(unless (smie-rule-parent-p token)
(smie-backward-sexp token)
`(column . ,(+ (funcall smie-rules-function :elem 'basic)
@ -2081,7 +2081,7 @@ May return nil if the line should not be treated as continued."
;; sh-indent-after-done: aligned completely differently.
(`(:after . "in") (sh-var-value 'sh-indent-for-case-label))
;; sh-indent-for-continuation: Line continuations are handled differently.
(`(:after . ,(or `"(" `"{" `"["))
(`(:after . ,(or "(" "{" "["))
(if (not (looking-at ".[ \t]*[^\n \t#]"))
(sh-var-value 'sh-indent-after-open)
(goto-char (1- (match-end 0)))
@ -2253,7 +2253,7 @@ Point should be before the newline."
(save-excursion
(when (sh-smie--rc-after-special-arg-p)
`(column . ,(current-column)))))
(`(:before . ,(or `"(" `"{" `"["))
(`(:before . ,(or "(" "{" "["))
(if (smie-rule-hanging-p) (smie-rule-parent)))
;; FIXME: SMIE parses "if (exp) cmd" as "(if ((exp) cmd))" so "cmd" is
;; treated as an arg to (exp) by default, which indents it all wrong.
@ -2262,7 +2262,7 @@ Point should be before the newline."
;; rule we have is the :list-intro hack, which we use here to align "cmd"
;; with "(exp)", which is rarely the right thing to do, but is better
;; than nothing.
(`(:list-intro . ,(or `"for" `"if" `"while")) t)
(`(:list-intro . ,(or "for" "if" "while")) t)
;; sh-indent-after-switch: handled implicitly by the default { rule.
))

View File

@ -1112,16 +1112,16 @@ The following commands are accepted by the client:
(while args-left
(pcase (pop args-left)
;; -version CLIENT-VERSION: obsolete at birth.
(`"-version" (pop args-left))
("-version" (pop args-left))
;; -nowait: Emacsclient won't wait for a result.
(`"-nowait" (setq nowait t))
("-nowait" (setq nowait t))
;; -current-frame: Don't create frames.
(`"-current-frame" (setq use-current-frame t))
("-current-frame" (setq use-current-frame t))
;; -frame-parameters: Set frame parameters
(`"-frame-parameters"
("-frame-parameters"
(let ((alist (pop args-left)))
(if coding-system
(setq alist (decode-coding-string alist coding-system)))
@ -1129,24 +1129,24 @@ The following commands are accepted by the client:
;; -display DISPLAY:
;; Open X frames on the given display instead of the default.
(`"-display"
("-display"
(setq display (pop args-left))
(if (zerop (length display)) (setq display nil)))
;; -parent-id ID:
;; Open X frame within window ID, via XEmbed.
(`"-parent-id"
("-parent-id"
(setq parent-id (pop args-left))
(if (zerop (length parent-id)) (setq parent-id nil)))
;; -window-system: Open a new X frame.
(`"-window-system"
("-window-system"
(if (fboundp 'x-create-frame)
(setq dontkill t
tty-name 'window-system)))
;; -resume: Resume a suspended tty frame.
(`"-resume"
("-resume"
(let ((terminal (process-get proc 'terminal)))
(setq dontkill t)
(push (lambda ()
@ -1157,7 +1157,7 @@ The following commands are accepted by the client:
;; -suspend: Suspend the client's frame. (In case we
;; get out of sync, and a C-z sends a SIGTSTP to
;; emacsclient.)
(`"-suspend"
("-suspend"
(let ((terminal (process-get proc 'terminal)))
(setq dontkill t)
(push (lambda ()
@ -1167,13 +1167,13 @@ The following commands are accepted by the client:
;; -ignore COMMENT: Noop; useful for debugging emacsclient.
;; (The given comment appears in the server log.)
(`"-ignore"
("-ignore"
(setq dontkill t)
(pop args-left))
;; -tty DEVICE-NAME TYPE: Open a new tty frame.
;; (But if we see -window-system later, use that.)
(`"-tty"
("-tty"
(setq tty-name (pop args-left)
tty-type (pop args-left)
dontkill (or dontkill
@ -1192,7 +1192,7 @@ The following commands are accepted by the client:
;; -position LINE[:COLUMN]: Set point to the given
;; position in the next file.
(`"-position"
("-position"
(if (not (string-match "\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?"
(car args-left)))
(error "Invalid -position command in client args"))
@ -1203,7 +1203,7 @@ The following commands are accepted by the client:
""))))))
;; -file FILENAME: Load the given file.
(`"-file"
("-file"
(let ((file (pop args-left)))
(if coding-system
(setq file (decode-coding-string file coding-system)))
@ -1221,7 +1221,7 @@ The following commands are accepted by the client:
(setq filepos nil))
;; -eval EXPR: Evaluate a Lisp expression.
(`"-eval"
("-eval"
(if use-current-frame
(setq use-current-frame 'always))
(let ((expr (pop args-left)))
@ -1232,14 +1232,14 @@ The following commands are accepted by the client:
(setq filepos nil)))
;; -env NAME=VALUE: An environment variable.
(`"-env"
("-env"
(let ((var (pop args-left)))
;; XXX Variables should be encoded as in getenv/setenv.
(process-put proc 'env
(cons var (process-get proc 'env)))))
;; -dir DIRNAME: The cwd of the emacsclient process.
(`"-dir"
("-dir"
(setq dir (pop args-left))
(if coding-system
(setq dir (decode-coding-string dir coding-system)))

View File

@ -4815,7 +4815,7 @@ command is called from a keyboard macro?"
i frame nextframe)))
(pcase skip
(`nil nil)
(`0 t)
(0 t)
(_ (setq i (+ i skip -1)) (funcall get-next-frame)))))))
;; Now `frame' should be "the function from which we were called".
(pcase (cons frame nextframe)

View File

@ -1219,7 +1219,7 @@ for determining whether point is within a selector."
(`(:elem . basic) css-indent-offset)
(`(:elem . arg) 0)
;; "" stands for BOB (bug#15467).
(`(:list-intro . ,(or `";" `"" `":-property")) t)
(`(:list-intro . ,(or ";" "" ":-property")) t)
(`(:before . "{")
(when (or (smie-rule-hanging-p) (smie-rule-bolp))
(smie-backward-sexp ";")

View File

@ -53,7 +53,7 @@
(should (pcase-tests-grep
'memq (macroexpand-all '(pcase x ((or 1 2 3) body)))))
(should (pcase-tests-grep
'member (macroexpand-all '(pcase x ((or '"a" '2 '3) body)))))
'member (macroexpand-all '(pcase x ((or "a" 2 3) body)))))
(should-not (pcase-tests-grep
'memq (macroexpand-all '(pcase x ((or "a" 2 3) body)))))
(let ((exp (macroexpand-all