diff options
author | Tianxiang Xiong <tianxiang.xiong@gmail.com> | 2017-12-11 01:17:50 -0800 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2017-12-11 16:09:54 +0000 |
commit | b34057a1944354cbd2100e2beb08d6c6e1e06da3 (patch) | |
tree | a033bdacf950d04623b1f78824c171ee7dceab07 /cider-util.el | |
parent | b484daa718c09c3d41e260878f93a35f05edb5b4 (diff) |
Replace `if-let` and `when-let` with starred versions
Fix #2130.
Emacs 26 obsoletes `if-let` and `when-let`, replacing them with `if-let*` and
`when-let*`. This raises byte-compilation warnings (treated as errors) when
testing against Emacs 26.
See: http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-26#n1278
Diffstat (limited to 'cider-util.el')
-rw-r--r-- | cider-util.el | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cider-util.el b/cider-util.el index 72f3bd34..a9909725 100644 --- a/cider-util.el +++ b/cider-util.el @@ -115,7 +115,7 @@ instead." "Return the name of the symbol at point, otherwise nil. Ignores the REPL prompt. If LOOK-BACK is non-nil, move backwards trying to find a symbol if there isn't one at point." - (or (when-let ((str (thing-at-point 'symbol))) + (or (when-let* ((str (thing-at-point 'symbol))) (unless (text-property-any 0 (length str) 'field 'cider-repl-prompt str) (substring-no-properties str))) (when look-back @@ -131,13 +131,13 @@ find a symbol if there isn't one at point." "Return the sexp at point as a string, otherwise nil. If BOUNDS is non-nil, return a list of its starting and ending position instead." - (when-let ((b (or (and (equal (char-after) ?\() - (member (char-before) '(?\' ?\, ?\@)) - ;; hide stuff before ( to avoid quirks with '( etc. - (save-restriction - (narrow-to-region (point) (point-max)) - (bounds-of-thing-at-point 'sexp))) - (bounds-of-thing-at-point 'sexp)))) + (when-let* ((b (or (and (equal (char-after) ?\() + (member (char-before) '(?\' ?\, ?\@)) + ;; hide stuff before ( to avoid quirks with '( etc. + (save-restriction + (narrow-to-region (point) (point-max)) + (bounds-of-thing-at-point 'sexp))) + (bounds-of-thing-at-point 'sexp)))) (funcall (if bounds #'list #'buffer-substring-no-properties) (car b) (cdr b)))) @@ -389,7 +389,7 @@ plugin or dependency with: (cider-add-to-alist 'cider-jack-in-lein-plugins \"plugin/artifact-name\" \"THE-NEW-VERSION\")" (let ((alist (symbol-value symbol))) - (if-let ((cons (assoc car alist))) + (if-let* ((cons (assoc car alist))) (setcdr cons (list cadr)) (set symbol (cons (list car cadr) alist))))) |