emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/idris-mode d122a70fed 2/4: Simplify code by replacing `let


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode d122a70fed 2/4: Simplify code by replacing `let & if` expressions with `or`
Date: Wed, 11 Jan 2023 06:00:05 -0500 (EST)

branch: elpa/idris-mode
commit d122a70fedb0a800c1cd1a4fc734101b34ddeb7e
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>

    Simplify code by replacing `let & if` expressions with `or`
---
 idris-commands.el     | 14 +++-----------
 idris-common-utils.el |  4 +---
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/idris-commands.el b/idris-commands.el
index 501732db00..44e9cbfdfe 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -169,9 +169,7 @@
 Returning these as a cons."
   (let* ((fn (buffer-file-name))
          (ipkg-srcdir (idris-ipkg-find-src-dir))
-         (srcdir (if ipkg-srcdir
-                     ipkg-srcdir
-                   (file-name-directory fn))))
+         (srcdir (or ipkg-srcdir (file-name-directory fn))))
     (when (and  ;; check that srcdir is prefix of filename - then load relative
            (> (length fn) (length srcdir))
            (string= (substring fn 0 (length srcdir)) srcdir))
@@ -589,10 +587,7 @@ Otherwise, case split as a pattern variable."
                       (forward-line (1- (cdr what)))
                       (goto-char (line-beginning-position))
                       (re-search-forward "\\(^>?\\s-*\\)" nil t)
-                      (let ((prefix (match-string 1)))
-                        (if prefix
-                            prefix
-                          "")))))
+                      (or (match-string 1) ""))))
         ;; Go forward until we get to a line with equal or less indentation to
         ;; the type declaration, or the end of the buffer, and insert the
         ;; result
@@ -774,10 +769,7 @@ Idris 2 only."
                       (forward-line (1- (cdr what)))
                       (goto-char (line-beginning-position))
                       (re-search-forward "\\(^>?\\s-*\\)" nil t)
-                      (let ((prefix (match-string 1)))
-                        (if prefix
-                            prefix
-                          "")))))
+                      (or (match-string 1) ""))))
         (if (string= result "")
             (error "Nothing found")
           (goto-char (line-beginning-position))
diff --git a/idris-common-utils.el b/idris-common-utils.el
index e80c31c638..986f0dbdff 100644
--- a/idris-common-utils.el
+++ b/idris-common-utils.el
@@ -455,8 +455,6 @@ Does not return a line number."
               (cons (get-text-property (point) 'idris-ref)
                     (cl-loop for overlay in (overlays-at (point))
                              collecting (overlay-get overlay 'idris-ref))))))
-    (if (null ref)
-        (car (idris-thing-at-point))
-      (car ref))))
+    (car (or ref (idris-thing-at-point)))))
 
 (provide 'idris-common-utils)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]