all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Wojciech Meyer <wojciech.meyer@googlemail.com>
Cc: juri@jurta.org, Eli Zaretskii <eliz@gnu.org>,
	emacs-devel@gnu.org, joakim@verona.se, deniz.a.m.dogan@gmail.com
Subject: Re: Refreshing Info nodes
Date: Sat, 11 Sep 2010 15:19:20 +0200	[thread overview]
Message-ID: <jwvbp842zps.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTin0d+B=UGXLayCxUHbgmB+S3NNaa1DG2kzKDSV9@mail.gmail.com> (Wojciech Meyer's message of "Sun, 29 Aug 2010 16:18:48 +0100")

> Now there was some problem with buffer local variable
> `revert-buffer-function'. (in doc-view-mode) I corrected it I believe,
> and this is the final version of patch.  Could anybody review that once
> more, please?

Some nitpicks:

> +  ;; This is not interactive because you shouldn't be turning this
> +  ;; mode on and off.  You can corrupt things that way.
> +  ;;
> +  ;; Now it's derived mode, so therefore it is interactive.

These two pieces are contradictory, please clarify.  BTW, we should
change archive-mode to use buffer-swap-text like we did for tar-mode,
which should address this risk of corruption.

> -(defun bookmark-bmenu-mode ()
> +(define-derived-mode bookmark-bmenu-mode special-mode "Bookmark Menu"
>    "Major mode for editing a list of bookmarks.
>  Each line describes one of the bookmarks in Emacs.
>  Letters do not insert themselves; instead, they are commands.
> @@ -1645,9 +1642,6 @@
>    (kill-all-local-variables)
>    (use-local-map bookmark-bmenu-mode-map)

Both kill-all-local-variables and use-local-map can be removed (actually
kill-all-local-variables *has* to be removed since it undoes the previous
call to special-mode).

>    (setq truncate-lines t)
> -  (setq buffer-read-only t)
> -  (setq major-mode 'bookmark-bmenu-mode)
> -  (setq mode-name "Bookmark Menu")
>    (run-mode-hooks 'bookmark-bmenu-mode-hook))

Why remove (setq buffer-read-only t) ?
And why not remove the run-mode-hooks?

> === modified file 'lisp/doc-view.el'
> --- lisp/doc-view.el	2010-07-14 15:57:54 +0000
> +++ lisp/doc-view.el	2010-08-29 15:08:39 +0000
> @@ -333,7 +333,6 @@
>      (define-key map (kbd "C-c C-t")   'doc-view-open-text)
>      ;; Reconvert the current document.  Don't just use revert-buffer
>      ;; because that resets the scale factor, the page number, ...
> -    (define-key map (kbd "g")         'doc-view-revert-buffer)

If you remove this line, you need to remove the above comment as well
(after making sure that the problem it mentions don't apply any more).

> +    (set (make-local-variable 'revert-buffer-function) 'doc-view-revert-buffer)
>      (run-mode-hooks 'doc-view-mode-hook)))

Here as well you should remove the run-mode-hooks.

>  ;;;###autoload
> -(defun image-mode ()
> +(define-derived-mode image-mode special-mode "Image"
>    "Major mode for image files.
>  You can use \\<image-mode-map>\\[image-toggle-display]
>  to toggle between display as an image and display as text."
> -  (interactive)
>    (condition-case err
>        (progn
>  	(unless (display-images-p)
>  	  (error "Display does not support images"))
 
>  	(kill-all-local-variables)
> -	(setq major-mode 'image-mode)

IIRC define-derived-mode sets major-mode before running the body of the
macro, so when you call `error' above, `major-mode' and `mode-name' have
already been set and need to be reverted.

> -(defun occur-mode ()
> +(define-derived-mode occur-mode special-mode "Occur"
>    "Major mode for output from \\[occur].
>  \\<occur-mode-map>Move point to one of the items in this buffer, then use
>  \\[occur-mode-goto-occurrence] to go to the occurrence that the item refers to.
>  Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
 
>  \\{occur-mode-map}"
> -  (interactive)
>    (kill-all-local-variables)
>    (use-local-map occur-mode-map)

These last two should disappear as mentioned earlier.


        Stefan



  reply	other threads:[~2010-09-11 13:19 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-13 17:51 Refreshing Info nodes Wojciech Meyer
2010-06-13 17:56 ` Deniz Dogan
2010-06-14 15:38   ` Juri Linkov
2010-06-14 18:34     ` Wojciech Meyer
2010-06-14 19:08     ` Stefan Monnier
2010-06-14 20:49       ` joakim
2010-06-14 21:59         ` Juri Linkov
2010-06-14 22:58           ` joakim
2010-06-15 21:35             ` Juri Linkov
2010-06-15 23:38               ` Wojciech Meyer
2010-06-16 13:39                 ` Stefan Monnier
2010-06-16 20:43                   ` Juri Linkov
2010-06-17  0:46                     ` Stefan Monnier
2010-06-17  8:29                       ` Juri Linkov
2010-08-28 20:38                   ` Wojciech Meyer
2010-08-28 20:50                     ` Eli Zaretskii
2010-08-28 22:17                       ` Wojciech Meyer
2010-08-29 15:18                         ` Wojciech Meyer
2010-09-11 13:19                           ` Stefan Monnier [this message]
2010-09-11 14:00                             ` Wojciech Meyer
2010-09-13  1:34                             ` Wojciech Meyer
2010-09-13 10:11                               ` Stefan Monnier
2010-09-13 10:22                                 ` Wojciech Meyer
2010-06-17  8:00                 ` Richard Stallman
2010-06-17  8:52                   ` Wojciech Meyer
2010-06-15  0:38           ` Stefan Monnier
2010-06-16 20:35             ` Juri Linkov
2010-06-17  0:49               ` Stefan Monnier
2010-06-15  3:00           ` Eli Zaretskii
2010-06-15  3:18             ` Drew Adams
2010-06-14 21:57       ` Juri Linkov
2010-06-15  0:42         ` Stefan Monnier
2010-06-16 20:33           ` Juri Linkov
2010-06-17  0:50             ` Stefan Monnier
2010-06-17 20:34               ` 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=jwvbp842zps.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=deniz.a.m.dogan@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    --cc=juri@jurta.org \
    --cc=wojciech.meyer@googlemail.com \
    /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.