unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 36588@debbugs.gnu.org
Subject: bug#36588: Unable to revert M-x apropos help buffer
Date: Fri, 12 Jul 2019 07:03:31 +0200	[thread overview]
Message-ID: <CADwFkmmrNjs3r2_Y=kJWPuf2APZfZ+HN7DxENqiRCLgf2GvbsA@mail.gmail.com> (raw)
In-Reply-To: <87h87sk4fv.fsf@tcd.ie>

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

Basil L. Contovounesios <contovob@tcd.ie> writes:

> This is because Apropos buffers are set up in apropos-print using
> with-output-to-temp-buffer, which by default calls help-mode, which sets
> revert-buffer-function permanently-locally to help-mode-revert-buffer.
>
> [Aside: Why is revert-buffer-function permanent-local?]
>
> help-mode-revert-buffer expects the command which generated the Help
> buffer to have previously called help-setup-xref.  This should be
> possible to do in Apropos, but it would be quite ugly as help-setup-xref
> needs to be called with the Help buffer current, so Apropos commands
> would need to set their own version of help-xref-stack-item before
> apropos-print performs the help-setup-xref dance.  Besides, Apropos
> buffers are not (currently) really Help buffers.
>
> Instead, I propose emulating a simpler version of help-setup-xref
> specific to Apropos:
>
>
> I don't consider this duplication because, unless Apropos were
> completely refactored, setting something like apropos--current would be
> necessary either way.  This has the added perk of not coupling Apropos
> with Help any more than it currently needs to be.
>
> WDYT?

Not familiar with this code, so I can't speak to your solution.  I can confirm
it fixes the problem though.  Thanks for looking at it so promptly.

I've attached a small patch with a test for this.

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-test-lisp-apropos-tests.el-New-file.patch --]
[-- Type: application/octet-stream, Size: 1681 bytes --]

From 562d2622048be8ac5509d8ccd4b9fd18244fc3a4 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Fri, 12 Jul 2019 06:57:29 +0200
Subject: [PATCH] * test/lisp/apropos-tests.el: New file.

---
 test/lisp/apropos-tests.el | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 test/lisp/apropos-tests.el

diff --git a/test/lisp/apropos-tests.el b/test/lisp/apropos-tests.el
new file mode 100644
index 0000000000..44737d902e
--- /dev/null
+++ b/test/lisp/apropos-tests.el
@@ -0,0 +1,34 @@
+;;; apropos-tests.el --- Tests for apropos.el  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+(require 'apropos)
+
+(ert-deftest apropos-tests-revert-buffer ()
+  (with-temp-buffer
+    (apropos "foo")
+    (revert-buffer nil t)
+    (should (looking-at "Type RET on a type label"))))
+
+(provide 'apropos-tests)
+;;; apropos-tests.el ends here
-- 
2.21.0


  reply	other threads:[~2019-07-12  5:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11  3:31 bug#36588: Unable to revert M-x apropos help buffer Stefan Kangas
2019-07-11 14:53 ` Basil L. Contovounesios
2019-07-12  5:03   ` Stefan Kangas [this message]
2019-08-04 22:45     ` Basil L. Contovounesios

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='CADwFkmmrNjs3r2_Y=kJWPuf2APZfZ+HN7DxENqiRCLgf2GvbsA@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=36588@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /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).