unofficial mirror of emacs-devel@gnu.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: Mon, 13 Sep 2010 12:11:55 +0200	[thread overview]
Message-ID: <jwviq2avugs.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87r5gy5svm.fsf@gmail.com> (Wojciech Meyer's message of "Mon, 13 Sep 2010 02:34:05 +0100")

>>> +  ;; 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.

> Done. I am investigating possibility of using swap-buffer with
> archive-mode.

Great, but note that it's a separate issue to the one of using special-mode.

> BTW: Maybe we should think about merging (at least reusing bits & pieces
> and making user interface more consistent) tar-mode <-> archive-mode?

Yes, bringing them closer would be good, indeed.

> - changing `image-mode' to something else and wrapping the rest into
> `defun' (ad-hoc solution, which I like at least)

This solution you like least is the right one: image-mode should really
be a command that sets the major-mode to image-mode, not a command that
tries it and does something else if it can't be done.  I.e. we need
a separate command to do the "check if image-mode can be used, and call
image-mode if possible".

> Ideally in case of saving previous mode we should have a stack for this
> (even better, stack with functions that restore previous state, but this
> might be an overkill).

The user might want to switch in a circular rather than stack fashion.
Since we don't know how best to solve this general case, we stick to the
only really use case we know, where the user switches between two modes
(the doc-view/image-mode and the "see raw data" mode (can be
fundamental-mode, ps-mode, c-mode, ...)).

> (define-derived-mode my-major-mode special-mode 
>                                   :keymap 
>                                   (("n" . 'my-next-page)
>                                    ("C-s" . 'my-search))
>                                    ...)

We could, but a separate variable isn't that much hassle.

> (define-derived-mode my-major-mode special-mode 
>                                   :keymap 'my-major-mode-map
>                                    ...)

This would encourage the use of non-standard naming, so I'd rather not
go down that road.

> As you notice I also think that defining key-maps should be easier.
> Generally maybe we should do what's been done with `easy-menu' for maps.

As you may have noticed in easy-mmode-define-keymap, I've toyed with
this idea in the past.  Maybe a `defkeymap' macro would be good, indeed,
but it's not that important, I think.

> +(define-derived-mode archive-mode special-mode "Archive mode"
[...]
>  ;; Archive mode is suitable only for specially formatted data.
>  (put 'archive-mode 'mode-class 'special)

The above line is made redundant by deriving from special-mode.

> +(define-derived-mode bookmark-edit-annotation-mode nil "Edit Bookmark Annotation"
[...]
>    (run-mode-hooks 'text-mode-hook))

This run-mode-hooks is a good hint that the mode should actually derive
from text-mode-hook.

>  (put 'occur-mode 'mode-class 'special)
> -(defun occur-mode ()
> +(define-derived-mode occur-mode special-mode "Occur"

Here also, the `put' is now redundant.


        Stefan



  reply	other threads:[~2010-09-13 10:11 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
2010-09-11 14:00                             ` Wojciech Meyer
2010-09-13  1:34                             ` Wojciech Meyer
2010-09-13 10:11                               ` Stefan Monnier [this message]
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

  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=jwviq2avugs.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 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).