summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2024-11-12 18:58:14 +0000
committerjao <jao@gnu.org>2024-11-12 18:58:14 +0000
commit418212e4eb963813c078cf290cddfe7e3defd7ed (patch)
tree3c265c395b0afe67f88f5e18a34f368a88f970d6 /lib
parent8ddc2d688cd37693320e46aa3d35d72f06e5bab3 (diff)
downloadelibs-418212e4eb963813c078cf290cddfe7e3defd7ed.tar.gz
elibs-418212e4eb963813c078cf290cddfe7e3defd7ed.tar.bz2
Revert "{if,when}-let deprecation in emacs 31"main
This reverts commit 4308710de811e3b4e2fb47f9024439df03e96b90.
Diffstat (limited to 'lib')
-rw-r--r--lib/doc/jao-doc-session.el2
-rw-r--r--lib/doc/jao-doc-view.el13
-rw-r--r--lib/doc/jao-org-links.el2
-rw-r--r--lib/doc/jao-org-notes.el6
-rw-r--r--lib/eos/jao-afio.el4
-rw-r--r--lib/eos/jao-eshell-here.el6
-rw-r--r--lib/eos/jao-minibuffer.el4
-rw-r--r--lib/eos/jao-tracking.el2
-rw-r--r--lib/media/jao-mpc.el6
-rw-r--r--lib/media/jao-mpris.el9
-rw-r--r--lib/net/jao-eww-session.el8
-rw-r--r--lib/net/jao-notmuch-gnus.el16
-rw-r--r--lib/net/jao-notmuch.el16
-rw-r--r--lib/net/jao-proton-utils.el2
-rw-r--r--lib/prog/jao-compilation.el6
-rw-r--r--lib/themes/jao-themes.el2
16 files changed, 51 insertions, 53 deletions
diff --git a/lib/doc/jao-doc-session.el b/lib/doc/jao-doc-session.el
index 928cf26..877a8cb 100644
--- a/lib/doc/jao-doc-session.el
+++ b/lib/doc/jao-doc-session.el
@@ -36,7 +36,7 @@
(let ((docs '())
(cb (and skip-current (current-buffer))))
(dolist (b (buffer-list))
- (when-let* ((fs (and (not (eq cb b)) (jao-doc-session-is-doc b))))
+ (when-let (fs (and (not (eq cb b)) (jao-doc-session-is-doc b)))
(dolist (f fs) (add-to-list 'docs f))))
(when (or force (> (length docs) 0))
(setq jao-doc-session docs))))
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el
index 75c2bae..fe26c1d 100644
--- a/lib/doc/jao-doc-view.el
+++ b/lib/doc/jao-doc-view.el
@@ -1,6 +1,6 @@
;;; jao-doc-view.el -- extensions for doc-view -*- lexical-binding: t; -*-
-;; Copyright (c) 2013, 2015, 2017, 2018, 2019, 2021, 2022, 2024 Jose Antonio Ortega Ruiz
+;; Copyright (c) 2013, 2015, 2017, 2018, 2019, 2021, 2022 Jose Antonio Ortega Ruiz
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -49,20 +49,20 @@
(defvar-local jao-doc-view--trail-fwd ())
(defun jao-doc-view--trail-push (dest-page)
- (when-let* ((page (jao-doc-view-current-page)))
+ (when-let (page (jao-doc-view-current-page))
(unless (eq (car jao-doc-view--trail-back) page)
(push page jao-doc-view--trail-back))))
(defun jao-doc-view-back ()
(interactive nil doc-view-mode)
- (if-let* ((p (pop jao-doc-view--trail-back)))
+ (if-let (p (pop jao-doc-view--trail-back))
(progn (push (jao-doc-view-current-page) jao-doc-view--trail-fwd)
(jao-doc-view-goto-page p))
(message "No more back marks.")))
(defun jao-doc-view-forward ()
(interactive nil doc-view-mode)
- (if-let* ((p (pop jao-doc-view--trail-fwd)))
+ (if-let (p (pop jao-doc-view--trail-fwd))
(progn (push (jao-doc-view-current-page) jao-doc-view--trail-back)
(jao-doc-view-goto-page p))
(message "No more forward marks.")))
@@ -115,9 +115,8 @@
(cond ((eq 'wait urls) (message "Extracting text, please wait and retry."))
((zerop (length urls))
(message "No URLs in this %s" (if all "document" "page")))
- (t (when-let* ((url (completing-read "URL: " urls nil nil
- (when (null (cdr urls))
- (car urls)))))
+ (t (when-let (url (completing-read "URL: " urls nil nil
+ (when (null (cdr urls)) (car urls))))
(browse-url url))))))
;;; .
diff --git a/lib/doc/jao-org-links.el b/lib/doc/jao-org-links.el
index 4fefedd..88c0561 100644
--- a/lib/doc/jao-org-links.el
+++ b/lib/doc/jao-org-links.el
@@ -119,7 +119,7 @@
;;;###autoload
(defun jao-org-goto-pdf ()
(interactive)
- (if-let* ((f (jao-org-org-to-pdf-file)))
+ (if-let (f (jao-org-org-to-pdf-file))
(jao-org--pdf-open f nil)
(user-error "No PDF file associated with this buffer")))
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index e47f845..43b8c09 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -147,7 +147,7 @@
(defun jao-org-notes-open ()
"Search for a note file, matching tags and titles with completion."
(interactive)
- (when-let* ((f (jao-org-notes--consult-rg "Search notes: ")))
+ (when-let (f (jao-org-notes--consult-rg "Search notes: "))
(find-file f)))
(defun jao-org-notes-consult-tags ()
@@ -180,7 +180,7 @@
(file (completing-read "File: " res nil t nil))
(entry (assoc file res)))
(progn (find-file (cadr entry))
- (when-let* ((line (caddr entry))) (goto-line line)))
+ (when-let (line (caddr entry)) (goto-line line)))
(message "Nobody links here!")))
(defun jao-org-notes-insert-tags ()
@@ -191,7 +191,7 @@
(defun jao-org-notes-insert-link ()
"Select a note file (with completion) and insert a link to it."
(interactive)
- (when-let* ((f (jao-org-notes--consult-rg "Notes file: ")))
+ (when-let (f (jao-org-notes--consult-rg "Notes file: "))
(let ((rel-path (file-relative-name f default-directory))
(title (with-current-buffer (find-file-noselect f)
(save-excursion
diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el
index a5d9b24..b588989 100644
--- a/lib/eos/jao-afio.el
+++ b/lib/eos/jao-afio.el
@@ -86,7 +86,7 @@
(if (car docs)
(progn (switch-to-buffer (car docs))
(switch-to-buffer-other-window (or (cadr docs) (car docs))))
- (when-let* ((docs (jao-doc-session)))
+ (when-let (docs (jao-doc-session))
(when (y-or-n-p (format "Load saved session? (%d docs)" (length docs)))
(jao-afio-open-pdf-session docs))))))
@@ -96,7 +96,7 @@
(declare-function jao-eww-session-load "jao-eww-session")
(defun jao-afio--open-eww-session ()
- (if-let* ((b (jao-eww-session-eww-buffers)))
+ (if-let (b (jao-eww-session-eww-buffers))
(switch-to-buffer (car b))
(jao-eww-session-load)))
diff --git a/lib/eos/jao-eshell-here.el b/lib/eos/jao-eshell-here.el
index ad7805f..54d58f0 100644
--- a/lib/eos/jao-eshell-here.el
+++ b/lib/eos/jao-eshell-here.el
@@ -1,6 +1,6 @@
;;; jao-eshell-here.el --- Easy opening of eshell buffers -*- lexical-binding: t; -*-
-;; Copyright (C) 2021, 2023, 2024 jao
+;; Copyright (C) 2021, 2023 jao
;; Author: jao <mail@jao.io>
;; Keywords: eshell
@@ -33,8 +33,8 @@
"Value to use for `display-buffer-alist' when displaying the eshell buffer.")
(defun jao-eshell-here--find-window (b)
- (when-let* ((w (seq-find (lambda (w) (eq (window-buffer w) b))
- (window-list))))
+ (when-let (w (seq-find (lambda (w) (eq (window-buffer w) b))
+ (window-list)))
(select-window w)))
(defun jao-eshell-here--frame-buffer (&optional b)
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index d2bc70a..77bd49a 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -69,12 +69,12 @@
(insert msg)))
(defun jao-minibuffer--strip-prev (msg)
- (if-let* ((n (text-property-any 0 (length msg) 'minibuffer-message t msg)))
+ (if-let ((n (text-property-any 0 (length msg) 'minibuffer-message t msg)))
(string-trim (substring msg 0 n))
msg))
(defun jao-minibuffer--prefix (msgs)
- (when-let* ((p (string-join (butlast msgs) "\n")))
+ (when-let (p (string-join (butlast msgs) "\n"))
(unless (string-blank-p p) (concat p "\n"))))
(defun jao-minibuffer--format-msg (msg)
diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el
index a1fff73..2af868c 100644
--- a/lib/eos/jao-tracking.el
+++ b/lib/eos/jao-tracking.el
@@ -105,7 +105,7 @@
`(:propertize ,(plist-get s :propertize)
face
(jao-tracking-minibuffer
- ,@(when-let* ((f (plist-get s 'face)))
+ ,@(when-let ((f (plist-get s 'face)))
(jao-tracking-set-log " * ")
(list f))))
`(:propertize "|" face jao-tracking-minibuffer-sep)))
diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el
index ab8823f..4f5081c 100644
--- a/lib/media/jao-mpc.el
+++ b/lib/media/jao-mpc.el
@@ -125,7 +125,7 @@
(defvar jao-mpc--idle-procs nil)
(defun jao-mpc--idle-loop (&optional port)
- (when-let* ((proc (alist-get port jao-mpc--idle-procs)))
+ (when-let (proc (alist-get port jao-mpc--idle-procs))
(ignore-errors (kill-process proc)))
(setf (alist-get port jao-mpc--idle-procs nil t)
(make-process :name (format "jao-mpc-idleloop (%s)" port)
@@ -146,7 +146,7 @@
(read-only-mode 1))
(defun jao-mpc--album-buffer ()
- (if-let* ((b (get-buffer jao-mpc--albums)))
+ (if-let (b (get-buffer jao-mpc--albums))
b
(with-current-buffer (get-buffer-create jao-mpc--albums)
(jao-mpc-albums-mode)
@@ -331,7 +331,7 @@
(jao-mpc--cmd jao-mpc--simple-albums-cmd port)
albums-str))
(albums (split-string albums-str "\n" t)))
- (when-let* ((album (completing-read "Play album: " albums nil t)))
+ (when-let (album (completing-read "Play album: " albums nil t))
(jao-mpc--add-and-play (car (split-string album "-" t " ")) port))))
(provide 'jao-mpc)
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index f2974ab..3bb2636 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -97,7 +97,7 @@
jao-mpris--current nil))
(defun jao-mpris--get (k &optional l)
- (when-let* ((v (alist-get k (or l jao-mpris--current))))
+ (when-let (v (alist-get k (or l jao-mpris--current)))
(if (consp v) (car v) v)))
(defun jao-mpris--set-current (k v)
@@ -146,7 +146,7 @@
(interactive "P")
(when refresh (jao-mpris--track))
(when jao-mpris--current
- (jao-notify (format "%s%s" (if-let* ((s (jao-mpris--get 'status)))
+ (jao-notify (format "%s%s" (if-let (s (jao-mpris--get 'status))
(format "%s: " s)
"")
(jao-mpris--format)))))
@@ -159,7 +159,7 @@
(defun jao-mpris--handler (iname properties &rest _args)
(let ((inhibit-message t))
(message "Received properties: %S from %s" properties iname))
- (when-let* ((md (caadr (assoc "Metadata" properties))))
+ (when-let (md (caadr (assoc "Metadata" properties)))
(let ((tno (caadr (assoc "xesam:trackNumber" md)))
(tlt (caadr (assoc "xesam:title" md)))
(art (caadr (assoc "xesam:artist" md)))
@@ -172,8 +172,7 @@
(jao-mpris--set-current 'artist art)
(jao-mpris--set-current 'album alb)
(jao-mpris--set-current 'length len))))
- (when-let* ((st (or (caadr (assoc "PlaybackStatus" properties))
- (jao-mpris--get 'status))))
+ (when-let (st (caadr (assoc "PlaybackStatus" properties)))
(jao-mpris--set-current 'status st)
(when (string= st "Stopped")
(dolist (k '(track title artist album length))
diff --git a/lib/net/jao-eww-session.el b/lib/net/jao-eww-session.el
index 3c60cf8..4ac5447 100644
--- a/lib/net/jao-eww-session.el
+++ b/lib/net/jao-eww-session.el
@@ -97,7 +97,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(jao-eww-session-eww-buffers (current-buffer))))
(defun jao-eww--current-url ()
- (when-let* ((url (eww-current-url))) (url-encode-url url)))
+ (when-let (url (eww-current-url)) (url-encode-url url)))
(defun jao-eww-session--current-urls (&optional skip-current)
(let ((urls)
@@ -107,7 +107,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(dolist (b (jao-eww-session-eww-buffers (when skip-current cb))
(list pos (reverse urls)))
(set-buffer b)
- (when-let* ((url (jao-eww--current-url)))
+ (when-let (url (jao-eww--current-url))
(when (eq b cb) (setq pos count))
(setq count (1+ count))
(push (cons url (jao-eww-buffer-title)) urls)))))
@@ -133,7 +133,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(seq-filter
(lambda (b)
(with-current-buffer b
- (when-let* ((url (jao-eww--current-url)))
+ (when-let (url (jao-eww--current-url))
(when (member url urls)
(when (y-or-n-p "Already open session, abort? ")
(switch-to-buffer b)
@@ -218,7 +218,7 @@ the session is already displayed in a eww tab, jao-eww-session can:
(defun jao-eww-session-load ()
"Load last stored session into eww."
(interactive)
- (when-let* ((s (jao-eww-session-load-aux)))
+ (when-let ((s (jao-eww-session-load-aux)))
(let* ((urls (jao-eww-session-urls s))
(offset (jao-eww-session-offset s))
(buffers (unless (equal jao-eww-session-duplicate-tabs 'always)
diff --git a/lib/net/jao-notmuch-gnus.el b/lib/net/jao-notmuch-gnus.el
index 1a03613..f5cc3b2 100644
--- a/lib/net/jao-notmuch-gnus.el
+++ b/lib/net/jao-notmuch-gnus.el
@@ -62,7 +62,7 @@
(defun jao-notmuch-gnus-show-tags ()
"Display in the echo area the tags of the current message."
(interactive)
- (when-let* ((id (jao-notmuch-gnus-message-id)))
+ (when-let (id (jao-notmuch-gnus-message-id))
(message "%s" (string-join (jao-notmuch-gnus-message-tags id) " "))))
(defun jao-notmuch-gnus-toggle-tags (tags &optional id current)
@@ -77,7 +77,7 @@
(defun jao-notmuch-gnus-tag-mark ()
"Remove the new tag for an article when it's marked as seen by Gnus."
- (when-let* ((id (jao-notmuch-gnus-message-id t)))
+ (when-let (id (jao-notmuch-gnus-message-id t))
(jao-notmuch-gnus-tag-message id '("-new") t)))
(add-hook 'gnus-mark-article-hook #'jao-notmuch-gnus-tag-mark)
@@ -191,12 +191,12 @@ Example:
(org-gnus-follow-link group id)))
(defun jao-notmuch-gnus-org-store ()
- (when-let* ((d (or (when (derived-mode-p 'notmuch-show-mode 'notmuch-tree-mode)
- (cons (notmuch-show-get-message-id)
- (notmuch-show-get-subject)))
- (when (derived-mode-p 'gnus-summary-mode 'gnus-article-mode)
- (cons (jao-notmuch-gnus-message-id)
- (gnus-summary-article-subject))))))
+ (when-let (d (or (when (derived-mode-p 'notmuch-show-mode 'notmuch-tree-mode)
+ (cons (notmuch-show-get-message-id)
+ (notmuch-show-get-subject)))
+ (when (derived-mode-p 'gnus-summary-mode 'gnus-article-mode)
+ (cons (jao-notmuch-gnus-message-id)
+ (gnus-summary-article-subject)))))
(org-link-store-props :type "mail"
:link (concat "mail:" (car d))
:description (concat "Mail: " (cdr d)))))
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 2dc4b70..aef9757 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -69,7 +69,7 @@
(user-error "No tree view for this buffer")))
(defun jao-notmuch-tree--looking-at-message ()
- (when-let* ((id (plist-get (notmuch-tree-get-message-properties) :id)))
+ (when-let (id (plist-get (notmuch-tree-get-message-properties) :id))
(equal (concat "*notmuch-id:" id "*")
(buffer-name (window-buffer notmuch-tree-message-window)))))
@@ -105,7 +105,7 @@
(goto-char (point-min))
(let ((pos (point)))
(while (setq pos (next-single-property-change pos 'w3m-href-anchor))
- (when-let* ((url (get-text-property pos 'w3m-href-anchor)))
+ (when-let ((url (get-text-property pos 'w3m-href-anchor)))
(when (stringp url) (cl-pushnew url res :test #'string=))))
(seq-uniq res #'string=))))
@@ -117,7 +117,7 @@
(defun jao-notmuch-browse-urls (&optional external)
(interactive "P")
- (if-let* ((urls (jao-notmuch-message-urls)))
+ (if-let ((urls (jao-notmuch-message-urls)))
(funcall (if external browse-url-secondary-browser-function #'browse-url)
(completing-read "Browse URL: " urls))
(message "No URLs in this message")))
@@ -131,22 +131,22 @@
(interactive)
(when (get-text-property (point) 'w3m-href-anchor)
(goto-char (next-single-property-change (point) 'w3m-href-anchor)))
- (if-let* ((pos (next-single-property-change (point) 'w3m-href-anchor)))
+ (if-let (pos (next-single-property-change (point) 'w3m-href-anchor))
(goto-char pos)
(or (forward-button 1 nil t t)
(ffap-next-guess))))
(defun jao-notmuch-show-previous-button ()
(interactive)
- (if-let* ((pos (previous-single-property-change (point) 'w3m-href-anchor)))
+ (if-let (pos (previous-single-property-change (point) 'w3m-href-anchor))
(goto-char (previous-single-property-change pos 'w3m-href-anchor))
(or (backward-button 1 nil t t)
(ffap-next-guess t))))
(defun jao-notmuch-show-ret ()
(interactive)
- (when-let* ((url (or (get-text-property (point) 'w3m-href-anchor)
- (thing-at-point-url-at-point))))
+ (when-let (url (or (get-text-property (point) 'w3m-href-anchor)
+ (thing-at-point-url-at-point)))
(browse-url url)))
@@ -215,7 +215,7 @@
;;; header line with thread message counts
(defun jao-notmuch--looking-at-new-p (&optional p)
- (when-let* ((ts (if p (plist-get p :tags) (notmuch-show-get-tags))))
+ (when-let (ts (if p (plist-get p :tags) (notmuch-show-get-tags)))
(or (member "unread" ts) (member "new" ts))))
(defsubst jao-notmuch-tree--first-p (&optional msg)
diff --git a/lib/net/jao-proton-utils.el b/lib/net/jao-proton-utils.el
index 0c9ccd7..62b97b3 100644
--- a/lib/net/jao-proton-utils.el
+++ b/lib/net/jao-proton-utils.el
@@ -86,7 +86,7 @@
(jao-proton-vpn--do "s"))
(defun proton-vpn--get-status ()
- (or (when-let* ((b (get-buffer jao-proton-vpn--buffer)))
+ (or (when-let ((b (get-buffer jao-proton-vpn--buffer)))
(with-current-buffer b
(goto-char (point-min))
(if (re-search-forward "^Status: *\\(.+\\)$" nil t)
diff --git a/lib/prog/jao-compilation.el b/lib/prog/jao-compilation.el
index 5bea68e..c099701 100644
--- a/lib/prog/jao-compilation.el
+++ b/lib/prog/jao-compilation.el
@@ -67,7 +67,7 @@
;;;###autoload
(defun jao-compilation-root (&optional dir)
- (when-let* ((rfn (jao-compilation-find-root (or dir (buffer-file-name))
+ (when-let ((rfn (jao-compilation-find-root (or dir (buffer-file-name))
jao-compilation-dominating-rx)))
(let* ((default-directory (expand-file-name rfn))
(dir (file-name-directory rfn))
@@ -80,13 +80,13 @@
;;;###autoload
(defun jao-compilation-root-file ()
- (when-let* ((dir (jao-compilation-root)))
+ (when-let ((dir (jao-compilation-root)))
(car (directory-files dir nil jao-compilation-dominating-rx))))
;;;###autoload
(defun jao-find-compilation-root (dir)
(when (and (stringp dir) (file-exists-p dir))
- (when-let* ((root (jao-compilation-root dir)))
+ (when-let ((root (jao-compilation-root dir)))
(cons 'transient root))))
;;;###autoload
diff --git a/lib/themes/jao-themes.el b/lib/themes/jao-themes.el
index 706427b..58d32a0 100644
--- a/lib/themes/jao-themes.el
+++ b/lib/themes/jao-themes.el
@@ -1189,7 +1189,7 @@
(push df fs)))))
(defun jao-themes--adjust-palette (p s)
- (if-let* ((v (alist-get s p))) (cons (cons s (car v)) (assoc-delete-all s p)) p))
+ (if-let (v (alist-get s p)) (cons (cons s (car v)) (assoc-delete-all s p)) p))
(defun jao-themes--let-palette (palette)
(let ((palette (seq-reduce #'jao-themes--adjust-palette '(fg bg box) palette)))