emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Make the point visible when jumping to the mark
@ 2013-09-15  9:22 Ian Kelling
  2013-09-15 17:25 ` Ian Kelling
  0 siblings, 1 reply; 13+ messages in thread
From: Ian Kelling @ 2013-09-15  9:22 UTC (permalink / raw)
  To: 'emacs-orgmode@gnu.org'

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

An example of the problem:

* headline-1
** one of many headlines I want to remain folded...
** headline
*** headline
The point starts here. I set a mark on this line.
Then I fold headline-1. This becomes invisible.
* headline-2
I move the point here. After I'm done here, I want to go back to my
mark. I do C-u C-space (pop-to-mark-command), but it doesn't go to the
mark. Instead, it takes me to the end of the still folded
headline-1. To get back to my mark without globally unfolding
everything requires tediously unfolding each headline and sub-headline
until the marked location is exposed.

There are some other non-org commands that would have this same
problem (isearch, bookmark-jump, save-place), but org-mode has code to
fix them. org-mark-ring-goto also handles this. I followed those examples
and wrote a patch. It is attached.

- Ian Kelling



[-- Attachment #2: 0001-Make-the-point-visible-when-jumping-to-the-mark.patch --]
[-- Type: text/x-patch, Size: 1612 bytes --]

From 066595dd9350f06a1df2e99a341f96782ac8dfed Mon Sep 17 00:00:00 2001
From: Ian Kelling <ianowl@gmail.com>
Date: Sun, 15 Sep 2013 00:32:08 -0700
Subject: [PATCH] Make the point visible when jumping to the mark

* lisp/org.el advise `pop-global-mark', `exchange-point-and-mark', and
  `pop-global-mark' with `org-show-context', as appropriate.

TINYCHANGE
---
 lisp/org.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 8e970a1..30b87d9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -23903,6 +23903,27 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
 			   (outline-invisible-p)))
        (org-show-context 'bookmark-jump)))
 
+(eval-after-load "simple"
+  '(defadvice set-mark-command (after org-make-visible activate)
+     "Make the point visible with `org-show-context'."
+     (org-mark-jump-unhide)))
+
+(eval-after-load "simple"
+  '(defadvice exchange-point-and-mark (after org-make-visible activate)
+     "Make the point visible with `org-show-context'."
+     (org-mark-jump-unhide)))
+
+(eval-after-load "simple"
+  '(defadvice pop-global-mark (after org-make-visible activate)
+     "Make the point visible with `org-show-context'."
+     (org-mark-jump-unhide)))
+
+(defun org-mark-jump-unhide ()
+  "Make the point visible with `org-show-context' after jumping to the mark."
+  (and (derived-mode-p 'org-mode)
+       (outline-invisible-p)
+       (org-show-context 'mark-goto)))
+
 ;; Make session.el ignore our circular variable
 (defvar session-globals-exclude)
 (eval-after-load "session"
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH] Make the point visible when jumping to the mark
@ 2014-05-01  4:54 Ian Kelling
  2014-05-20 22:25 ` Ian Kelling
  2014-05-21 13:00 ` Bastien
  0 siblings, 2 replies; 13+ messages in thread
From: Ian Kelling @ 2014-05-01  4:54 UTC (permalink / raw)
  To: emacs-orgmode

From 9191e4a364e251119cf8b7c72e41f6c0d09583f2 Mon Sep 17 00:00:00 2001
Message-ID: <87ha5aqa93.fsf@treetowl.lan>
MIME-Version: 1.0
Content-Type: text/plain

*lisp/org.el: Advise commands which jump to the mark
---

There are several non-org commands that jump to a location and would be
unwieldy if the location remained hidden, (isearch, bookmark-jump,
save-place), but org-mode has code to fix them. In this patch, I
followed their example.

I have an emacs fsf copyright assignment completed & on file with fsf, I can
send gpg signed copy if you need it.

- Ian Kelling


 lisp/org.el |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 44a4e44..9365059 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -24326,6 +24326,27 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
 			   (outline-invisible-p)))
        (org-show-context 'bookmark-jump)))
 
+(eval-after-load "simple"
+  '(defadvice set-mark-command (after org-make-visible activate)
+     "Make the point visible with `org-show-context'."
+     (org-mark-jump-unhide)))
+
+(eval-after-load "simple"
+  '(defadvice exchange-point-and-mark (after org-make-visible activate)
+     "Make the point visible with `org-show-context'."
+     (org-mark-jump-unhide)))
+
+(eval-after-load "simple"
+  '(defadvice pop-global-mark (after org-make-visible activate)
+     "Make the point visible with `org-show-context'."
+     (org-mark-jump-unhide)))
+
+(defun org-mark-jump-unhide ()
+  "Make the point visible with `org-show-context' after jumping to the mark."
+  (when (and (derived-mode-p 'org-mode)
+	     (outline-invisible-p))
+    (org-show-context 'mark-goto)))
+
 ;; Make session.el ignore our circular variable
 (defvar session-globals-exclude)
 (eval-after-load "session"
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-05-23  5:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-15  9:22 [PATCH] Make the point visible when jumping to the mark Ian Kelling
2013-09-15 17:25 ` Ian Kelling
  -- strict thread matches above, loose matches on Subject: below --
2014-05-01  4:54 Ian Kelling
2014-05-20 22:25 ` Ian Kelling
2014-05-21  2:58   ` Bastien
2014-05-21  9:21     ` Ian Kelling
2014-05-21 13:00 ` Bastien
2014-05-21 19:01   ` Ian Kelling
2014-05-22  9:54     ` Bastien
2014-05-22  8:56   ` Sebastien Vauban
2014-05-22  9:52     ` Bastien
2014-05-22 15:40       ` Ian Kelling
2014-05-23  5:47         ` Bastien

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).