[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idris-mode d48690a595 06/13: Move `idris-X-at-point` funct
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idris-mode d48690a595 06/13: Move `idris-X-at-point` functions to idris-common-utils.el |
Date: |
Thu, 5 Jan 2023 04:59:25 -0500 (EST) |
branch: elpa/idris-mode
commit d48690a595ce08483e1ec11b572de3f2806c7d8f
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>
Move `idris-X-at-point` functions to idris-common-utils.el
Why:
To have accesss to `idris-name-at-point` from idris-xref
without circular reference between idris-commands and idris-repl.
---
idris-commands.el | 42 ------------------------------------------
idris-common-utils.el | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 42 deletions(-)
diff --git a/idris-commands.el b/idris-commands.el
index 3449f43189..1ef7460d87 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -48,15 +48,6 @@
(defvar-local idris-load-to-here nil
"The maximum position to load.")
-(defun idris-get-line-num (position)
- "Get the absolute line number at POSITION."
- ;; In Emacs 26.1 > line-number-at-pos accepts
- ;; additional optional argument ABSOLUTE which
- ;; removes need for `save-restriction' and `widen'
- (save-restriction
- (widen)
- (line-number-at-pos position)))
-
(defun idris-make-dirty ()
"Mark an Idris buffer as dirty and remove the loaded region."
(setq idris-buffer-dirty-p t)
@@ -291,39 +282,6 @@ This sets the load position to point, if there is one."
(error "Cannot find file for current buffer")))
-(defun idris-operator-at-position-p (pos)
- "Return t if syntax lookup is `.' or char after POS is `-'."
- (or (equal (syntax-after pos) (string-to-syntax "."))
- (eq (char-after pos) ?-)))
-
-(defun idris-thing-at-point ()
- "Return the line number and name at point as a cons.
-Use this in Idris source buffers."
- (let ((line (idris-get-line-num (point))))
- (cons
- (if (idris-operator-at-position-p (point))
- (save-excursion
- (skip-syntax-backward ".")
- (let ((beg (point)))
- (skip-syntax-forward ".")
- (buffer-substring-no-properties beg (point))))
- ;; Try if we're on a symbol or fail otherwise.
- (or (current-word t)
- (user-error "Nothing identifiable under point")))
- line)))
-
-(defun idris-name-at-point ()
- "Return the name at point, taking into account semantic annotations.
-Use this in Idris source buffers or in compiler-annotated output.
-Does not return a line number."
- (let ((ref (cl-remove-if
- #'null
- (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))))
(defun idris-info-for-name (what name)
"Display the type for a NAME."
diff --git a/idris-common-utils.el b/idris-common-utils.el
index 0af862df57..bc3d2c116f 100644
--- a/idris-common-utils.el
+++ b/idris-common-utils.el
@@ -416,4 +416,47 @@ relative to SRC-DIR"
(and (>= idris-protocol-version major)
(>= idris-protocol-version-minor minor))))
+(defun idris-get-line-num (position)
+ "Get the absolute line number at POSITION."
+ ;; In Emacs 26.1 > line-number-at-pos accepts
+ ;; additional optional argument ABSOLUTE which
+ ;; removes need for `save-restriction' and `widen'
+ (save-restriction
+ (widen)
+ (line-number-at-pos position)))
+
+(defun idris-operator-at-position-p (pos)
+ "Return t if syntax lookup is `.' or char after POS is `-'."
+ (or (equal (syntax-after pos) (string-to-syntax "."))
+ (eq (char-after pos) ?-)))
+
+(defun idris-thing-at-point ()
+ "Return the line number and name at point as a cons.
+Use this in Idris source buffers."
+ (let ((line (idris-get-line-num (point))))
+ (cons
+ (if (idris-operator-at-position-p (point))
+ (save-excursion
+ (skip-syntax-backward ".")
+ (let ((beg (point)))
+ (skip-syntax-forward ".")
+ (buffer-substring-no-properties beg (point))))
+ ;; Try if we're on a symbol or fail otherwise.
+ (or (current-word t)
+ (user-error "Nothing identifiable under point")))
+ line)))
+
+(defun idris-name-at-point ()
+ "Return the name at point, taking into account semantic annotations.
+Use this in Idris source buffers or in compiler-annotated output.
+Does not return a line number."
+ (let ((ref (cl-remove-if
+ #'null
+ (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))))
+
(provide 'idris-common-utils)
- [nongnu] elpa/idris-mode updated (b7c50dd60f -> a060688b5c), ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode d48690a595 06/13: Move `idris-X-at-point` functions to idris-common-utils.el,
ELPA Syncer <=
- [nongnu] elpa/idris-mode 13c750d67f 05/13: Return `user-error` instead of `error` from `idris-thing-at-point`, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode c9b2a4bee6 10/13: Add Xref backend for Idris, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode 6afe9a82b8 11/13: Merge pull request #602 from keram/impro-code, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode cb61f21432 08/13: Add idris-file-name-concat function as backward compatible, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode 28758e0980 09/13: Ensure ibc file is deleted in `idris-test-idris-type-at-point` test, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode a060688b5c 13/13: Merge pull request #604 from keram/idris-xref-v1, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode 306420713d 12/13: Merge pull request #603 from keram/impro-code3, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode dfce8b6631 01/13: Move `idris-run` from inferior-idris.el to idris-commands.el, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode 9f4d497e68 02/13: Do not try delete last window when deleting idris buffer, ELPA Syncer, 2023/01/05
- [nongnu] elpa/idris-mode 66daf810c7 03/13: Ensure restart of Idris connection takes into account, ELPA Syncer, 2023/01/05