From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Kelling Subject: [PATCH] Make the point visible when jumping to the mark Date: Sun, 15 Sep 2013 02:22:03 -0700 Message-ID: <52357C3B.4080605@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090003020705040509020102" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VL8X0-0000sj-FO for emacs-orgmode@gnu.org; Sun, 15 Sep 2013 05:22:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VL8Ws-0003tE-2C for emacs-orgmode@gnu.org; Sun, 15 Sep 2013 05:22:14 -0400 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]:47084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VL8Wr-0003t8-QB for emacs-orgmode@gnu.org; Sun, 15 Sep 2013 05:22:05 -0400 Received: by mail-pa0-f51.google.com with SMTP id lf1so4195662pab.38 for ; Sun, 15 Sep 2013 02:22:04 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "'emacs-orgmode@gnu.org'" This is a multi-part message in MIME format. --------------090003020705040509020102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------090003020705040509020102 Content-Type: text/x-patch; name="0001-Make-the-point-visible-when-jumping-to-the-mark.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Make-the-point-visible-when-jumping-to-the-mark.patch" >From 066595dd9350f06a1df2e99a341f96782ac8dfed Mon Sep 17 00:00:00 2001 From: Ian Kelling 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 --------------090003020705040509020102--