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

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

[elpa] master 943eb01 108/184: counsel.el (counsel-mark-ring): Goto actu


From: Oleh Krehel
Subject: [elpa] master 943eb01 108/184: counsel.el (counsel-mark-ring): Goto actual point instead of line
Date: Wed, 16 Oct 2019 13:15:01 -0400 (EDT)

branch: master
commit 943eb016d11f613492711822940df62755da152f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-mark-ring): Goto actual point instead of line
    
    Re #2254
---
 counsel.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/counsel.el b/counsel.el
index ca13fb3..fab279e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3751,11 +3751,10 @@ This variable has no effect unless
 
 (defun counsel--mark-ring-update-fn ()
   "Show preview by candidate."
-  (let ((linenum (string-to-number (ivy-state-current ivy-last))))
+  (let ((pos (get-text-property 0 'point (ivy-state-current ivy-last))))
     (counsel--mark-ring-delete-highlight)
-    (unless (= linenum 0)
-      (with-ivy-window
-        (forward-line (- linenum (line-number-at-pos)))))))
+    (with-ivy-window
+      (goto-char pos))))
 
 ;;;###autoload
 (defun counsel-mark-ring ()
@@ -3771,7 +3770,7 @@ Obeys `widen-automatically', which see."
             (let ((linum (line-number-at-pos))
                   (line (buffer-substring
                          (line-beginning-position) (line-end-position))))
-              (cons (format fmt linum line) (point)))))
+              (propertize (format fmt linum line) 'point (point)))))
          (marks (copy-sequence mark-ring))
          (marks (delete-dups marks))
          (marks
@@ -3792,7 +3791,7 @@ Obeys `widen-automatically', which see."
                   :update-fn #'counsel--mark-ring-update-fn
                   :sort counsel-mark-ring-sort-selections
                   :action (lambda (cand)
-                            (let ((pos (cdr-safe cand)))
+                            (let ((pos (get-text-property 0 'point cand)))
                               (when pos
                                 (unless (<= (point-min) pos (point-max))
                                   (if widen-automatically



reply via email to

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