From: Kaushal Modi <kaushal.modi@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Ari Roponen <ari.roponen@gmail.com>, 22332@debbugs.gnu.org
Subject: bug#22332: 25.0.50; woman moves point in a wrong buffer
Date: Sat, 9 Jan 2016 17:32:23 -0500 [thread overview]
Message-ID: <CAFyQvY2QvrK7M8=no8Aai-mnNW=aLg8fdbi_B2jdP_5UOXsgjw@mail.gmail.com> (raw)
In-Reply-To: <5691469B.7000304@gmx.at>
[-- Attachment #1: Type: text/plain, Size: 3873 bytes --]
Here's a more complicated version of the fix (patch explanation in the
patch itself):
From 99732dfad7eff097948302f9cc1a4adec3c55504 Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Sat, 9 Jan 2016 17:27:43 -0500
Subject: [PATCH] Ensure point manipulation only in WoMan buf
- WoMan-find-buffer definition is changed; now it only returns the WoMan
buffer, does not switch to it. Bug fix: return the WoMan buffer name
instead of the window name.
- woman-find-file is fixed (bug # 22332) so that now the point
manipulation happens only in the WoMan buffer.
---
lisp/woman.el | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/lisp/woman.el b/lisp/woman.el
index 4ca7dbe..0d2f5f4 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1598,13 +1598,17 @@ woman-find-file
(interactive "fBrowse UN*X manual file: \nP")
(setq woman-last-file-name
(setq file-name (expand-file-name file-name))) ; to canonicalize
- (let ((alist-tail woman-buffer-alist) exists)
+ (let ((alist-tail woman-buffer-alist)
+ woman-buffer
+ exists)
(setq woman-buffer-number 0)
(while (and alist-tail (not (string= file-name (car (car
alist-tail)))))
(setq alist-tail (cdr alist-tail)
woman-buffer-number (1+ woman-buffer-number)))
- (or (and (setq exists
- (and alist-tail (WoMan-find-buffer))) ; buffer exists
+ (when alist-tail
+ (setq woman-buffer (WoMan-find-buffer)))
+ (setq exists (and alist-tail woman-buffer))
+ (or (and exists ; buffer exists
(not reformat))
;; Format new buffer or reformat current buffer:
(let* ((bufname (file-name-nondirectory file-name))
@@ -1620,10 +1624,12 @@ woman-find-file
(or exists
(setq woman-buffer-alist
(cons (cons file-name bufname) woman-buffer-alist)
- woman-buffer-number 0)))))
- (Man-build-section-alist)
- (Man-build-references-alist)
- (goto-char (point-min)))
+ woman-buffer-number 0))))
+ (when woman-buffer
+ (with-current-buffer (get-buffer woman-buffer)
+ (Man-build-section-alist)
+ (Man-build-references-alist)
+ (goto-char (point-min))))))
(defun woman-make-bufname (bufname)
"Create an unambiguous buffer name from BUFNAME."
@@ -2055,20 +2061,24 @@ WoMan-next-manpage
(WoMan-next-manpage)))
(defun WoMan-find-buffer ()
- "Switch to buffer corresponding to `woman-buffer-number' and return it.
+ "Return the buffer corresponding to `woman-buffer-number'.
If such a buffer does not exist then remove its association from the
alist in `woman-buffer-alist' and return nil."
(if (zerop woman-buffer-number)
(let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
(if buffer
- (display-buffer buffer)
+ (progn
+ (display-buffer buffer)
+ buffer)
;; Delete alist element:
(setq woman-buffer-alist (cdr woman-buffer-alist))
nil))
(let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
(buffer (get-buffer (cdr (car (cdr prev-ptr))))))
(if buffer
- (display-buffer buffer)
+ (progn
+ (display-buffer buffer)
+ buffer)
;; Delete alist element:
(setcdr prev-ptr (cdr (cdr prev-ptr)))
(if (>= woman-buffer-number (length woman-buffer-alist))
--
2.6.0.rc0.24.gec371ff
--
Kaushal Modi
On Sat, Jan 9, 2016 at 12:42 PM, martin rudalics <rudalics@gmx.at> wrote:
> > Perhaps calls to display-buffer can be replaced with calls to
> > pop-to-buffer in defun WoMan-find-buffer?
>
> I don't think so. By default the buffer should be displayed in the
> selected window and ‘pop-to-buffer’ is supposed to "Select buffer BUFFER
> in some window, preferably a different one."
>
> martin
>
>
[-- Attachment #2: Type: text/html, Size: 6477 bytes --]
next prev parent reply other threads:[~2016-01-09 22:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 18:24 bug#22332: 25.0.50; woman moves point in a wrong buffer Ari Roponen
2016-01-09 9:25 ` martin rudalics
2016-01-09 16:36 ` Kaushal Modi
2016-01-09 16:54 ` martin rudalics
2016-01-09 17:19 ` Kaushal Modi
2016-01-09 17:29 ` Ari Roponen
2016-01-09 17:42 ` martin rudalics
2016-01-09 22:32 ` Kaushal Modi [this message]
2016-01-10 10:53 ` martin rudalics
2016-02-04 5:41 ` Kaushal Modi
2016-02-04 7:55 ` martin rudalics
2016-02-04 8:44 ` Ari Roponen
2016-02-04 16:36 ` Kaushal Modi
2016-02-18 16:20 ` Kaushal Modi
2016-02-20 2:41 ` John Wiegley
2016-02-20 6:17 ` Lars Ingebrigtsen
2016-02-20 7:58 ` Lars Ingebrigtsen
2016-01-09 17:42 ` martin rudalics
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='CAFyQvY2QvrK7M8=no8Aai-mnNW=aLg8fdbi_B2jdP_5UOXsgjw@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=22332@debbugs.gnu.org \
--cc=ari.roponen@gmail.com \
--cc=rudalics@gmx.at \
/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).