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

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

[nongnu] elpa/idris-mode f2c3bbaeff 6/7: Merge pull request #567 from ke


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode f2c3bbaeff 6/7: Merge pull request #567 from keram/code-simplifications
Date: Tue, 22 Nov 2022 04:58:57 -0500 (EST)

branch: elpa/idris-mode
commit f2c3bbaefffcba79a3ec8fcd01d8180174f9abc9
Merge: 67e06eccbd c1ded381e7
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #567 from keram/code-simplifications
    
    Simplify code
---
 idris-common-utils.el  | 14 +++++++-------
 idris-compat.el        |  4 ++++
 idris-info.el          |  2 +-
 idris-prover.el        |  2 +-
 idris-warnings-tree.el |  9 +++------
 inferior-idris.el      |  4 ++--
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/idris-common-utils.el b/idris-common-utils.el
index 857bd36615..8b3cbf12a9 100644
--- a/idris-common-utils.el
+++ b/idris-common-utils.el
@@ -97,7 +97,7 @@ Lisp package.")
 (defmacro idris-save-marker (marker &rest body)
   "Save the contents of the marker MARKER while executing BODY."
   (declare (indent 1))
-  (let ((pos (cl-gensym "pos")))
+  (let ((pos (gensym "pos")))
   `(let ((,pos (marker-position ,marker)))
      (prog1 (progn . ,body)
        (set-marker ,marker ,pos)))))
@@ -107,7 +107,7 @@ Lisp package.")
 More precisely, PROPS are added to the region between the point's
 positions before and after executing BODY."
   (declare (indent 1))
-  (let ((start (cl-gensym)))
+  (let ((start (gensym "foo")))
     `(let ((,start (point)))
        (prog1 (progn ,@body)
          (add-text-properties ,start (point) ,props)))))
@@ -116,7 +116,7 @@ positions before and after executing BODY."
   "Execute BODY and add the properties indicated by SPANS to the
 inserted text (that is, relative to point prior to insertion)."
   (declare (indent 1))
-  (let ((start (cl-gensym)))
+  (let ((start (gensym)))
     `(let ((,start (point)))
        (prog1 (progn ,@body)
          (cl-loop for (begin length props) in ,spans
@@ -174,7 +174,7 @@ inserted text (that is, relative to point prior to 
insertion)."
                       (:underline '(underline))
                       (_ nil)))
          (link-face (if link-href '(idris-link-face) ()))
-         (unique-val (cl-gensym)) ; HACK to stop consecutive mouse-faces from 
interfering
+         (unique-val (gensym)) ; HACK to stop consecutive mouse-faces from 
interfering
          (mousable-face
           (cond ((member (cadr decor) 
idris-semantic-properties-clickable-decors)
                  `((:inherit (,decor-face highlight) :hack ,unique-val)))
@@ -348,9 +348,9 @@ The list of patterns is searched for a HEAD `eq' to the car 
of
 VALUE. If one is found, the BODY is executed with ARGS bound to the
 corresponding values in the CDR of VALUE."
   (declare (indent 1))
-  (let ((operator (cl-gensym "op-"))
-        (operands (cl-gensym "rand-"))
-        (tmp (cl-gensym "tmp-")))
+  (let ((operator (gensym "op-"))
+        (operands (gensym "rand-"))
+        (tmp (gensym "tmp-")))
     `(let* ((,tmp ,value)
             (,operator (car ,tmp))
             (,operands (cdr ,tmp)))
diff --git a/idris-compat.el b/idris-compat.el
index f406e598bb..2811f01bc8 100644
--- a/idris-compat.el
+++ b/idris-compat.el
@@ -30,5 +30,9 @@ attention to case differences."
            (eq t (compare-strings suffix nil nil
                                   string start-pos nil ignore-case))))))
 
