From: Daimrod <daimrod@gmail.com>
To: Bastien <bzg@altern.org>
Cc: Nicolas Richard <theonewiththeevillook@yahoo.fr>,
17746@debbugs.gnu.org, David Griffiths <dogriffiths@gmail.com>
Subject: bug#17746: [O] bug#17746: 24.4.50; "byte-code: `recenter'ing a window that does not display current-buffer." when composing a message
Date: Thu, 12 Jun 2014 10:15:50 +0900 [thread overview]
Message-ID: <87ppifudvd.fsf@tanger.home> (raw)
In-Reply-To: <87ha3rxx79.fsf@bzg.ath.cx> (Bastien's message of "Wed, 11 Jun 2014 17:50:02 +0200")
[-- Attachment #1: Type: text/plain, Size: 837 bytes --]
Bastien <bzg@altern.org> writes:
> Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
>
>> David Griffiths <dogriffiths@gmail.com> writes:
>>> Debugger entered--Lisp error: (error "`recenter'ing a window that does
>>> not display current-buffer.")
>>> recenter((4))
>>> org-overview()
>>
>> So that's a duplicate of #17724. It is fixed in org-mode (upstream) master
>> branch. The easy fix is to use emacs-24 branch :)
>>
>> (otherwise just remove that call to recenter in org-overview).
>
> PS: The change about throwing an error when recentering a window
> that does not display the current buffer breaks ~37 tests in Org
> master branch, even with this fix. I need to digg this further.
Err, what's the rational behind this change?
In the meantime I've a simple fix (quickly tested for `org-agenda' which
was also broken).
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-org-recenter-as-a-wrapper-around-recenter.patch --]
[-- Type: text/x-diff, Size: 9699 bytes --]
From 659bc5072253967ee2737f668c8ac035a4b8aa32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@gmail.com>
Date: Thu, 12 Jun 2014 10:14:16 +0900
Subject: [PATCH] Use `org-recenter' as a wrapper around `recenter'
* lisp/org.el (org-recenter): New function that behaves exactly like
`recenter' except that it sets the `current-buffer' to the buffer
displayed by the selected window.
(org-fix-ellipsis-at-bol)
(org-optimize-window-after-visibility-change)
(org-first-headline-recenter)
* contrib/lisp/org-index.el (org-index)
(org-index--create-new-index)
(org-index--do-head)
* contrib/lisp/org-toc.el (org-toc-goto)
* lisp/org-agenda.el (org-agenda-list)
(org-agenda-redo)
(org-recenter-heading)
(org-agenda-recenter)
* lisp/org-bibtex.el (org-execute-file-search-in-bibtex)
* lisp/org-clock.el (org-clock-goto)
* lisp/org-table.el (org-table-show-reference): Use `org-recenter' instead of `recenter'.
---
contrib/lisp/org-index.el | 12 ++++++------
contrib/lisp/org-toc.el | 4 ++--
lisp/org-agenda.el | 12 ++++++------
lisp/org-bibtex.el | 2 +-
lisp/org-clock.el | 2 +-
lisp/org-table.el | 4 ++--
lisp/org.el | 13 +++++++++----
7 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/contrib/lisp/org-index.el b/contrib/lisp/org-index.el
index 64974eb..f77d64d 100644
--- a/contrib/lisp/org-index.el
+++ b/contrib/lisp/org-index.el
@@ -633,7 +633,7 @@ command \"head\" for reference \"237\".
;; simply go into table
(goto-char org-index--below-hline)
(show-subtree)
- (recenter)
+ (org-recenter)
(if what-adjusted
(setq message-text "Nothing to search for; at index table")
(setq message-text "At index table")))
@@ -1581,7 +1581,7 @@ retrieves the value of the count-column for reference 12.
(org-id-goto id)
(org-show-context)
(show-subtree)
- (recenter 1)
+ (org-recenter 1)
(setq org-index-id id)
(if (y-or-n-p "This is your new index table. It is already set for this emacs session. Do you want to save its id to make it available for future emacs sessions too ? ")
(progn
@@ -1598,7 +1598,7 @@ retrieves the value of the count-column for reference 12.
(goto-char org-index--point)
(org-show-context)
(show-subtree)
- (recenter 1)
+ (org-recenter 1)
(delete-other-windows)
;; show new index
(select-window (split-window-vertically))
@@ -1606,7 +1606,7 @@ retrieves the value of the count-column for reference 12.
(org-id-goto id)
(org-show-context)
(show-subtree)
- (recenter 1)
+ (org-recenter 1)
(error "Please compare your existing index (upper window) and a temporary new one (lower window) to correct the previous error (\"%s\"); the explanations following the new index table should help." reason)))))
@@ -1778,12 +1778,12 @@ retrieves the value of the count-column for reference 12.
(pop-to-buffer buffer)
(goto-char point)
(org-reveal t)
- (recenter)
+ (org-recenter)
(pop-to-buffer "*org-index-occur*"))
(org-pop-to-buffer-same-window buffer)
(goto-char point)
(org-reveal t)
- (recenter)))
+ (org-recenter)))
(setq message-text (format "Did not find '%s'" (or ref link))))))
message-text))
diff --git a/contrib/lisp/org-toc.el b/contrib/lisp/org-toc.el
index 255b79e..e06de55 100644
--- a/contrib/lisp/org-toc.el
+++ b/contrib/lisp/org-toc.el
@@ -294,8 +294,8 @@ If CYCLE is non-nil, cycle the targeted subtree in the Org window."
(org-show-entry))
(org-show-context)))
(if org-toc-recenter-mode
- (if (>= org-toc-recenter 1000) (recenter)
- (recenter org-toc-recenter)))
+ (if (>= org-toc-recenter 1000) (org-recenter)
+ (org-recenter org-toc-recenter)))
(cond ((null jump)
(switch-to-buffer-other-window toc-buf))
((eq jump 'delete)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 5e056b4..02c583b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4348,11 +4348,11 @@ items if they have an hour specification like [h]h:mm."
(unless (and (pos-visible-in-window-p (point-min))
(pos-visible-in-window-p (point-max)))
(goto-char (1- (point-max)))
- (recenter -1)
+ (org-recenter -1)
(if (not (pos-visible-in-window-p (or start-pos 1)))
(progn
(goto-char (or start-pos 1))
- (recenter 1))))
+ (org-recenter 1))))
(goto-char (or start-pos 1))
(add-text-properties (point-min) (point-max)
`(org-agenda-type agenda
@@ -7329,7 +7329,7 @@ in the agenda."
(and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter))
(and cols (org-called-interactively-p 'any) (org-agenda-columns))
(org-goto-line line)
- (recenter window-line)))
+ (org-recenter window-line)))
(defvar org-global-tags-completion-table nil)
(defvar org-agenda-filter-form nil)
@@ -8373,7 +8373,7 @@ When called with a prefix argument, include all archive files as well."
(org-flag-heading nil)))) ; show the next heading
(when (outline-invisible-p)
(show-entry)) ; display invisible text
- (recenter (/ (window-height) 2))
+ (org-recenter (/ (window-height) 2))
(org-back-to-heading t)
(if (re-search-forward org-complex-heading-regexp nil t)
(goto-char (match-beginning 4)))
@@ -8697,7 +8697,7 @@ if it was hidden in the outline."
(defun org-recenter-heading (n)
(save-excursion
(org-back-to-heading)
- (recenter n)))
+ (org-recenter n)))
(defvar org-agenda-cycle-counter nil)
(defun org-agenda-cycle-show (&optional n)
@@ -8728,7 +8728,7 @@ docstring of `org-agenda-show-1'."
(interactive "P")
(let ((win (selected-window)))
(org-agenda-goto t)
- (recenter arg)
+ (org-recenter arg)
(select-window win)))
(defun org-agenda-show-mouse (ev)
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 3efee73..8bcd04e 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -540,7 +540,7 @@ With optional argument OPTIONAL, also prompt for optional fields."
(with-current-buffer b
(goto-char p)
(bibtex-url)))
- (recenter 0)) ; Move entry start to beginning of window
+ (org-recenter 0)) ; Move entry start to beginning of window
;; return t to indicate that the search is done.
t))
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 3c7abd5..9323bd5 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1702,7 +1702,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
(org-show-entry)
(org-back-to-heading t)
(org-cycle-hide-drawers 'children)
- (recenter org-clock-goto-before-context)
+ (org-recenter org-clock-goto-before-context)
(org-reveal)
(if recent
(message "No running clock, this is the most recently clocked task"))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 8cd8f8b..8c9e667 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3935,9 +3935,9 @@ With prefix ARG, apply the new formulas to the table."
(push org-table-current-begin-pos org-show-positions)
(let ((min (apply 'min org-show-positions))
(max (apply 'max org-show-positions)))
- (goto-char min) (recenter 0)
+ (goto-char min) (org-recenter 0)
(goto-char max)
- (or (pos-visible-in-window-p max) (recenter -1))))
+ (or (pos-visible-in-window-p max) (org-recenter -1))))
(select-window win))))
(defun org-table-force-dataline ()
diff --git a/lisp/org.el b/lisp/org.el
index 874440b..b9a81b9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5575,7 +5575,7 @@ The following commands are available:
:parents (list text-mode-abbrev-table)))
(defsubst org-fix-ellipsis-at-bol ()
- (save-excursion (goto-char (window-start)) (recenter 0)))
+ (save-excursion (goto-char (window-start)) (org-recenter 0)))
(defun org-find-invisible-foreground ()
(let ((candidates (remove
@@ -7059,8 +7059,8 @@ This function is the default value of the hook `org-cycle-hook'."
((eq state 'content) nil)
((eq state 'all) nil)
((eq state 'folded) nil)
- ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1)))
- ((eq state 'subtree) (or (org-subtree-end-visible-p) (recenter 1))))))
+ ((eq state 'children) (or (org-subtree-end-visible-p) (org-recenter 1)))
+ ((eq state 'subtree) (or (org-subtree-end-visible-p) (org-recenter 1))))))
(defun org-remove-empty-overlays-at (pos)
"Remove outline overlays that do not contain non-white stuff."
@@ -7251,7 +7251,7 @@ Optional argument N means put the headline into the Nth line of the window."
(goto-char (point-min))
(when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
(beginning-of-line)
- (recenter (prefix-numeric-value N))))
+ (org-recenter (prefix-numeric-value N))))
;;; Saving and restoring visibility
@@ -23324,6 +23324,11 @@ package ox-bibtex by Taru Karttunen."
(call-interactively 'reftex-citation)))
;;;; Functions extending outline functionality
+(defun org-recenter (&optional arg)
+ "Like `recenter' but ensure that the `current-buffer' is
+properly set."
+ (with-current-buffer (window-buffer)
+ (recenter arg)))
(defun org-beginning-of-line (&optional arg)
"Go to the beginning of the current line. If that is invisible, continue
--
1.8.0.2722.gc0242e5
[-- Attachment #3: Type: text/plain, Size: 18 bytes --]
--
Daimrod/Greg
next prev parent reply other threads:[~2014-06-12 1:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 9:42 bug#17746: 24.4.50; "byte-code: `recenter'ing a window that does not display current-buffer." when composing a message David Griffiths
2014-06-10 17:40 ` Eli Zaretskii
2014-06-11 15:09 ` David Griffiths
2014-06-11 15:33 ` Nicolas Richard
2014-06-11 15:50 ` Bastien
2014-06-11 16:09 ` Nicolas Richard
[not found] ` <87zjhjxwaf.fsf@geodiff-mac3.ulb.ac.be>
2014-06-11 16:25 ` Bastien
[not found] ` <878up3xvje.fsf@bzg.ath.cx>
2014-06-11 19:11 ` Nicolas Richard
2014-06-11 16:29 ` Eli Zaretskii
[not found] ` <837g4nz9xc.fsf@gnu.org>
2014-06-11 18:15 ` Stefan Monnier
[not found] ` <jwvha3rco0u.fsf-monnier+emacsbugs@gnu.org>
2014-06-11 18:38 ` Eli Zaretskii
2014-06-12 1:15 ` Daimrod [this message]
2014-06-12 2:44 ` bug#17746: [O] " Stefan Monnier
[not found] ` <jwva99ic0f9.fsf-monnier+emacsbugs@gnu.org>
2014-06-12 4:10 ` Daimrod
2014-06-12 8:16 ` Nicolas Richard
2014-06-12 8:58 ` Daimrod
2014-06-12 9:27 ` Daimrod
2014-06-12 10:12 ` Daimrod
[not found] ` <87zjhicu83.fsf__13466.7772836567$1402568031$gmane$org@tanger.home>
2014-06-12 13:04 ` bug#17746: " Bastien
[not found] ` <874mzqeaug.fsf__22767.2755755068$1402565401$gmane$org@tanger.home>
2014-06-12 10:06 ` Bastien
[not found] ` <87lht2l9vo.fsf__32258.4286136136$1402567739$gmane$org@bzg.ath.cx>
2014-06-13 12:58 ` Nicolas Richard
[not found] ` <87ioo56k5h.fsf@geodiff-mac3.ulb.ac.be>
2014-06-13 15:29 ` Bastien
2014-06-14 3:28 ` Daimrod
2014-06-14 6:46 ` Bastien
2014-06-10 20:40 ` Stefan Monnier
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ppifudvd.fsf@tanger.home \
--to=daimrod@gmail.com \
--cc=17746@debbugs.gnu.org \
--cc=bzg@altern.org \
--cc=dogriffiths@gmail.com \
--cc=theonewiththeevillook@yahoo.fr \
/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.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).