all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Rafael Laboissière" <rafael@laboissiere.net>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] test-org/fuzzy-links
Date: Wed, 12 Apr 2017 22:33:54 +0200	[thread overview]
Message-ID: <20170412203354.gnfpxtvqq5ykdsog@laboissiere.net> (raw)

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

Function org-backward-heading-same-level fails in a specific case. 
Suppose the following org-mode file:

 ==================
 * first
 * second
 * third
 ==================

where '* first' is right at the beginning of the file.

When the cursor is at line '* third' and org-backward-heading-same-level 
is called, we go to the previous line correctly.  However when the cursor 
is at '* second', org-backward-heading-same-level does bring us to the 
first line but emits an error "Beginning of buffer".  It seems that the 
patch attached to this message fixes the problem.

Best,

Rafael

[-- Attachment #2: 0001-Do-not-fail-when-heading-is-at-the-beginning-of-the-.patch --]
[-- Type: text/x-diff, Size: 1017 bytes --]

From ff792a00e28b7b0ca4fde98f72611ef8079daf04 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <rafael@laboissiere.net>
Date: Wed, 12 Apr 2017 22:18:54 +0200
Subject: [PATCH] Do not fail when heading is at the beginning of the buffer

* org.el (org-forward-heading-same-level): Do not move backward when
at the beginning of the buffer
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 17caa3fa6..b46369ad5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -24071,7 +24071,8 @@ non-nil it will also look at invisible ones."
           (count (if arg (abs arg) 1))
           (result (point)))
       (while (and (prog1 (> count 0)
-		    (forward-char (if (and arg (< arg 0)) -1 1)))
+		    (forward-char (if (and arg (< arg 0))
+				      (if (= (point) 1) 0 -1) 1)))
                   (funcall f org-outline-regexp-bol nil 'move))
         (let ((l (- (match-end 0) (match-beginning 0) 1)))
           (cond ((< l level) (setq count 0))
-- 
2.11.0


             reply	other threads:[~2017-04-12 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 20:33 Rafael Laboissière [this message]
2017-04-15 14:53 ` [PATCH] test-org/fuzzy-links Nicolas Goaziou
2017-04-15 15:07   ` Rafael Laboissière

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

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

  git send-email \
    --in-reply-to=20170412203354.gnfpxtvqq5ykdsog@laboissiere.net \
    --to=rafael@laboissiere.net \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.