+;; gensym fun introduced at or before Emacs version 26.1.
+(unless (fboundp 'gensym)
+  (defalias 'gensym 'cl-gensym))
+
 (provide 'idris-compat)
 ;;; idris-compat.el ends here
diff --git a/idris-info.el b/idris-info.el
index abb44243a0..228f596223 100644
--- a/idris-info.el
+++ b/idris-info.el
@@ -135,7 +135,7 @@ Ensure that the buffer is in `idris-info-mode'."
 (defmacro with-idris-info-buffer (&rest cmds)
   "Execute `CMDS' in a fresh Idris info buffer, then display it to the user."
   (declare (indent defun))
-  (let ((str-info (cl-gensym "STR-INFO")))
+  (let ((str-info (gensym "STR-INFO")))
     `(let ((,str-info (with-temp-buffer
                         ,@cmds
                         (buffer-string))))
diff --git a/idris-prover.el b/idris-prover.el
index b6eb8145f2..9e00755e4e 100644
--- a/idris-prover.el
+++ b/idris-prover.el
@@ -139,7 +139,7 @@ string and whose cadr is highlighting information."
 
 (defun idris-prover-complete ()
   "Completion of the current input."
-  (let* ((start (save-excursion (beginning-of-line) (point)))
+  (let* ((start (line-beginning-position))
          (input (buffer-substring-no-properties
                  start
                  (point)))
diff --git a/idris-warnings-tree.el b/idris-warnings-tree.el
index dbf6a580b5..4f897efd39 100644
--- a/idris-warnings-tree.el
+++ b/idris-warnings-tree.el
@@ -64,7 +64,7 @@
          (button-text `(,(format "%s line %s col %s:" (nth 0 note) (nth 1 
note) (nth 2 note))
                         help-echo "go to source location"
                         action ,#'(lambda (_)
-                                    (idris-show-source-location (nth 0 note)
+                                    (idris-goto-source-location (nth 0 note)
                                                                 (nth 1 note)
                                                                 (nth 2 
note))))))
     (make-idris-tree :item (nth 3 note)
@@ -117,10 +117,7 @@ Invokes `idris-compiler-notes-mode-hook'."
     (cond ((not (idris-tree-leaf-p tree))
            (idris-tree-toggle tree))
           (t
-           (idris-show-source-location (nth 0 note) (nth 1 note) (nth 2 
note))))))
-
-(defun idris-show-source-location (filename lineno col)
-  (idris-goto-source-location filename lineno col))
+           (idris-goto-source-location (nth 0 note) (nth 1 note) (nth 2 
note))))))
 
 (defun idris-goto-location (filename)
   "Opens buffer for filename"
@@ -163,7 +160,7 @@ a preview and offer to widen."
   "Like with-slots but works only for structs.
 \(fn (CONC-NAME &rest SLOTS) STRUCT &body BODY)"
   (declare (indent 2))
-  (let ((struct-var (cl-gensym "struct")))
+  (let ((struct-var (gensym "struct")))
     `(let ((,struct-var ,struct))
        (cl-symbol-macrolet
            ,(mapcar (lambda (slot)
diff --git a/inferior-idris.el b/inferior-idris.el
index b0b7ff5527..3e31533382 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -309,7 +309,7 @@ asynchronously.
 Note: don't use backquote syntax for SEXP, because various Emacs
 versions cannot deal with that."
   (declare (indent 3))
-  (let ((result (cl-gensym)))
+  (let ((result (gensym)))
     `(let ,(cl-loop for var in saved-vars
                     collect (cl-etypecase var
                               (symbol (list var var))
@@ -354,7 +354,7 @@ or FAILURE-CONT in failure case."
 ignoring intermediate output. If `NO-ERRORS' is non-nil, don't
 trigger warning buffers and don't call `ERROR' if there was an
 Idris error."
-  (let* ((tag (cl-gensym (format "idris-result-%d-"
+  (let* ((tag (gensym (format "idris-result-%d-"
                                  (1+ idris-continuation-counter))))
          (idris-stack-eval-tags (cons tag idris-stack-eval-tags)))
     (apply



reply via email to

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