emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alex Kosorukoff <alex@3form.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix capture to make it save the point location
Date: Thu, 1 May 2014 19:00:40 -0700	[thread overview]
Message-ID: <CAHD9_tTuftxwA=c3enmTdgchSdWKZV+-fGSskmM6tppP-gOpjw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 351 bytes --]

Hello:

this is another small patch to org-capture.el to make sure that after
completion it returns to the same place from where it was invoked. This way
users won't loose track of where they were before capturing something. The
minimal setup to reproduce the case where capture fails to return to the
place of its invocation is attached.

Best,
Alex

[-- Attachment #1.2: Type: text/html, Size: 457 bytes --]

[-- Attachment #2: 0001-fix-org-capture-error-The-mark-is-not-set-now-so-the.patch --]
[-- Type: text/x-patch, Size: 959 bytes --]

From ac50a5300e35d7abd5f50317069b2a795fde4ad8 Mon Sep 17 00:00:00 2001
From: Alex Kosorukoff <alex@3form.com>
Date: Mon, 17 Mar 2014 12:56:09 -0700
Subject: [PATCH] fix org-capture error "The mark is not set now, so there is no region"

---
 lisp/org.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index dc4f2cc..bc5a69e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14611,7 +14611,7 @@ When JUST-ALIGN is non-nil, only align tags.
 When JUST-ALIGN is 'ignore-column, align tags without trying to set
 the column by ignoring invisible text."
   (interactive "P")
-  (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
+  (if (and (mark t) (org-region-active-p) org-loop-over-headlines-in-active-region)
       (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
 		    'region-start-level 'region))
 	    org-loop-over-headlines-in-active-region)
-- 
1.7.0.4


[-- Attachment #3: capmove.el --]
[-- Type: text/x-emacs-lisp, Size: 1137 bytes --]

;; capmove.el org-mode capture moving the point in a buffer
;; $ emacs -Q -l capfail.el

(unless window-system
  (insert "This test needs window-system, exiting...")
  (sleep-for 3)
  (kill-emacs))

(setq inhibit-splash-screen t)
(add-to-list 'load-path "~/.emacs.d/org/lisp")
(require 'org)
(setq org-capture-templates
      '(("t" "Todo" entry (file "todo.org") "* TODO %^{Title}\n  %?")))
(define-key global-map (kbd "C-c c") 'org-capture)

(switch-to-buffer "test.org")
(insert "we start here and do some editing\n") (goto-char 0)
(select-frame (make-frame))
(goto-char (point-max))
(dotimes (n 5)
    (insert (format "%d\n" n))
    (sit-for 1))
(insert "now we invoke capture here")
(sit-for 1)

(setq last-kbd-macro [?\C-c ?c ?t ?t ?e ?s ?t return return])
(sleep-for 3) (kmacro-call-macro nil)
(insert "note that capture had already moved the point\n")
(insert "to the top of the file in this buffer\n\n")
(sit-for 3)
(insert "so we end up in a different place when we finish\n")
(insert "even if we abort it with C-c C-k")
(sit-for 3)
(setq last-kbd-macro [?\C-c ?\C-k])
(sleep-for 3) (kmacro-call-macro nil)
(provide 'capmove)


             reply	other threads:[~2014-05-02  2:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02  2:00 Alex Kosorukoff [this message]
2014-05-02  2:03 ` [PATCH] Fix capture to make it save the point location Alex Kosorukoff
2014-05-23 12:30   ` Bastien
2014-05-23 15:24     ` Alex Kosorukoff
2014-05-23 15:39       ` Bastien
2014-05-23 16:04         ` Alex Kosorukoff
2014-05-23 17:36           ` Bastien

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='CAHD9_tTuftxwA=c3enmTdgchSdWKZV+-fGSskmM6tppP-gOpjw@mail.gmail.com' \
    --to=alex@3form.com \
    --cc=emacs-orgmode@gnu.org \
    /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).