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

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

[elpa] externals/ement 1bad05695c 4/6: Change: Improve completion by loo


From: ELPA Syncer
Subject: [elpa] externals/ement 1bad05695c 4/6: Change: Improve completion by looking for prefixes
Date: Sun, 14 May 2023 00:58:06 -0400 (EDT)

branch: externals/ement
commit 1bad05695cb7d84a8789d75104f889e1b56dab1a
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Change: Improve completion by looking for prefixes
    
    * ement-room.el (ement-room--complete-members-at-point):
    (ement-room--complete-rooms-at-point): Look for "@", "!", or "#"
    prefix.
---
 ement-room.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ement-room.el b/ement-room.el
index 0ce2923c21..5dbbbcd099 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -4272,8 +4272,8 @@ Web-compatible HTML output, using HTML like:
 Uses members in the current buffer's room.  For use in
 `completion-at-point-functions'."
   (let ((beg (save-excursion
-               (re-search-backward (rx (or bol bos blank)))
-               (1+ (point))))
+               (when (re-search-backward (rx (or bol bos blank) "@") nil t)
+                 (point))))
         (end (point))
         (collection-fn (completion-table-dynamic
                         ;; The manual seems to show the FUN ignoring any
@@ -4281,14 +4281,15 @@ Uses members in the current buffer's room.  For use in
                         ;; seems to say that it should use the argument.
                         (lambda (_ignore)
                           (ement-room--member-names-and-ids)))))
-    (list beg end collection-fn :exclusive 'no)))
+    (when beg
+      (list beg end collection-fn :exclusive 'no))))
 
 (defun ement-room--complete-rooms-at-point ()
   "Complete room aliases and IDs at point.
 For use in `completion-at-point-functions'."
   (let ((beg (save-excursion
-               (re-search-backward (rx (or bol bos blank)))
-               (1+ (point))))
+               (when (re-search-backward (rx (or bol bos blank) (or "!" "#")) 
nil t)
+                 (point))))
         (end (point))
         (collection-fn (completion-table-dynamic
                         ;; The manual seems to show the FUN ignoring any
@@ -4296,7 +4297,8 @@ For use in `completion-at-point-functions'."
                         ;; seems to say that it should use the argument.
                         (lambda (_ignore)
                           (ement-room--room-aliases-and-ids)))))
-    (list beg end collection-fn :exclusive 'no)))
+    (when beg
+      (list beg end collection-fn :exclusive 'no))))
 
 ;; TODO: Use `cl-pushnew' in these two functions instead of `delete-dups'.
 



reply via email to

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