emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Samuel Wales <samologist@gmail.com>
Cc: Allen Li <vianchielfaura@gmail.com>,
	Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [RFC] Could we get rid of Org specific "mark ring"
Date: Sat, 24 Feb 2018 23:30:47 +0100	[thread overview]
Message-ID: <87muzy10mg.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAJcAo8vDXAq2kSxOFW9NAWmGpsRUAUYomtdG2XJYPgZZfkPP=w@mail.gmail.com> (Samuel Wales's message of "Wed, 31 Jan 2018 12:24:46 -0700")

Hello,

Samuel Wales <samologist@gmail.com> 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

  parent reply	other threads:[~2018-02-24 22:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 23:21 [RFC] Could we get rid of Org specific "mark ring" Nicolas Goaziou
2018-01-30  5:06 ` Allen Li
2018-01-30 11:35   ` Kaushal Modi
2018-01-30 12:02     ` Rasmus
2018-01-30 12:36     ` Tim Cross
2018-01-30 20:47 ` Samuel Wales
2018-01-30 21:29   ` Nicolas Goaziou
2018-01-30 22:30     ` Samuel Wales
2018-01-30 22:33       ` Samuel Wales
2018-01-30 22:42       ` Nicolas Goaziou
2018-01-30 23:00         ` Samuel Wales
2018-01-30 23:06           ` Nicolas Goaziou
2018-01-30 23:15             ` Samuel Wales
2018-01-30 23:53               ` Allen Li
2018-01-31  2:02                 ` Samuel Wales
2018-01-31 11:40                   ` Nicolas Goaziou
2018-01-31 19:24                     ` Samuel Wales
2018-01-31 19:29                       ` Samuel Wales
2018-02-24 22:30                       ` Nicolas Goaziou [this message]
2018-02-24 23:50                         ` Samuel Wales
2018-02-25  8:08                           ` Nicolas Goaziou
2018-02-25 20:28                             ` Samuel Wales
2018-02-27  0:27                               ` Nicolas Goaziou
2018-02-27  1:54                                 ` Samuel Wales
2018-02-27  7:09                                   ` Allen Li
2018-02-27 15:53                                     ` Nicolas Goaziou
2018-02-27 20:40                                       ` Samuel Wales
2018-02-27 20:48                                         ` Samuel Wales
2018-02-25  0:02                         ` Samuel Wales
2018-04-26 23:34 ` Bastien
2018-04-27  0:32   ` Samuel Wales
2018-04-27  1:21     ` Bastien
2018-04-27  1:24       ` Samuel Wales
2018-04-27  1:56         ` Bastien
2018-05-03 22:04           ` Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muzy10mg.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=samologist@gmail.com \
    --cc=vianchielfaura@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).