emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [RFC] Could we get rid of Org specific "mark ring"


From: Nicolas Goaziou
Subject: Re: [O] [RFC] Could we get rid of Org specific "mark ring"
Date: Sat, 24 Feb 2018 23:30:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

Samuel Wales <address@hidden> writes:

> in my usage, the current distinction between org-mark-ring and
> mark-ring does not disturb me at all.  i agree that it would be good
> to be able to use global-mark-ring as a substitute for both
> global-mark-ring and org-mark-ring, but ONLY if it takes me to the
> exact location just like org-mark-ring does.
>
> i use mark-ring extensively.  this is when i mark manually, or in
> cases like isearch or bob.  it is intuitive and i never have to think
> about the distinction from org-mark-ring.  i agree that some users
> would expect the mark to be set also.  which i think is a good idea,
> for both global and local mark rings.  but ONLY if the global one goes
> to the exact spot.

I do not discuss your needs. My concern is about common use of the mark
ring. A dedicated mark ring for Org buffers sounds overkill.

Note that, in order to get back old behaviour once `org-mark-ring' is an
alias for `push-mark', you could do the following (untested, but you get
the idea):

     (setq my-org-places (make-ring 16))
     (setq my--org-places-count 0)

     (defun my-push-org-location (&optional location &rest _)
       (when (eq major-mode 'org-mode)
         (ring-insert my-org-places (copy-marker (or location (point))))))

     (advice-add 'push-mark :before #'my-push-org-location)

     (defun my-jump-org-location ()
       (interactive)
       (when (ring-empty-p my-org-places)
         (error "No Org location stored"))
       (if (eq last-command 'my-jump-org-location)
           (cl-incf my--org-places-count)
         (setq my--org-places-count 0))
       (let* ((m (ring-ref my-org-places))
              (buffer (marker-buffer m))
              (positon (marker-position m)))
         (set-buffer buffer)
         (or (and (>= position (point-min))
                  (<= position (point-max)))
             (if widen-automatically (widen)
               (error "Org location is outside accessible part of buffer")))
         (goto-char position)
         (switch-to-buffer buffer)))

     (global-set-key (kbd "C-c &") #'my-jump-org-location)

> i do not use global-mark-ring.  this is because [1] nonergo binding
> [fixable] [2] i haven't made prev and next for it [fixable] [3] it
> makes ZERO sense to me why it behaves so strangely.
>
> i expect global-mark-ring to take me to the exact spot.  period.  when
> it doesn't, i get so confused that i just stop using it.  i don't
> understand why anybody finds it intuitive.  do a lot of people use it?
>  unlike the local mark ring, i have never seen actual use of it
> mentioned in the community.  perhaps its users have tiny files.

You could file an Emacs bug report about it.

Regards,

-- 
Nicolas Goaziou



reply via email to

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