From: Mattias Engdegård Date: Sat, 27 Aug 2022 12:20:38 +0000 (+0200) Subject: Use `eql` or `eq` instead of `=` in some places X-Git-Tag: emacs-29.0.90~1856^2~488 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=824ae5faeec9cfa5e14e750030d55800b08ad7f2;p=emacs.git Use `eql` or `eq` instead of `=` in some places For a switch op to be generated, comparisons must be made using `eq`, `eql` or `equal`, not `=`. * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): * lisp/files.el (file-modes-char-to-who, file-modes-char-to-right): * lisp/international/titdic-cnv.el (tit-process-header): * lisp/language/ethio-util.el (ethio-input-special-character) (ethio-fidel-to-tex-buffer): * lisp/language/lao.el (consonant): Use `eq` or `eql` instead of `=`. In these cases either `eq` or `eql` would do and the choice does not affect the resulting code. We compare numbers with `eql` and characters with `eq` as a matter of style. --- diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 27b0d33d3ef..0d5f8c26eb2 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1999,20 +1999,20 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." (setq keep-going t) (setq tmp (aref byte-stack+-info (symbol-value (car lap0)))) (setq rest (cdr rest)) - (cond ((= tmp 1) + (cond ((eql tmp 1) (byte-compile-log-lap " %s discard\t-->\t" lap0) (setq lap (delq lap0 (delq lap1 lap)))) - ((= tmp 0) + ((eql tmp 0) (byte-compile-log-lap " %s discard\t-->\t discard" lap0) (setq lap (delq lap0 lap))) - ((= tmp -1) + ((eql tmp -1) (byte-compile-log-lap " %s discard\t-->\tdiscard discard" lap0) (setcar lap0 'byte-discard) (setcdr lap0 0)) - ((error "Optimizer error: too much on the stack")))) + (t (error "Optimizer error: too much on the stack")))) ;; ;; goto*-X X: --> X: ;; diff --git a/lisp/files.el b/lisp/files.el index 540bc2a6a85..0f2d3ca4b9a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -8271,10 +8271,10 @@ CHAR is in [ugoa] and represents the category of users (Owner, Group, Others, or All) for whom to produce the mask. The bit-mask that is returned extracts from mode bits the access rights for the specified category of users." - (cond ((= char ?u) #o4700) - ((= char ?g) #o2070) - ((= char ?o) #o1007) - ((= char ?a) #o7777) + (cond ((eq char ?u) #o4700) + ((eq char ?g) #o2070) + ((eq char ?o) #o1007) + ((eq char ?a) #o7777) (t (error "%c: Bad `who' character" char)))) (defun file-modes-char-to-right (char &optional from) @@ -8282,22 +8282,22 @@ for the specified category of users." CHAR is in [rwxXstugo] and represents symbolic access permissions. If CHAR is in [Xugo], the value is taken from FROM (or 0 if omitted)." (or from (setq from 0)) - (cond ((= char ?r) #o0444) - ((= char ?w) #o0222) - ((= char ?x) #o0111) - ((= char ?s) #o6000) - ((= char ?t) #o1000) + (cond ((eq char ?r) #o0444) + ((eq char ?w) #o0222) + ((eq char ?x) #o0111) + ((eq char ?s) #o6000) + ((eq char ?t) #o1000) ;; Rights relative to the previous file modes. - ((= char ?X) (if (= (logand from #o111) 0) 0 #o0111)) - ((= char ?u) (let ((uright (logand #o4700 from))) - ;; FIXME: These divisions/shifts seem to be right - ;; for the `7' part of the #o4700 mask, but not - ;; for the `4' part. Same below for `g' and `o'. - (+ uright (/ uright #o10) (/ uright #o100)))) - ((= char ?g) (let ((gright (logand #o2070 from))) - (+ gright (/ gright #o10) (* gright #o10)))) - ((= char ?o) (let ((oright (logand #o1007 from))) - (+ oright (* oright #o10) (* oright #o100)))) + ((eq char ?X) (if (= (logand from #o111) 0) 0 #o0111)) + ((eq char ?u) (let ((uright (logand #o4700 from))) + ;; FIXME: These divisions/shifts seem to be right + ;; for the `7' part of the #o4700 mask, but not + ;; for the `4' part. Same below for `g' and `o'. + (+ uright (/ uright #o10) (/ uright #o100)))) + ((eq char ?g) (let ((gright (logand #o2070 from))) + (+ gright (/ gright #o10) (* gright #o10)))) + ((eq char ?o) (let ((oright (logand #o1007 from))) + (+ oright (* oright #o10) (* oright #o100)))) (t (error "%c: Bad right character" char)))) (defun file-modes-rights-to-number (rights who-mask &optional from) diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 080045e7520..d2a6ee1e9d1 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -281,7 +281,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, (while (not (eobp)) (let ((ch (following-char)) (pos (point))) - (cond ((= ch ?C) ; COMMENT + (cond ((eq ch ?C) ; COMMENT (cond ((looking-at "COMMENT") (let ((pos (match-end 0)) (to (progn (end-of-line) (point)))) @@ -295,7 +295,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, (setq tit-comments (cons (buffer-substring-no-properties pos (point)) tit-comments)))))) - ((= ch ?M) ; MULTICHOICE, MOVERIGHT, MOVELEFT + ((eq ch ?M) ; MULTICHOICE, MOVERIGHT, MOVELEFT (cond ((looking-at "MULTICHOICE:[ \t]*") (goto-char (match-end 0)) (setq tit-multichoice (looking-at "YES"))) @@ -305,7 +305,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, ((looking-at "MOVELEFT:[ \t]*") (goto-char (match-end 0)) (setq tit-moveleft (tit-read-key-value))))) - ((= ch ?P) ; PROMPT + ((eq ch ?P) ; PROMPT (cond ((looking-at "PROMPT:[ \t]*") (goto-char (match-end 0)) (setq tit-prompt (tit-read-key-value)) @@ -316,7 +316,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, (if (or (eq (nth 1 split) 32) (eq (nth 2 split) 32)) (setq tit-prompt (substring tit-prompt 0 -1))))))) - ((= ch ?B) ; BACKSPACE, BEGINDICTIONARY, + ((eq ch ?B) ; BACKSPACE, BEGINDICTIONARY, ; BEGINPHRASE (cond ((looking-at "BACKSPACE:[ \t]*") (goto-char (match-end 0)) @@ -325,7 +325,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, (setq tit-dictionary t)) ((looking-at "BEGINPHRASE") (setq tit-dictionary nil)))) - ((= ch ?K) ; KEYPROMPT + ((eq ch ?K) ; KEYPROMPT (cond ((looking-at "KEYPROMPT(\\(.*\\)):[ \t]*") (let ((key-char (match-string 1))) (goto-char (match-end 0)) diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el index a0159679da2..2f76acfe7cb 100644 --- a/lisp/language/ethio-util.el +++ b/lisp/language/ethio-util.el @@ -794,15 +794,15 @@ The 2nd and 3rd arguments BEGIN and END specify the region." "This function is deprecated." (interactive "*cInput number: 1.ö ‡ 2.ö ‡‚ 3.ö ‡ƒ 4.ö ‡„ 5.ö ‡€") (cond - ((= arg ?1) + ((eq arg ?1) (insert "ö ‡")) - ((= arg ?2) + ((eq arg ?2) (insert "ö ‡‚")) - ((= arg ?3) + ((eq arg ?3) (insert "ö ‡ƒ")) - ((= arg ?4) + ((eq arg ?4) (insert "ö ‡„")) - ((= arg ?5) + ((eq arg ?5) (insert "ö ‡€")) (t (error "")))) @@ -816,7 +816,7 @@ The 2nd and 3rd arguments BEGIN and END specify the region." "Convert each fidel characters in the current buffer into a fidel-tex command." (interactive) (let ((buffer-read-only nil) - comp ch) + comp) ;; Special treatment for geminated characters. ;; Geminated characters la", etc. change into \geminateG{\laG}, etc. @@ -835,21 +835,22 @@ The 2nd and 3rd arguments BEGIN and END specify the region." ;; Special Ethiopic punctuation. (goto-char (point-min)) (while (re-search-forward "\\ce[».?]\\|«\\ce" nil t) - (cond - ((= (setq ch (preceding-char)) ?\») - (delete-char -1) - (insert "\\rquoteG")) - ((= ch ?.) - (delete-char -1) - (insert "\\dotG")) - ((= ch ??) - (delete-char -1) - (insert "\\qmarkG")) - (t - (forward-char -1) - (delete-char -1) - (insert "\\lquoteG") - (forward-char 1)))) + (let ((ch (preceding-char))) + (cond + ((eq ch ?\») + (delete-char -1) + (insert "\\rquoteG")) + ((eq ch ?.) + (delete-char -1) + (insert "\\dotG")) + ((eq ch ??) + (delete-char -1) + (insert "\\qmarkG")) + (t + (forward-char -1) + (delete-char -1) + (insert "\\lquoteG") + (forward-char 1))))) ;; Ethiopic characters to TeX macros (robin-invert-region (point-min) (point-max) "ethiopic-tex") diff --git a/lisp/language/lao.el b/lisp/language/lao.el index 1861eff15eb..0ad5b9f84e3 100644 --- a/lisp/language/lao.el +++ b/lisp/language/lao.el @@ -60,9 +60,9 @@ (len (length chars)) ;; Replace `c', `t', `v' to consonant, tone, and vowel. (regexp (mapconcat (lambda (c) - (cond ((= c ?c) consonant) - ((= c ?t) tone) - ((= c ?v) vowel-upper-lower) + (cond ((eq c ?c) consonant) + ((eq c ?t) tone) + ((eq c ?v) vowel-upper-lower) (t (string c)))) (cdr l) "")) ;; Element of composition-function-table.