summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-11-02 09:26:28 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-11-02 09:33:23 +0100
commit88894706981b6c62ad60ef4716a07892954ac99d (patch)
tree90aedfd3ec00e2305484c6e27ec44b039debf470
parentff2c746ae34fa8540fa7158d31ab55e4c89d1dd6 (diff)
Delete dereferenced marker if some (#1891)
* helm-ring.el (helm-mark-ring-default-action): Check if marker point to a buffer, if so jump to it, calling hook etc.. otherwise remove this marker from mark-ring.
-rw-r--r--helm-ring.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/helm-ring.el b/helm-ring.el
index 46a15810..a8589360 100644
--- a/helm-ring.el
+++ b/helm-ring.el
@@ -257,13 +257,18 @@ This is a command for `helm-kill-ring-map'."
(defun helm-mark-ring-default-action (candidate)
(let ((target (copy-marker candidate)))
- (switch-to-buffer (marker-buffer candidate))
- (helm-log-run-hook 'helm-goto-line-before-hook)
- (helm-match-line-cleanup)
- (with-helm-current-buffer
- (unless helm-yank-point (setq helm-yank-point (point))))
- (helm-goto-char target)
- (helm-highlight-current-line)))
+ (helm-aif (marker-buffer candidate)
+ (progn
+ (switch-to-buffer it)
+ (helm-log-run-hook 'helm-goto-line-before-hook)
+ (helm-match-line-cleanup)
+ (with-helm-current-buffer
+ (unless helm-yank-point (setq helm-yank-point (point))))
+ (helm-goto-char target)
+ (helm-highlight-current-line))
+ ;; marker point to no buffer, no need to dereference it, just
+ ;; delete it.
+ (setq mark-ring (delete target mark-ring)))))
(defvar helm-source-mark-ring
(helm-build-sync-source "mark-ring"