From: Juri Linkov <juri@jurta.org>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Kyllingstad <listmailemacs@kyllingstad.com>,
"Stefan Monnier" <monnier@iro.umontreal.ca>,
emacs-devel@gnu.org
Subject: Re: major mode in new buffers
Date: Thu, 01 Apr 2010 21:05:30 +0300 [thread overview]
Message-ID: <87fx3f5d15.fsf@mail.jurta.org> (raw)
In-Reply-To: <m2jf7ccd24b1003310935td6fd7adch8704cafa2317d295@mail.gmail.com> (Juanma Barranquero's message of "Wed, 31 Mar 2010 18:35:20 +0200")
>> Ehelp creates a problem and tries to solve it in an ugly way.
>
> I know, and I would be very happy if someone were to rewrite it from
> the ground up. Still, it's a fact that it currently "works", and your
> major-mode code (which I find very useful) breaks it. I thought you'd
> be interested in knowing that.
I know nothing about ehelp.el, but it seems this patch fixes it:
=== modified file 'lisp/ehelp.el'
--- lisp/ehelp.el 2010-01-13 08:35:10 +0000
+++ lisp/ehelp.el 2010-04-01 18:05:05 +0000
@@ -94,10 +94,13 @@ (defvar electric-help-map
map)
"Keymap defining commands available in `electric-help-mode'.")
+(defvar electric-help-orig-major-mode nil)
+
(defun electric-help-mode ()
"`with-electric-help' temporarily places its buffer in this mode.
-\(On exit from `with-electric-help', the buffer is put in default `major-mode'.)"
+\(On exit from `with-electric-help', the original `major-mode' is restored.)"
(setq buffer-read-only t)
+ (set (make-local-variable 'electric-help-orig-major-mode) major-mode)
(setq mode-name "Help")
(setq major-mode 'help)
(setq mode-line-buffer-identification '(" Help: %b"))
@@ -131,7 +134,7 @@ (defun with-electric-help (thunk &option
When the user exits (with `electric-help-exit', or otherwise), the help
buffer's window disappears (i.e., we use `save-window-excursion'), and
-BUFFER is put into default `major-mode' (or `fundamental-mode')."
+BUFFER is put back into its original major mode."
(setq buffer (get-buffer-create (or buffer "*Help*")))
(let ((one (one-window-p t))
(config (current-window-configuration))
@@ -175,8 +178,9 @@ (defun with-electric-help (thunk &option
;; call to help-mode won't cut it; at least RET is bound wrong
;; afterwards. It's also not clear that `help-mode' is always
;; the right thing, maybe we should add an optional parameter.
+ ;; Now we restore the original major mode saved by `electric-help-mode'.
(condition-case ()
- (funcall (or (default-value 'major-mode) 'fundamental-mode))
+ (funcall (or electric-help-orig-major-mode 'fundamental-mode))
(error nil))
(set-window-configuration config)
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2010-04-01 18:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-30 11:57 major mode in new buffers René Kyllingstad
2010-03-30 15:06 ` Stefan Monnier
2010-03-30 15:51 ` René Kyllingstad
2010-03-30 15:13 ` Harald Hanche-Olsen
2010-03-30 16:07 ` René Kyllingstad
2010-03-30 16:15 ` David Reitter
2010-03-30 16:17 ` Juri Linkov
2010-03-30 16:42 ` René Kyllingstad
2010-03-31 1:28 ` Juanma Barranquero
2010-03-31 3:02 ` Stefan Monnier
2010-03-31 10:22 ` Juanma Barranquero
2010-03-31 10:23 ` Juanma Barranquero
2010-03-31 11:29 ` Juanma Barranquero
2010-03-31 15:05 ` Juri Linkov
2010-03-31 16:35 ` Juanma Barranquero
2010-04-01 18:05 ` Juri Linkov [this message]
2010-04-01 21:08 ` Juanma Barranquero
2010-04-01 22:24 ` Juanma Barranquero
2010-04-01 22:45 ` Juri Linkov
2010-04-01 23:10 ` Juanma Barranquero
2010-04-02 16:04 ` Juri Linkov
2010-04-02 20:19 ` Juanma Barranquero
2010-04-02 23:04 ` Juri Linkov
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=87fx3f5d15.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--cc=listmailemacs@kyllingstad.com \
--cc=monnier@iro.umontreal.ca \
/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.