[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-editor 8c95e7d 036/140: Use when-let instead of macro
From: |
Jonas Bernoulli |
Subject: |
[nongnu] elpa/with-editor 8c95e7d 036/140: Use when-let instead of macros from dash |
Date: |
Fri, 6 Aug 2021 12:51:15 -0400 (EDT) |
branch: elpa/with-editor
commit 8c95e7de363715e8e38bbb4d9eac2dd63ac8b74e
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Use when-let instead of macros from dash
Likewise, don't use `--if-let' when `or' works just as well.
---
with-editor.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/with-editor.el b/with-editor.el
index 13e0c6a..be1974c 100644
--- a/with-editor.el
+++ b/with-editor.el
@@ -82,6 +82,7 @@
(require 'cl-lib)
(require 'dash)
(require 'server)
+(require 'subr-x)
(require 'tramp)
(require 'tramp-sh nil t)
@@ -108,15 +109,14 @@
(defun with-editor-locate-emacsclient ()
"Search for a suitable Emacsclient executable."
- (--if-let (with-editor-locate-emacsclient-1 (with-editor-emacsclient-path) 3)
- it
- (display-warning 'with-editor (format "\
+ (or (with-editor-locate-emacsclient-1 (with-editor-emacsclient-path) 3)
+ (display-warning 'with-editor (format "\
Cannot determine a suitable Emacsclient
Determining an Emacsclient executable suitable for the
current Emacs instance failed. For more information
please see https://github.com/magit/magit/wiki/Emacsclient."))
- nil))
+ nil))
(defun with-editor-locate-emacsclient-1 (path depth)
(let* ((version-lst (-take depth (split-string emacs-version "\\.")))
@@ -140,7 +140,7 @@ please see
https://github.com/magit/magit/wiki/Emacsclient."))
(with-editor-locate-emacsclient-1 path (1- depth))))))
(defun with-editor-emacsclient-version (exec)
- (-when-let (1st-line (car (process-lines exec "--version")))
+ (when-let (1st-line (car (process-lines exec "--version")))
(cadr (split-string 1st-line))))
(defun with-editor-emacsclient-path ()
@@ -662,10 +662,10 @@ else like the former."
(defun with-editor-shell-command-read-args (prompt &optional async)
(let ((command (read-shell-command
prompt nil nil
- (--when-let (or buffer-file-name
- (and (eq major-mode 'dired-mode)
- (dired-get-filename nil t)))
- (file-relative-name it)))))
+ (when-let (file (or buffer-file-name
+ (and (eq major-mode 'dired-mode)
+ (dired-get-filename nil t))))
+ (file-relative-name file)))))
(list command
(if (or async (setq async (string-match-p "&[ \t]*\\'" command)))
(< (prefix-numeric-value current-prefix-arg) 0)
- [nongnu] elpa/with-editor ae23243 053/140: Cosmetics and typo fixes, (continued)
- [nongnu] elpa/with-editor ae23243 053/140: Cosmetics and typo fixes, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 1b7f6ef 055/140: Require pcase, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor fb9e560 057/140: .travis.yml: fail on byte compilation warnings, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor d68fe1c 061/140: make: rename and sanitize some variables, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 8d3d639 063/140: make: use ox-texinfo+-update-version-strings, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 05338d8 069/140: make: inject style switcher into generated html manual, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 04d59d6 070/140: Release version 2.7.1, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor a77813b 074/140: Update .gitignore, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor ab73c02 027/140: manual: adjust for ox-texinfo+ v1, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 8fa5cef 028/140: Remove spurious paranthesis from Makefile recipe, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 8c95e7d 036/140: Use when-let instead of macros from dash,
Jonas Bernoulli <=
- [nongnu] elpa/with-editor 1d34c65 047/140: Use user-error when appropriate, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 4d3d50b 049/140: with-editor--setup: create from code previously in with-editor, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor b591c28 050/140: with-editor-locate-emacsclient: don't assume version string length, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 99d3278 058/140: shell-command: enable with-editor-mode when appropriate, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 50b40a8 059/140: manual: enforce preservation of indentation, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor d34824c 009/140: add .mailmap file, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor fab38c4 016/140: with-editor-export-editor: don't suppress output during setup, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor e300dab 041/140: with-editor-locate-emacsclient: cosmetics, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 791f985 042/140: with-editor-locate-emacsclient: fix previous commit, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor b8641ac 054/140: with-editor-output-filter: don't assume default-directory is valid, Jonas Bernoulli, 2021/08/06