From: Eshel Yaron Date: Sat, 19 Oct 2024 14:33:25 +0000 (+0200) Subject: Fix some unreachable code X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fa2352e8f3bc0e9f8591ceed81a85ec6c409ffac;p=emacs.git Fix some unreachable code --- diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index ed5f239383b..94045581e27 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -9394,8 +9394,7 @@ contain more up-to-date information, even for older versions." (cdr (setq erc--news-temp-file (cons (time-add (current-time) (* 60 60 12)) tempfile)))))) - (and-let* ((file (or (eval-when-compile (macroexp-file-name)) - (locate-library "erc"))) + (and-let* ((file (or load-file-name (locate-library "erc"))) (dir (file-name-directory file)) (adjacent (expand-file-name "ERC-NEWS" dir)) ((file-exists-p adjacent))) @@ -9524,9 +9523,16 @@ SOFTP, only do so when defined as a variable." (let* ((catname (symbol-name ,catalog)) (prefix (if (eq ?- (aref catname 0)) "erc--message" "erc-message-")) (name (concat prefix catname "-" (symbol-name ,key)))) - (if ,softp - (and-let* ((s (intern-soft name)) ((boundp s))) s) - (intern name))))) + ,(cond + ((byte-compile-trueconstp softp) + (inline-quote (and-let* ((s (intern-soft name)) ((boundp s))) s))) + ((byte-compile-nilconstp softp) + (inline-quote (intern name))) + (t + (inline-quote + (if ,softp + (and-let* ((s (intern-soft name)) ((boundp s))) s) + (intern name)))))))) (defun erc-make-message-variable-name (catalog entry) "Create a variable name corresponding to CATALOG's ENTRY." diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index 7992eb699f2..20132d54f5d 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -596,9 +596,10 @@ We prefer the earliest unique letter." (downcase name) (upcase name)) while (gethash char taken) - finally (progn - (setf (gethash char taken) t) - (cl-return (string char)))) + finally return + (progn + (setf (gethash char taken) t) + (string char))) entry))) (defun emoji--compute-name (entry) diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index a448aa494bc..221bc5b25fd 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -157,18 +157,18 @@ :ascii-compatible-p t :code-space [0 255] :map ,map) - (if ,iso-symbol - (define-charset ,iso-symbol - (if ,iso-ir - (format "Right-Hand Part of %s (%s): ISO-IR-%d" - ,name ,nickname ,iso-ir) - (format "Right-Hand Part of %s (%s)" ,name ,nickname)) - :short-name (format "RHP of %s" ,name) - :long-name (format "RHP of %s (%s)" ,name ,nickname) - :iso-final-char ,iso-final - :emacs-mule-id ,emacs-mule-id - :code-space [32 127] - :subset (list ,symbol 160 255 -128))))) + ,@(when iso-symbol + `((define-charset ,iso-symbol + ,(if iso-ir + `(format "Right-Hand Part of %s (%s): ISO-IR-%d" + ,name ,nickname ,iso-ir) + `(format "Right-Hand Part of %s (%s)" ,name ,nickname)) + :short-name (format "RHP of %s" ,name) + :long-name (format "RHP of %s (%s)" ,name ,nickname) + :iso-final-char ,iso-final + :emacs-mule-id ,emacs-mule-id + :code-space [32 127] + :subset (list ,symbol 160 255 -128)))))) (define-iso-single-byte-charset 'iso-8859-2 'latin-iso8859-2 "ISO/IEC 8859/2" "Latin-2" 101 ?B 130 "8859-2") diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 50ed8753604..fbaad252100 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -629,38 +629,6 @@ Priority order for recognizing coding systems when reading files:\n") (princ "\n Other coding systems cannot be distinguished automatically from these, and therefore cannot be recognized automatically with the present coding system priorities.\n\n") - - ;; Fixme: should this be replaced or junked? - (if nil - (let ((categories '(coding-category-iso-7 coding-category-iso-7-else)) - coding-system codings) - (while categories - (setq coding-system (symbol-value (car categories))) - (mapc - (lambda (x) - (if (and (not (eq x coding-system)) - (let ((flags (coding-system-get :flags))) - (not (or (memq 'use-roman flags) - (memq 'use-oldjis flags))))) - (setq codings (cons x codings)))) - (get (car categories) 'coding-systems)) - (if codings - (let ((max-col (window-width)) - pos) - (princ (format "\ - The following are decoded correctly but recognized as %s:\n " - coding-system)) - (while codings - (setq pos (point)) - (insert (format " %s" (car codings))) - (when (> (current-column) max-col) - (goto-char pos) - (insert "\n ") - (goto-char (point-max))) - (setq codings (cdr codings))) - (insert "\n\n"))) - (setq categories (cdr categories))))) - (princ "Particular coding systems specified for certain file names:\n") (terpri) (princ " OPERATION\tTARGET PATTERN\t\tCODING SYSTEM(s)\n") diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el index 140d0d4ce2d..1bc4111e79e 100644 --- a/lisp/mail/supercite.el +++ b/lisp/mail/supercite.el @@ -1634,11 +1634,11 @@ header style to use, unless not supplied or invalid, in which case ((< index 0) (if sc-electric-circular-p (1- last) - (progn (error msg "preced") 0))) + (error msg "preced"))) ((>= index last) (if sc-electric-circular-p 0 - (progn (error msg "follow") (1- last)))))) + (error msg "follow"))))) (with-current-buffer sc-electric-bufname (let ((inhibit-read-only t)) (erase-buffer) diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index da8ccdbcdfa..3c198398012 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -4167,52 +4167,45 @@ directory, so that Emacs will know its current contents." ;; Trashing directories does not work yet, because ;; `rename-file', called in `move-file-to-trash', does not ;; handle directories. - (if nil ; (and delete-by-moving-to-trash trash) - ;; Move non-empty dir to trash only if recursive deletion was - ;; requested. - (if (not (or recursive (directory-empty-p dir))) - (signal 'ftp-error - (list "Directory is not empty, not moving to trash")) - (move-file-to-trash dir)) - (let ((parsed (ange-ftp-ftp-name dir))) - (if recursive - (mapc - (lambda (file) - (if (file-directory-p file) - (ange-ftp-delete-directory file recursive) - (delete-file file))) - (directory-files dir 'full directory-files-no-dot-files-regexp))) - (if parsed - (let* ((host (nth 0 parsed)) - (user (nth 1 parsed)) - ;; Some ftp's on unix machines (at least on Suns) - ;; insist that rmdir take a filename, and not a - ;; directory-name name as an arg. Argh!! This is a bug. - ;; Non-unix machines will probably always insist - ;; that rmdir takes a directory-name as an arg - ;; (as the ftp man page says it should). - (name (ange-ftp-quote-string - (if (eq (ange-ftp-host-type host) 'unix) - (ange-ftp-real-directory-file-name - (nth 2 parsed)) - (ange-ftp-real-file-name-as-directory - (nth 2 parsed))))) - (abbr (ange-ftp-abbreviate-filename dir)) - (result - (progn - ;; CWD must not in this directory. - (ange-ftp-cd host user "/" 'noerror) - (ange-ftp-send-cmd host user - (list 'rmdir name) - (format "Removing directory %s" - abbr))))) - (or (car result) - (ange-ftp-error host user - (format "Could not remove directory %s: %s" - dir - (cdr result)))) - (ange-ftp-delete-file-entry dir t)) - (ange-ftp-real-delete-directory dir recursive trash)))) + (let ((parsed (ange-ftp-ftp-name dir))) + (if recursive + (mapc + (lambda (file) + (if (file-directory-p file) + (ange-ftp-delete-directory file recursive) + (delete-file file))) + (directory-files dir 'full directory-files-no-dot-files-regexp))) + (if parsed + (let* ((host (nth 0 parsed)) + (user (nth 1 parsed)) + ;; Some ftp's on unix machines (at least on Suns) + ;; insist that rmdir take a filename, and not a + ;; directory-name name as an arg. Argh!! This is a bug. + ;; Non-unix machines will probably always insist + ;; that rmdir takes a directory-name as an arg + ;; (as the ftp man page says it should). + (name (ange-ftp-quote-string + (if (eq (ange-ftp-host-type host) 'unix) + (ange-ftp-real-directory-file-name + (nth 2 parsed)) + (ange-ftp-real-file-name-as-directory + (nth 2 parsed))))) + (abbr (ange-ftp-abbreviate-filename dir)) + (result + (progn + ;; CWD must not in this directory. + (ange-ftp-cd host user "/" 'noerror) + (ange-ftp-send-cmd host user + (list 'rmdir name) + (format "Removing directory %s" + abbr))))) + (or (car result) + (ange-ftp-error host user + (format "Could not remove directory %s: %s" + dir + (cdr result)))) + (ange-ftp-delete-file-entry dir t)) + (ange-ftp-real-delete-directory dir recursive trash))) (error "Not a directory: %s" dir))) ;; Make a local copy of FILE and return its name. diff --git a/lisp/net/imap.el b/lisp/net/imap.el index 614fc56b513..f8cd02ff332 100644 --- a/lisp/net/imap.el +++ b/lisp/net/imap.el @@ -599,8 +599,7 @@ sure of changing the value of `foo'." t) ;; GNU SASL may print 'Trying ...' first. (or (not (looking-at "Trying ")) - (forward-line) - t) + (forward-line)) (not (and (imap-parse-greeting) ;; success in imtest 1.6: (re-search-forward @@ -2177,8 +2176,7 @@ Return nil if no complete line has arrived." (pcase (setq token (read (current-buffer))) ('+ (setq imap-continuation (or (buffer-substring (min (point-max) (1+ (point))) - (point-max)) - t))) + (point-max))))) ('* (pcase (prog1 (setq token (read (current-buffer))) (imap-forward)) ('OK (imap-parse-resp-text)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index f04e74db89c..8823856f099 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4006,8 +4006,7 @@ cannot be expanded, this function returns nil." (or (if vec (concat "2>" (tramp-get-remote-null-device vec)) (if (eq system-type 'windows-nt) "" - (concat "2>" null-device))) - (throw 'wont-work nil)))) + (concat "2>" null-device)))))) (ls (when (string-match-p (rx (| bol (not "%")) "%l") script) (format "%s %s" (or (tramp-get-ls-command vec) diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el index 54422d43cd7..236819c0cc0 100644 --- a/lisp/net/zeroconf.el +++ b/lisp/net/zeroconf.el @@ -416,17 +416,6 @@ TYPE. The resulting list has the format (setcar elt (dbus-byte-array-to-string (car elt))) (setq elt (cdr elt))) - (when nil ;; We discard it, no use so far. - ;; Register a service resolver. - (let ((object-path (zeroconf-register-service-resolver name type))) - ;; Register the signals. - (dolist (member '("Found" "Failure")) - (dbus-register-signal - :system zeroconf-service-avahi object-path - zeroconf-interface-avahi-service-resolver member - 'zeroconf-service-resolver-handler))) - ) - ;; Return the resolved service. (puthash key result zeroconf-resolved-services-hash)))))) diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el index 980a7109538..c222cd03c71 100644 --- a/lisp/org/ob-lua.el +++ b/lisp/org/ob-lua.el @@ -246,9 +246,7 @@ then create. Return the initialized session." (defun org-babel-lua-initiate-session (&optional session _params) "Create a session named SESSION according to PARAMS." (unless (string= session "none") - (error "Sessions currently not supported, work in progress") - (org-babel-lua-session-buffer - (org-babel-lua-initiate-session-by-key session)))) + (error "Sessions currently not supported, work in progress"))) (defvar org-babel-lua-eoe-indicator "--eoe" "A string to indicate that evaluation has completed.") diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index fe143b039ff..69db023076a 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el @@ -358,9 +358,7 @@ matching a regular expression." (file-name-nondirectory (buffer-file-name (or (buffer-base-buffer) - (current-buffer) - (and (org-src-edit-buffer-p) - (org-src-source-buffer)))))) + (current-buffer))))) ;; run `org-babel-post-tangle-hook' in all tangled files (when org-babel-post-tangle-hook (mapc diff --git a/lisp/org/ol-irc.el b/lisp/org/ol-irc.el index b263e52db61..862587ed2a6 100644 --- a/lisp/org/ol-irc.el +++ b/lisp/org/ol-irc.el @@ -176,7 +176,7 @@ the session itself." :link (concat "irc:/" link-text) :description (concat "irc session `" link-text "'") :server (car (car link)) - :port (or (string-to-number (cadr (pop link))) erc-default-port) + :port (or (string-to-number (cadr (pop link)))) :nick (pop link)) t) (error "Failed to create ('irc:/' style) ERC link"))))) diff --git a/lisp/org/org-element-ast.el b/lisp/org/org-element-ast.el index f3f74928004..008a2e2cde4 100644 --- a/lisp/org/org-element-ast.el +++ b/lisp/org/org-element-ast.el @@ -385,21 +385,25 @@ Ignore standard property array." (pcase (org-element-type ,node) (`nil ,dflt) (`plain-text - (or (get-text-property 0 ,property ,node) - (when ,dflt - (if - ;; FIXME: Byte-compiler throws false positives in Emacs 27. - (with-no-warnings - (plist-member (text-properties-at 0 ,node) ,property)) - nil ,dflt)))) + ,(if (byte-compile-nilconstp dflt) + (inline-quote (get-text-property 0 ,property ,node)) + (inline-quote + (or (get-text-property 0 ,property ,node) + (if + ;; FIXME: Byte-compiler throws false positives in Emacs 27. + (with-no-warnings + (plist-member (text-properties-at 0 ,node) ,property)) + nil ,dflt))))) (_ - (or (plist-get (nth 1 ,node) ,property) - (when ,dflt - (if - ;; FIXME: Byte-compiler throws false positives in Emacs 27. - (with-no-warnings - (plist-member (nth 1 ,node) ,property)) - nil ,dflt)))))))) + ,(if (byte-compile-nilconstp dflt) + (inline-quote (plist-get (nth 1 ,node) ,property)) + (inline-quote + (or (plist-get (nth 1 ,node) ,property) + (if + ;; FIXME: Byte-compiler throws false positives in Emacs 27. + (with-no-warnings + (plist-member (nth 1 ,node) ,property)) + nil ,dflt))))))))) (define-inline org-element-property-raw (property node &optional dflt) "Extract the value for PROPERTY of an NODE.