From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Sat, 27 Oct 2018 17:19:02 +0200 Message-ID: <87a7mze7tl.fsf@web.de> References: <20151216202605.GA3752@acm.fritz.box> <56892334.4000106@yandex.ru> <8760zakb7q.fsf@fencepost.gnu.org> <56892BDA.6060103@dancol.org> <871t9yk98g.fsf@fencepost.gnu.org> <568936F0.3060505@yandex.ru> <87wprqitj5.fsf@fencepost.gnu.org> <56893C8C.3060200@yandex.ru> <87oad2irtd.fsf@fencepost.gnu.org> <5689456A.1010601@yandex.ru> <87egdy8tyz.fsf@fencepost.gnu.org> <56895FDE.4060406@yandex.ru> <8760za8r4a.fsf@fencepost.gnu.org> <87h9iunkcg.fsf@web.de> <87h8hc4xw2.fsf_-_@web.de> <83tvlcsnee.fsf@gnu.org> <87pnw037ar.fsf@web.de> <83ftwvs7y9.fsf@gnu.org> <877ei7mkfh.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1540653504 14443 195.159.176.226 (27 Oct 2018 15:18:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Oct 2018 15:18:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 27 17:18:19 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGQLy-0003bD-7r for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2018 17:18:18 +0200 Original-Received: from localhost ([::1]:36855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGQO4-0003j8-Nz for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2018 11:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGQNI-0003iz-RT for emacs-devel@gnu.org; Sat, 27 Oct 2018 11:19:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGQNF-0000Np-HK for emacs-devel@gnu.org; Sat, 27 Oct 2018 11:19:40 -0400 Original-Received: from mout.web.de ([212.227.15.14]:34741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGQMu-0000Ce-O5; Sat, 27 Oct 2018 11:19:17 -0400 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MJlCO-1gFKRA2mYO-0016O7; Sat, 27 Oct 2018 17:19:06 +0200 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MJlCO-1gFKRA2mYO-0016O7; Sat, 27 Oct 2018 17:19:06 +0200 In-Reply-To: <877ei7mkfh.fsf@web.de> (Michael Heerdegen's message of "Wed, 24 Oct 2018 17:30:26 +0200") X-Provags-ID: V03:K1:AYyCznYziy/2kd8KF7O+m44s7w4i3pNX5wkYMdPVEjccEYHtS9F g2domSbLZgi3Y+k55X+bL/mkW+viYGB7YeUpImAnpffi2aC3BFF3bjVCvVwYRgaKvEQvP3f GTunG13ofhWjsGFCl7SZsWpo7OsDBfH8OxIJGT3M+pvtOBDv5+LjkTw1D+k+/YG4+ZuOnh8 I3Z0nNgEdufRQ8NBG2WRw== X-UI-Out-Filterresults: notjunk:1;V01:K0:4x9mLW2j+K4=:EEVmum3ogQX8+BOTqJXHxf BwPkuZoEh7TF3jlSAemAwgKGdDOT/vmf62GQ/V3iRt/BktdShlfDp6s952tEdla7GJyDNs5xc ALhKccRiu5jGH/CTIjYWp1VeXcs8ZdQehGcZgn7xh4LHX0OacwtEirXRnKYKJ2M2KMI7nLU1/ dTH/POkLdujQvz2jlkQxkwAyq6yU5k3EKEuWCShO9q6jsLj0bOMoFL4zPAjhSXK7ZLrbkv01R 8R7dU/3XfxE6OPsWXDn7MhHJ+nnwHeMwJ5oWfDIrWXwJp0qMxAdrTayl6cGSd3kKQF6jzVwID MxcTBYkF85Kebfw80H51q3qI9Qn8uOPiH7YiFsLwyhrWpanXk6Pd8MC0TQGeWAhHWhXE9TbzZ N8gOb/KfMTuXQZR8TUfq4S4/RKNRlu7I1NLrg0ieHWskeCqBa3MBafrCEDq75XVia7EhD1HjR CsDZwuIePkoQTcGjAnNp43SerH0Hl4IWaQ5e+zGFhN1HTMbOtYehAvo/JPJnIge89Bm/88PNy nlGtjoWOLwpFBkqpYp3fLpmptGaUpr5bvpe/CmuUF12762h9ePHd5o2TFat047hRPf3FTE1Tx 6pHtDeeaezCz/7UWX+fsYnRCE9G7mJi+d+0jDIhQ+PsaCsisSFCBJTeDtLsQ/Tw/pOzBt1WK4 xWOcO/U2yNWXqVBY0TuHSGxKh0Hq1L/HqFajcFBT0wGjL6JeaxO+d9Qf2p4ChBOQ3f7i3yQ5C gOlqX0cVurPGZjeN4EtXZiC4wsrIDJECQkoIoW5AEvcu11/5sTvCFftL/4RrH3oSiCmyi5yi X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.14 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:230734 Archived-At: --=-=-= Content-Type: text/plain Michael Heerdegen writes: > > easy-mmode.el: > > > > (pcase keyw > > (`:group (setq group (nconc group (list :group (pop keys))))) > > (`:global (setq keys (cdr keys))) > > (_ (push keyw extra-keywords) (push (pop keys) extra-keywords)))) > > > > (Aren't keywords supposed to be self-quoting? then why they are > > explicitly quoted?) > These are all cases I would want to fix, but unless the whole pcase form > can be trivially rewritten as cl-case, I want to leave pcase, really. Here is the first patch addressing quoted selfquoting patterns. I left out cl-generic.el which is distributed via Gnu Elpa because selfquoting pattern types are two years younger than pcase is. Is the commit message ok as it is? Or should I list the changed files to say "All callers changed" every time? Here and there the patch also fixes indentation of surrounding code. In the next step I want to replace `DOESNT-UNQUOTE -> DOESNT-UNQUOTE, though we have one opinion that didn't want me to do this so that the code looks more frightening and people are warned. I don't think it is necessary to warn people about pcase, and I don't think warning people about hard to read code by making the code even harder to read is a good thing ;-) What's then left is the task to replace all pcase forms that can be trivially rewritten by using case or cond/assoc. I must admit that I'm very skeptical about this now. Not only that we would only replace exactly these pcase occurrences that are really trivial to read for anybody, which could be, at the end, counterproductive for those people who dislike pcase because the pcase forms left are the harder ones (Eli, I know you don't think like that). I also saw that people have very different likings, independent from pcase. Say, we have one third of people who want to keep pcase in these cases, one third who want to replace it with cl-case, and one third who want cond or assoc instead. We have a clear majority against pcase. But we also have a clear majority against cl-case, and a majority against cond/assoc. With all input I got, I came to the conclusion that what we have is quite ok: A pcase with branches whose condition all look like 'CONSTANT is not too hard to read for anyone. I saw there are pros and cons for and against keeping these in the code, but I didn't get the impression that one side clearly prevails. Eli and Stefan, if you could agree about something I should do, or if the maintainer(s) tell me I should do these replacement, I still offer to do it, but I don't think we came to any conclusion yet. And here is the first patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-quote-self-quoting-pcase-patterns.patch >From 0045835058ed5f0af07bfe2c67940824c6c084fd Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Sat, 27 Oct 2018 01:48:35 +0200 Subject: [PATCH] Don't quote self-quoting pcase patterns --- admin/bzrmerge.el | 6 +-- lisp/char-fold.el | 2 +- lisp/dired.el | 8 ++-- lisp/emacs-lisp/derived.el | 8 ++-- lisp/emacs-lisp/easy-mmode.el | 62 ++++++++++++++--------------- lisp/emacs-lisp/easymenu.el | 28 ++++++------- lisp/emacs-lisp/eieio-core.el | 6 +-- lisp/emacs-lisp/package.el | 22 +++++----- lisp/emacs-lisp/smie.el | 4 +- lisp/faces.el | 22 +++++----- lisp/filesets.el | 2 +- lisp/progmodes/modula2.el | 22 +++++----- lisp/progmodes/octave.el | 36 ++++++++--------- lisp/progmodes/opascal.el | 14 +++---- lisp/progmodes/perl-mode.el | 4 +- lisp/progmodes/prolog.el | 14 +++---- lisp/progmodes/ruby-mode.el | 18 ++++----- lisp/progmodes/sh-script.el | 18 ++++----- lisp/server.el | 32 +++++++-------- lisp/subr.el | 2 +- lisp/textmodes/css-mode.el | 2 +- test/lisp/emacs-lisp/pcase-tests.el | 2 +- 22 files changed, 167 insertions(+), 167 deletions(-) diff --git a/admin/bzrmerge.el b/admin/bzrmerge.el index cedb625fb0..d54ba330f9 100644 --- a/admin/bzrmerge.el +++ b/admin/bzrmerge.el @@ -150,12 +150,12 @@ bzrmerge-missing (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))))) diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 86bd6038e3..907d49e4f2 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -170,7 +170,7 @@ char-fold-to-regexp ;; 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)) diff --git a/lisp/dired.el b/lisp/dired.el index 5c7bb9599c..f2f2b76eb7 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3046,10 +3046,10 @@ dired-delete-file ("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)))) diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 6b47ffea07..483d6fbfa4 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -193,10 +193,10 @@ define-derived-mode ;; 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 diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 4d8a502026..d74c3ddb97 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -217,30 +217,30 @@ define-minor-mode (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 @@ define-globalized-minor-mode (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 @@ easy-mmode-define-keymap (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)) diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index 94d035f374..403829ac46 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -226,14 +226,14 @@ easy-menu-create-menu (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 @@ easy-menu-convert-item-1 (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) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index e5ea33c003..e5c4f198f5 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -388,9 +388,9 @@ eieio-defclass-internal ;; 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. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9c4c3e9fe7..f2ffef8da7 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2911,17 +2911,17 @@ package-menu--print-info-simple 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)) diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index c01a40172b..4b82172984 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1856,9 +1856,9 @@ smie-setup (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)))) diff --git a/lisp/faces.el b/lisp/faces.el index 18b821a0b6..a8c1546d5a 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1084,27 +1084,27 @@ face-valid-attribute-values 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 @@ face-valid-attribute-values (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 @@ face-valid-attribute-values (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)))) diff --git a/lisp/filesets.el b/lisp/filesets.el index c1e6ef10d5..8ccfa570e3 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -1559,7 +1559,7 @@ filesets-file-close (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)))) diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el index 582e495a2b..ef12352457 100644 --- a/lisp/progmodes/modula2.el +++ b/lisp/progmodes/modula2.el @@ -232,11 +232,11 @@ m2-smie-refine-semi ;; 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 @@ m2-smie-forward-token (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 @@ m2-smie-rules (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)) diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 13510eef80..cce5e17e79 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -1065,8 +1065,8 @@ octave-goto-function-definition (unless found (goto-char orig)) found)))) (pcase (and buffer-file-name (file-name-extension buffer-file-name)) - (`"cc" (funcall search - "\\_ 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 @@ prolog-electric--underscore (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. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index fad7bc1fb8..32130cee8e 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -612,7 +612,7 @@ ruby-smie-rules ;; 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 @@ ruby-smie-rules (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 @@ ruby-smie-rules (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 @@ ruby-backward-sexp (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 @@ ruby-backward-sexp (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) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index aaa86b5816..46c9e6ee65 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -959,8 +959,8 @@ sh--inside-noncommand-expression ;; ((...)) 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 @@ sh-smie-sh-rules (`(: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 @@ sh-smie-sh-rules `(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 @@ sh-smie-sh-rules (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 @@ sh-smie-sh-rules ;; 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 @@ sh-smie-rc-rules (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 @@ sh-smie-rc-rules ;; 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. )) diff --git a/lisp/server.el b/lisp/server.el index 50684a20aa..d0a8ca313e 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1112,16 +1112,16 @@ server-execute-continuation (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 @@ server-execute-continuation ;; -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 @@ server-execute-continuation ;; -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 @@ server-execute-continuation ;; -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 @@ server-execute-continuation ;; -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 @@ server-execute-continuation "")))))) ;; -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 @@ server-execute-continuation (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 @@ server-execute-continuation (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))) diff --git a/lisp/subr.el b/lisp/subr.el index 41dc9aa45f..aaf8909e0c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4815,7 +4815,7 @@ called-interactively-p 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) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 31ce638b31..63c86317ee 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1219,7 +1219,7 @@ css-smie-rules (`(: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 ";") diff --git a/test/lisp/emacs-lisp/pcase-tests.el b/test/lisp/emacs-lisp/pcase-tests.el index 774a488255..c706c1051e 100644 --- a/test/lisp/emacs-lisp/pcase-tests.el +++ b/test/lisp/emacs-lisp/pcase-tests.el @@ -53,7 +53,7 @@ pcase-tests-grep (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 -- 2.19.1 --=-=-= Content-Type: text/plain Thanks, Michael. --=-=-=--