summaryrefslogtreecommitdiff
path: root/with-editor.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2017-05-17 12:14:35 -0700
committerJonas Bernoulli <jonas@bernoul.li>2017-05-17 12:14:35 -0700
commit8c95e7de363715e8e38bbb4d9eac2dd63ac8b74e (patch)
tree9a693a9dbc7dfdefa51f09e4beb27628a41e5cf4 /with-editor.el
parentb37d94b7aa473bdaace7dee00230464921aa57d6 (diff)
Use when-let instead of macros from dash
Likewise, don't use `--if-let' when `or' works just as well.
Diffstat (limited to 'with-editor.el')
-rw-r--r--with-editor.el18
1 files 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)