unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Refreshing Info nodes
@ 2010-06-13 17:51 Wojciech Meyer
  2010-06-13 17:56 ` Deniz Dogan
  0 siblings, 1 reply; 35+ messages in thread
From: Wojciech Meyer @ 2010-06-13 17:51 UTC (permalink / raw)
  To: emacs-devel

Hi,

Is there anyway to refresh an Info node?

Currently I have to revisit a toplevel Info node to see my changes, I
would like to be able to do it with just one command (like a refresh
button in a browser) being in info section, is it possible?

Thanks.

Wojciech





^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-13 17:51 Refreshing Info nodes Wojciech Meyer
@ 2010-06-13 17:56 ` Deniz Dogan
  2010-06-14 15:38   ` Juri Linkov
  0 siblings, 1 reply; 35+ messages in thread
From: Deniz Dogan @ 2010-06-13 17:56 UTC (permalink / raw)
  To: Wojciech Meyer; +Cc: emacs-devel

2010/6/13 Wojciech Meyer <wojciech.meyer@googlemail.com>:
> Hi,
>
> Is there anyway to refresh an Info node?
>
> Currently I have to revisit a toplevel Info node to see my changes, I
> would like to be able to do it with just one command (like a refresh
> button in a browser) being in info section, is it possible?
>

I don't know of any binding which does this, but you can use
`Info-revert-buffer-function', or `Info-revert-find-node' directly.
Neither of these functions are commands though.

-- 
Deniz Dogan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  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
  0 siblings, 2 replies; 35+ messages in thread
From: Juri Linkov @ 2010-06-14 15:38 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Wojciech Meyer, emacs-devel

>> Is there anyway to refresh an Info node?
>>
>> Currently I have to revisit a toplevel Info node to see my changes, I
>> would like to be able to do it with just one command (like a refresh
>> button in a browser) being in info section, is it possible?
>
> I don't know of any binding which does this, but you can use
> `Info-revert-buffer-function', or `Info-revert-find-node' directly.
> Neither of these functions are commands though.

The standard key binding to revert is `g', but in Info it's bound
to `Info-goto-node'.

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 15:38   ` Juri Linkov
@ 2010-06-14 18:34     ` Wojciech Meyer
  2010-06-14 19:08     ` Stefan Monnier
  1 sibling, 0 replies; 35+ messages in thread
From: Wojciech Meyer @ 2010-06-14 18:34 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan


Juri Linkov <juri@jurta.org> writes:

>> I don't know of any binding which does this, but you can use
>> `Info-revert-buffer-function', or `Info-revert-find-node' directly.
>> Neither of these functions are commands though.
>
> The standard key binding to revert is `g', but in Info it's bound
> to `Info-goto-node'.

Yes, I've rebound it to F5 temporally, thanks. I think it is quite
uncommon to refresh the Info node, unless somebody is working on
documentation.  (perhaps less common than `g' in dired-mode for
instance).

Wojciech



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  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:57       ` Juri Linkov
  1 sibling, 2 replies; 35+ messages in thread
From: Stefan Monnier @ 2010-06-14 19:08 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan

>> I don't know of any binding which does this, but you can use
>> `Info-revert-buffer-function', or `Info-revert-find-node' directly.
>> Neither of these functions are commands though.
> The standard key binding to revert is `g', but in Info it's bound
> to `Info-goto-node'.

Even if g can't be used because it's used for something else,
M-x revert-buffer RET should either work already or be made to work.


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 19:08     ` Stefan Monnier
@ 2010-06-14 20:49       ` joakim
  2010-06-14 21:59         ` Juri Linkov
  2010-06-14 21:57       ` Juri Linkov
  1 sibling, 1 reply; 35+ messages in thread
From: joakim @ 2010-06-14 20:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juri Linkov, Deniz Dogan, Wojciech Meyer, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> I don't know of any binding which does this, but you can use
>>> `Info-revert-buffer-function', or `Info-revert-find-node' directly.
>>> Neither of these functions are commands though.
>> The standard key binding to revert is `g', but in Info it's bound
>> to `Info-goto-node'.
>
> Even if g can't be used because it's used for something else,
> M-x revert-buffer RET should either work already or be made to work.
>
>
>         Stefan

I find the inconsistency of "g" to be rather annoying.
I think it should work also in variable help buffers, etc.

-- 
Joakim Verona



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 19:08     ` Stefan Monnier
  2010-06-14 20:49       ` joakim
@ 2010-06-14 21:57       ` Juri Linkov
  2010-06-15  0:42         ` Stefan Monnier
  1 sibling, 1 reply; 35+ messages in thread
From: Juri Linkov @ 2010-06-14 21:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan

> Even if g can't be used because it's used for something else,
> M-x revert-buffer RET should either work already or be made to work.

It doesn't work correctly, so it should be made to work.
It fails when the Info buffer has a non-default buffer name,
e.g. "*info*<1>".  In this case `Info-revert-find-node'
pops a new empty buffer "*info*", reads nil values of Info variables,
and kills that empty buffer.  Then after reverting "*info*<1>",
it puts these nil values to Info variables of "*info*<1>"
(Info-history, etc.)

Perhaps a `(eq major-mode 'Info-mode)' check should be added
before `(pop-to-buffer "*info*")' in `Info-revert-find-node'
like in other Info commands.  And it needs to keep the original
buffer name.  I'll try to fix this.


-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 20:49       ` joakim
@ 2010-06-14 21:59         ` Juri Linkov
  2010-06-14 22:58           ` joakim
                             ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: Juri Linkov @ 2010-06-14 21:59 UTC (permalink / raw)
  To: joakim; +Cc: emacs-devel, Wojciech Meyer, Stefan Monnier, Deniz Dogan

> I find the inconsistency of "g" to be rather annoying.

We have a prefix map M-g specially for "goto" commands.
Maybe `M-g n' should be bound to `Info-goto-node'.
Or like in Dired, bind it to `j'.

> I think it should work also in variable help buffers, etc.

`revert-buffer-function' is not implemented for Help buffers at all.
And what is worse, in Help mode `g' is bound to `View-goto-line'.

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 21:59         ` Juri Linkov
@ 2010-06-14 22:58           ` joakim
  2010-06-15 21:35             ` Juri Linkov
  2010-06-15  0:38           ` Stefan Monnier
  2010-06-15  3:00           ` Eli Zaretskii
  2 siblings, 1 reply; 35+ messages in thread
From: joakim @ 2010-06-14 22:58 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Deniz Dogan, Wojciech Meyer, Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:

>> I find the inconsistency of "g" to be rather annoying.
>
> We have a prefix map M-g specially for "goto" commands.
> Maybe `M-g n' should be bound to `Info-goto-node'.
> Or like in Dired, bind it to `j'.
>
>> I think it should work also in variable help buffers, etc.
>
> `revert-buffer-function' is not implemented for Help buffers at all.
> And what is worse, in Help mode `g' is bound to `View-goto-line'.

I think  back(last)/up/g/j should be consistent in at least these modes:

"help" buffer
dired
info
w3m

(I think this is still on-topic, but make a new thread if not)

-- 
Joakim Verona



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 21:59         ` Juri Linkov
  2010-06-14 22:58           ` joakim
@ 2010-06-15  0:38           ` Stefan Monnier
  2010-06-16 20:35             ` Juri Linkov
  2010-06-15  3:00           ` Eli Zaretskii
  2 siblings, 1 reply; 35+ messages in thread
From: Stefan Monnier @ 2010-06-15  0:38 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, Wojciech Meyer, joakim, Deniz Dogan

>> I think it should work also in variable help buffers, etc.
> `revert-buffer-function' is not implemented for Help buffers at all.

Indeed and that's a bug.


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 21:57       ` Juri Linkov
@ 2010-06-15  0:42         ` Stefan Monnier
  2010-06-16 20:33           ` Juri Linkov
  0 siblings, 1 reply; 35+ messages in thread
From: Stefan Monnier @ 2010-06-15  0:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan

> Perhaps a `(eq major-mode 'Info-mode)' check should be added
> before `(pop-to-buffer "*info*")' in `Info-revert-find-node'
> like in other Info commands.

I'd rather check something more directly and explicitly related to
reverting that just (derived-mode-p 'Info-mode).  Ideally there should
be no check: the code that does the pop-to-buffer should simply not be
used at all when reverting, instead the non-reverting case should create
a *info* buffer, setup the few needed vars and then trigger
`revert-buffer' to do the actual work.


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 21:59         ` Juri Linkov
  2010-06-14 22:58           ` joakim
  2010-06-15  0:38           ` Stefan Monnier
@ 2010-06-15  3:00           ` Eli Zaretskii
  2010-06-15  3:18             ` Drew Adams
  2 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2010-06-15  3:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: deniz.a.m.dogan, wojciech.meyer, monnier, joakim, emacs-devel

> From: Juri Linkov <juri@jurta.org>
> Date: Tue, 15 Jun 2010 00:59:34 +0300
> Cc: emacs-devel@gnu.org, Wojciech Meyer <wojciech.meyer@googlemail.com>,
> 	Stefan Monnier <monnier@iro.umontreal.ca>,
> 	Deniz Dogan <deniz.a.m.dogan@gmail.com>
> 
> > I find the inconsistency of "g" to be rather annoying.
> 
> We have a prefix map M-g specially for "goto" commands.
> Maybe `M-g n' should be bound to `Info-goto-node'.
> Or like in Dired, bind it to `j'.

Please don't.  The current binding of `g' in Info was there since day
one, and is also supported by the stand-alone Info reader.  Any
veteran user of Info will have it wired into their finger memory.
Please don't remap it to anything else.

(I agree that there should be a way to revert-buffer in Info node.)



^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: Refreshing Info nodes
  2010-06-15  3:00           ` Eli Zaretskii
@ 2010-06-15  3:18             ` Drew Adams
  0 siblings, 0 replies; 35+ messages in thread
From: Drew Adams @ 2010-06-15  3:18 UTC (permalink / raw)
  To: 'Eli Zaretskii', 'Juri Linkov'
  Cc: emacs-devel, wojciech.meyer, monnier, joakim, deniz.a.m.dogan

> > Maybe `M-g n' should be bound to `Info-goto-node'.
> > Or like in Dired, bind it to `j'.
> 
> Please don't.  The current binding of `g' in Info was there since day
> one, and is also supported by the stand-alone Info reader.  Any
> veteran user of Info will have it wired into their finger memory.
> Please don't remap it to anything else.
> 
> (I agree that there should be a way to revert-buffer in Info node.)

+1




^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-14 22:58           ` joakim
@ 2010-06-15 21:35             ` Juri Linkov
  2010-06-15 23:38               ` Wojciech Meyer
  0 siblings, 1 reply; 35+ messages in thread
From: Juri Linkov @ 2010-06-15 21:35 UTC (permalink / raw)
  To: joakim; +Cc: Deniz Dogan, Wojciech Meyer, Stefan Monnier, emacs-devel

> I think  back(last)/up/g/j should be consistent in at least these modes:
>
> "help" buffer
> dired
> info
> w3m

          back(last)     up     goto     revert
dired     q              ^      j        g
info      l              u      g        -
help      C-c C-b        ?      ?        -

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-15 21:35             ` Juri Linkov
@ 2010-06-15 23:38               ` Wojciech Meyer
  2010-06-16 13:39                 ` Stefan Monnier
  2010-06-17  8:00                 ` Richard Stallman
  0 siblings, 2 replies; 35+ messages in thread
From: Wojciech Meyer @ 2010-06-15 23:38 UTC (permalink / raw)
  To: Juri Linkov
  Cc: Deniz Dogan, Wojciech Meyer, Stefan Monnier, joakim, emacs-devel

Juri Linkov <juri@jurta.org> writes:

>> I think  back(last)/up/g/j should be consistent in at least these modes:
>>
>> "help" buffer
>> dired
>> info
>> w3m
>
>           back(last)     up     goto     revert
> dired     q              ^      j        g
> info      l              u      g        -
> help      C-c C-b        ?      ?        -

Yes, I found those inconsistencies too.  Info node could be crossed out
from the list of candidates to change as bare info uses traditional
keymap (like Eli mentioned), however the package could provide a
different alternative set of bindings compatible with the rest of Emacs
(I agree that none of Emacs packages uses that approach, usually there
is one keymap, and it is up to the user to rebind it, but in this case
we would enforce at least optional consistency with other packages, and
for me it would be OK to change the default mode to the `right way to do
it in Emacs'. it is a good compromise). However in case of dired, help,
vc and any other mode for navigation over some *hierarchical* entity
that should be *synchronised* with some external state (the most common
is file-system -> dired), this should be unified. (one base mode for it?
I've noticed that we can inherit major modes).

BTW: I found that vc-status could be pretty much similar to dired. Would
that be feasible to annotate files in dired and shift some functionality
from vc-status mode to dired? (Most of the time I spent in dired anyway,
and calling vs status, or having a feedback about status of files under
version control could be good. (I know again, dired uses ls -l format
for historicial reasons, and there will be maybe a good lag during
updating the buffer, but...)

Just mine two cents,

Thanks.  
Wojciech



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-15 23:38               ` Wojciech Meyer
@ 2010-06-16 13:39                 ` Stefan Monnier
  2010-06-16 20:43                   ` Juri Linkov
  2010-08-28 20:38                   ` Wojciech Meyer
  2010-06-17  8:00                 ` Richard Stallman
  1 sibling, 2 replies; 35+ messages in thread
From: Stefan Monnier @ 2010-06-16 13:39 UTC (permalink / raw)
  To: Wojciech Meyer; +Cc: Juri Linkov, Deniz Dogan, joakim, emacs-devel

>> back(last)     up     goto     revert
>> dired     q              ^      j        g
>> info      l              u      g        -
>> help      C-c C-b        ?      ?        -

Help uses "g" for `View-goto-line' but should switch it to
`revert-buffer' (after getting it to work, obviously).
Note that dired's `q' is not just a different key but it also behaves
differently since it doesn't work *within* a buffer, but jumps to some
earlier one instead.

> is file-system -> dired), this should be unified. (one base mode for it?
> I've noticed that we can inherit major modes).

The closest parent we have for such uses is `special-mode' which does
not account for the "hierarchical" part, nor for the "goto".  I.e. it is
only meant to unify the revert-buffer binding ("g") as well as the
quit-window binding ("q").
Currently special-mode is under used, so patches to use it in more
places are very welcome.

> BTW: I found that vc-status could be pretty much similar to dired. Would
> that be feasible to annotate files in dired and shift some functionality
> from vc-status mode to dired? (Most of the time I spent in dired anyway,
> and calling vs status, or having a feedback about status of files under
> version control could be good.

In my experience with pcl-cvs and vc-dired (tainted by the fact that
vc-dired was painfully slow), dired already uses up a lot of horizontal
space and a lot of key-bindings, so adding VC to it is problematic.
Furthermore, while adding VC status to files in Dired might be good
enough for small projects, for large projects it usually suffers from
the fact that you need to have an overview of all the files you have
modified, which are often scattered among a few directories, which is
why vc-dir doesn't list all the files, but only the "interesting ones".


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-15  0:42         ` Stefan Monnier
@ 2010-06-16 20:33           ` Juri Linkov
  2010-06-17  0:50             ` Stefan Monnier
  0 siblings, 1 reply; 35+ messages in thread
From: Juri Linkov @ 2010-06-16 20:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan

> I'd rather check something more directly and explicitly related to
> reverting that just (derived-mode-p 'Info-mode).  Ideally there should
> be no check: the code that does the pop-to-buffer should simply not be
> used at all when reverting, instead the non-reverting case should create
> a *info* buffer, setup the few needed vars and then trigger
> `revert-buffer' to do the actual work.

Reverting in Info is implemented by the function `Info-revert-find-node'
whose purpose is to go to an Info node (like `Info-find-node'),
by killing the original buffer and creating a new one.

This is peculiar, but I'd like to avoid reimplementing this mechanism to
keep the traditional behavior, and simply fix a bug to allow it to work
with buffer names other than the default "*info*":

=== modified file 'lisp/info.el'
--- lisp/info.el	2010-06-10 16:42:56 +0000
+++ lisp/info.el	2010-06-16 20:27:42 +0000
@@ -803,9 +803,10 @@ (defun Info-revert-find-node (filename n
   "Go to an Info node FILENAME and NODENAME, re-reading disk contents.
 When *info* is already displaying FILENAME and NODENAME, the window position
 is preserved, if possible."
-  (pop-to-buffer "*info*")
+  (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
   (let ((old-filename Info-current-file)
 	(old-nodename Info-current-node)
+	(old-buffer-name (buffer-name))
 	(pcolumn      (current-column))
 	(pline        (count-lines (point-min) (line-beginning-position)))
 	(wline        (count-lines (point-min) (window-start)))
@@ -813,6 +814,8 @@ (defun Info-revert-find-node (filename n
 	(new-history  (and Info-current-file
 			   (list Info-current-file Info-current-node (point)))))
     (kill-buffer (current-buffer))
+    (pop-to-buffer (or old-buffer-name "*info*"))
+    (Info-mode)
     (Info-find-node filename nodename)
     (setq Info-history old-history)
     (if (and (equal old-filename Info-current-file)

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-15  0:38           ` Stefan Monnier
@ 2010-06-16 20:35             ` Juri Linkov
  2010-06-17  0:49               ` Stefan Monnier
  0 siblings, 1 reply; 35+ messages in thread
From: Juri Linkov @ 2010-06-16 20:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>>> I think it should work also in variable help buffers, etc.
>> `revert-buffer-function' is not implemented for Help buffers at all.
>
> Indeed and that's a bug.

This patch fixes it:

=== modified file 'lisp/help-mode.el'
--- lisp/help-mode.el	2010-05-20 23:54:55 +0000
+++ lisp/help-mode.el	2010-06-16 20:34:05 +0000
@@ -271,6 +272,8 @@ (defun help-mode ()
 	  ;; also removes BUFFER from the selected window.
 	  (with-current-buffer buffer
 	    (bury-buffer))))
+  (set (make-local-variable 'revert-buffer-function)
+       'help-mode-revert-buffer)
 
   (run-mode-hooks 'help-mode-hook))
 
@@ -783,6 +786,15 @@ (defun help-follow-symbol (&optional pos
 	      (fboundp sym) (facep sym))
       (help-do-xref pos #'help-xref-interned (list sym)))))
 
+(defun help-mode-revert-buffer (ignore-auto noconfirm)
+  (when (or noconfirm (yes-or-no-p "Revert help buffer? "))
+    (let ((pos (point))
+	  (item help-xref-stack-item)
+	  ;; Pretend there is no current item to add to the history.
+	  (help-xref-stack-item nil))
+      (apply (car item) (cdr item))
+      (goto-char pos))))
+
 (defun help-insert-string (string)
   "Insert STRING to the help buffer and install xref info for it.
 This function can be used to restore the old contents of the help buffer

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-16 13:39                 ` Stefan Monnier
@ 2010-06-16 20:43                   ` Juri Linkov
  2010-06-17  0:46                     ` Stefan Monnier
  2010-08-28 20:38                   ` Wojciech Meyer
  1 sibling, 1 reply; 35+ messages in thread
From: Juri Linkov @ 2010-06-16 20:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Deniz Dogan, Wojciech Meyer, joakim, emacs-devel

> Help uses "g" for `View-goto-line' but should switch it to
> `revert-buffer' (after getting it to work, obviously).

I see no way to override View-mode's key binding in Help-mode.

  (define-key help-mode-map "g" 'revert-buffer)

doesn't help, `g' still calls `View-goto-line'.

> In my experience with pcl-cvs and vc-dired (tainted by the fact that
> vc-dired was painfully slow), dired already uses up a lot of horizontal
> space and a lot of key-bindings, so adding VC to it is problematic.
> Furthermore, while adding VC status to files in Dired might be good
> enough for small projects, for large projects it usually suffers from
> the fact that you need to have an overview of all the files you have
> modified, which are often scattered among a few directories, which is
> why vc-dir doesn't list all the files, but only the "interesting ones".

Better than making pcl-cvs and vc-dired compatible with dired,
would be make them compatible with each other.  Sometimes
I type a pcl-cvs key in vc-dired and get a disastrous result,
e.g. instead of hiding committed files (`cvs-mode-ignore')
typing `I' in vc-dired registers the file under point.

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-16 20:43                   ` Juri Linkov
@ 2010-06-17  0:46                     ` Stefan Monnier
  2010-06-17  8:29                       ` Juri Linkov
  0 siblings, 1 reply; 35+ messages in thread
From: Stefan Monnier @ 2010-06-17  0:46 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Deniz Dogan, Wojciech Meyer, joakim, emacs-devel

>> vc-dired was painfully slow), dired already uses up a lot of horizontal
>> space and a lot of key-bindings, so adding VC to it is problematic.
[...]
> Better than making pcl-cvs and vc-dired compatible with dired,
> would be make them compatible with each other.  Sometimes

vc-dired doesn't exist any more.


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-16 20:35             ` Juri Linkov
@ 2010-06-17  0:49               ` Stefan Monnier
  0 siblings, 0 replies; 35+ messages in thread
From: Stefan Monnier @ 2010-06-17  0:49 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

> === modified file 'lisp/help-mode.el'
> --- lisp/help-mode.el	2010-05-20 23:54:55 +0000
> +++ lisp/help-mode.el	2010-06-16 20:34:05 +0000
> @@ -271,6 +272,8 @@ (defun help-mode ()
>  	  ;; also removes BUFFER from the selected window.
>  	  (with-current-buffer buffer
>  	    (bury-buffer))))
> +  (set (make-local-variable 'revert-buffer-function)
> +       'help-mode-revert-buffer)
 
>    (run-mode-hooks 'help-mode-hook))
 
> @@ -783,6 +786,15 @@ (defun help-follow-symbol (&optional pos
>  	      (fboundp sym) (facep sym))
>        (help-do-xref pos #'help-xref-interned (list sym)))))
 
> +(defun help-mode-revert-buffer (ignore-auto noconfirm)
> +  (when (or noconfirm (yes-or-no-p "Revert help buffer? "))
> +    (let ((pos (point))
> +	  (item help-xref-stack-item)
> +	  ;; Pretend there is no current item to add to the history.
> +	  (help-xref-stack-item nil))
> +      (apply (car item) (cdr item))
> +      (goto-char pos))))
> +
>  (defun help-insert-string (string)
>    "Insert STRING to the help buffer and install xref info for it.
>  This function can be used to restore the old contents of the help buffer

Looks good, thanks.  Tho I think you'll need to bind help-xref-following
to make sure that in a *Help*<2> buffer you don't end up "reverting"
into a new *Help* buffer.


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-16 20:33           ` Juri Linkov
@ 2010-06-17  0:50             ` Stefan Monnier
  2010-06-17 20:34               ` Juri Linkov
  0 siblings, 1 reply; 35+ messages in thread
From: Stefan Monnier @ 2010-06-17  0:50 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan

> Reverting in Info is implemented by the function `Info-revert-find-node'
> whose purpose is to go to an Info node (like `Info-find-node'),
> by killing the original buffer and creating a new one.

> This is peculiar, but I'd like to avoid reimplementing this mechanism to
> keep the traditional behavior, and simply fix a bug to allow it to work
> with buffer names other than the default "*info*":

OTOH I'd really like to see this part of the code modified, because
I think it would clean it up.


        Stefan



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-15 23:38               ` Wojciech Meyer
  2010-06-16 13:39                 ` Stefan Monnier
@ 2010-06-17  8:00                 ` Richard Stallman
  2010-06-17  8:52                   ` Wojciech Meyer
  1 sibling, 1 reply; 35+ messages in thread
From: Richard Stallman @ 2010-06-17  8:00 UTC (permalink / raw)
  To: Wojciech Meyer
  Cc: wojciech.meyer, joakim, emacs-devel, juri, monnier,
	deniz.a.m.dogan

Which info nodes would you sayo are the most refreshing?

;-).



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-17  0:46                     ` Stefan Monnier
@ 2010-06-17  8:29                       ` Juri Linkov
  0 siblings, 0 replies; 35+ messages in thread
From: Juri Linkov @ 2010-06-17  8:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Deniz Dogan, Wojciech Meyer, joakim, emacs-devel

>>> vc-dired was painfully slow), dired already uses up a lot of horizontal
>>> space and a lot of key-bindings, so adding VC to it is problematic.
> [...]
>> Better than making pcl-cvs and vc-dired compatible with dired,
>> would be make them compatible with each other.  Sometimes
>
> vc-dired doesn't exist any more.

Oops, sorry, I meant vc-dir.

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-17  8:00                 ` Richard Stallman
@ 2010-06-17  8:52                   ` Wojciech Meyer
  0 siblings, 0 replies; 35+ messages in thread
From: Wojciech Meyer @ 2010-06-17  8:52 UTC (permalink / raw)
  To: rms; +Cc: juri, emacs-devel, monnier, joakim, deniz.a.m.dogan

On Thu, Jun 17, 2010 at 9:00 AM, Richard Stallman <rms@gnu.org> wrote:
> Which info nodes would you sayo are the most refreshing?
>
> ;-).
>

Eshell info node I found the most refreshing these days :)

I worked a little bit on this, because i think it is important for us
to have a decent shell in Emacs, currently it works good but the
documentation is not complete. The other reason is that I want to know
about Eshell more.



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-17  0:50             ` Stefan Monnier
@ 2010-06-17 20:34               ` Juri Linkov
  0 siblings, 0 replies; 35+ messages in thread
From: Juri Linkov @ 2010-06-17 20:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Wojciech Meyer, Deniz Dogan

>> Reverting in Info is implemented by the function `Info-revert-find-node'
>> whose purpose is to go to an Info node (like `Info-find-node'),
>> by killing the original buffer and creating a new one.
>
>> This is peculiar, but I'd like to avoid reimplementing this mechanism to
>> keep the traditional behavior, and simply fix a bug to allow it to work
>> with buffer names other than the default "*info*":
>
> OTOH I'd really like to see this part of the code modified, because
> I think it would clean it up.

`Info-revert-find-node' might be used already by some users as
a standalone function.  Maybe we should write a new function.

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-06-16 13:39                 ` Stefan Monnier
  2010-06-16 20:43                   ` Juri Linkov
@ 2010-08-28 20:38                   ` Wojciech Meyer
  2010-08-28 20:50                     ` Eli Zaretskii
  1 sibling, 1 reply; 35+ messages in thread
From: Wojciech Meyer @ 2010-08-28 20:38 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Juri Linkov, Deniz Dogan, Wojciech Meyer, joakim, emacs-devel

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

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Currently special-mode is under used, so patches to use it in more
> places are very welcome.

Here is a `bzr bundle' to make use of the `special-mode' in more places.
Modes that were under special treatment:

archive-mode 
bookmark-bmenu-mode 
doc-view-mode 
image-mode 
occur-mode
tar-mode

In `archive-mode' I needed to get rid of optional argument `force',
which was used to avoid somebody switching manually the mode, and since
the symbol's become interactive, there is a danger (accoring to the
comments - corruption). So I just added a help notice, saying that the
user should not call `archive-mode' on her own.

For the similar reasons I've left alone `dired-mode' and friends, as
this takes arguments. (which are used).

I didn't touch `ibuffer-mode' as this assert explicitly that the mode
should not be derived (not sure why!), due too:
`ibuffer-assert-ibuffer-mode' called from several places, and breaks
`ibuffer' badly.

These are not all the places were we should consider inheriting from
special mode, possibly many other places where we could replace `defun'
with `define-derived-mode'. Also I've noticed some incosistency across
key-bindings, or duplications.

Cheers;
Wojciech


[-- Attachment #2: define-derived-mode-special.txt --]
[-- Type: text/plain, Size: 19389 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: wojciech.meyer@gmail.com-20100828202929-\
#   roh7mjkfjei6fjc5
# target_branch: http://bzr.savannah.gnu.org/r/emacs/trunk
# testament_sha1: d2ad07a420042e9eccdc83278214b3fd852d27ae
# timestamp: 2010-08-28 21:36:02 +0100
# source_branch: ../define-derived-mode/
# base_revision_id: eliz@gnu.org-20100828081013-yktp2zr7iafsxjtk
# 
# Begin patch
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2010-07-10 18:52:53 +0000
+++ lisp/arc-mode.el	2010-08-28 17:47:11 +0000
@@ -341,7 +341,6 @@
 (defvar archive-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'archive-next-line)
     (define-key map "a" 'archive-alternate-display)
     ;;(define-key map "c" 'archive-copy)
     (define-key map "d" 'archive-flag-deleted)
@@ -349,15 +348,12 @@
     (define-key map "e" 'archive-extract)
     (define-key map "f" 'archive-extract)
     (define-key map "\C-m" 'archive-extract)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "h" 'describe-mode)
     (define-key map "m" 'archive-mark)
     (define-key map "n" 'archive-next-line)
     (define-key map "\C-n" 'archive-next-line)
     (define-key map [down] 'archive-next-line)
     (define-key map "o" 'archive-extract-other-window)
     (define-key map "p" 'archive-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\C-p" 'archive-previous-line)
     (define-key map [up] 'archive-previous-line)
     (define-key map "r" 'archive-rename-entry)
@@ -636,7 +632,7 @@
 ;;; Section: the mode definition
 
 ;;;###autoload
-(defun archive-mode (&optional force)
+(define-derived-mode archive-mode special-mode "Archive mode"
   "Major mode for viewing an archive file in a dired-like way.
 You can move around using the usual cursor motion commands.
 Letters no longer insert themselves.
@@ -647,13 +643,17 @@
 save it, the contents of that buffer will be saved back into the
 archive.
 
+This mode should be used non-interactively only.
+
 \\{archive-mode-map}"
   ;; 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.
   (if (zerop (buffer-size))
       ;; At present we cannot create archives from scratch
       (funcall (or (default-value 'major-mode) 'fundamental-mode))
-    (if (and (not force) archive-files) nil
+    (if archive-files nil
       (let* ((type (archive-find-type))
 	     (typename (capitalize (symbol-name type))))
 	(kill-all-local-variables)
@@ -698,7 +698,6 @@
 		      (string-match file-name-invalid-regexp
 				    (buffer-file-name)))))
 
-	(setq major-mode 'archive-mode)
 	(setq mode-name (concat typename "-Archive"))
 	;; Run archive-foo-mode-hook and archive-mode-hook
 	(run-mode-hooks (archive-name "mode-hook") 'archive-mode-hook)
@@ -714,8 +713,7 @@
 		locale-coding-system))
       (if (default-value 'enable-multibyte-characters)
 	  (set-buffer-multibyte 'to))
-      (archive-summarize nil)
-      (setq buffer-read-only t))))
+      (archive-summarize nil))))
 
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)

=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2010-07-14 19:09:28 +0000
+++ lisp/bookmark.el	2010-08-28 17:45:38 +0000
@@ -1499,7 +1499,6 @@
 (defvar bookmark-bmenu-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map t)
-    (define-key map "q" 'quit-window)
     (define-key map "v" 'bookmark-bmenu-select)
     (define-key map "w" 'bookmark-bmenu-locate)
     (define-key map "2" 'bookmark-bmenu-2-window)
@@ -1515,11 +1514,9 @@
     (define-key map "\C-d" 'bookmark-bmenu-delete-backwards)
     (define-key map "x" 'bookmark-bmenu-execute-deletions)
     (define-key map "d" 'bookmark-bmenu-delete)
-    (define-key map " " 'next-line)
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
     (define-key map "\177" 'bookmark-bmenu-backup-unmark)
-    (define-key map "?" 'describe-mode)
     (define-key map "u" 'bookmark-bmenu-unmark)
     (define-key map "m" 'bookmark-bmenu-mark)
     (define-key map "l" 'bookmark-bmenu-load)
@@ -1609,7 +1606,7 @@
 
 
 
-(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)
   (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))
 
 

=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el	2010-07-14 15:57:54 +0000
+++ lisp/doc-view.el	2010-08-28 20:21:22 +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)
     (define-key map (kbd "r")         'doc-view-revert-buffer)
     map)
   "Keymap used by `doc-view-mode' when displaying a doc as a set of images.")
@@ -1207,7 +1206,7 @@
     l))
 
 ;;;###autoload
-(defun doc-view-mode ()
+(define-derived-mode doc-view-mode special-mode "Doc"
   "Major mode in DocView buffers.
 
 DocView Mode is an Emacs document viewer.  It displays PDF, PS
@@ -1216,7 +1215,6 @@
 You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
 toggle between displaying the document or editing it as text.
 \\{doc-view-mode-map}"
-  (interactive)
 
   (if (= (point-min) (point-max))
       ;; The doc is empty or doesn't exist at all, so fallback to
@@ -1311,15 +1309,14 @@
     (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc)
     (set (make-local-variable 'bookmark-make-record-function)
 	 'doc-view-bookmark-make-record)
-    (setq mode-name "DocView"
-	  buffer-read-only t
-	  major-mode 'doc-view-mode)
+    (setq buffer-read-only t)
     (doc-view-initiate-display)
     ;; Switch off view-mode explicitly, because doc-view-mode is the
     ;; canonical view mode for PDF/PS/DVI files.  This could be
     ;; switched on automatically depending on the value of
     ;; `view-read-only'.
     (set (make-local-variable 'view-read-only) nil)
+    (setq revert-buffer-function 'doc-view-revert-buffer)
     (run-mode-hooks 'doc-view-mode-hook)))
 
 ;;;###autoload

=== modified file 'lisp/image-mode.el'
--- lisp/image-mode.el	2010-08-17 21:19:11 +0000
+++ lisp/image-mode.el	2010-08-28 20:21:22 +0000
@@ -314,9 +314,7 @@
 (defvar image-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    (define-key map "q"         'quit-window)
     (define-key map "\C-c\C-c" 'image-toggle-display)
-    (define-key map (kbd "SPC")       'image-scroll-up)
     (define-key map (kbd "DEL")       'image-scroll-down)
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
@@ -346,18 +344,16 @@
 (put 'image-mode 'mode-class 'special)
 
 ;;;###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)
 
 	(if (not (image-get-display-property))
 	    (progn

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2010-08-08 21:12:29 +0000
+++ lisp/replace.el	2010-08-28 20:21:22 +0000
@@ -766,8 +766,6 @@
     (define-key map "\M-p" 'occur-prev)
     (define-key map "r" 'occur-rename-buffer)
     (define-key map "c" 'clone-buffer)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "q" 'quit-window)
     (define-key map "z" 'kill-this-buffer)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
     (define-key map [menu-bar] (make-sparse-keymap))
@@ -834,18 +832,15 @@
   :group 'matching)
 
 (put 'occur-mode 'mode-class 'special)
-(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)
-  (setq major-mode 'occur-mode)
-  (setq mode-name "Occur")
   (set (make-local-variable 'revert-buffer-function) 'occur-revert-function)
   (make-local-variable 'occur-revert-arguments)
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)

=== modified file 'lisp/tar-mode.el'
--- lisp/tar-mode.el	2010-05-03 02:29:46 +0000
+++ lisp/tar-mode.el	2010-08-28 17:55:47 +0000
@@ -524,7 +524,6 @@
 (defvar tar-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'tar-next-line)
     (define-key map "C" 'tar-copy)
     (define-key map "d" 'tar-flag-deleted)
     (define-key map "\^D" 'tar-flag-deleted)
@@ -532,14 +531,12 @@
     (define-key map "f" 'tar-extract)
     (define-key map "\C-m" 'tar-extract)
     (define-key map [mouse-2] 'tar-mouse-extract)
-    (define-key map "g" 'revert-buffer)
     (define-key map "h" 'describe-mode)
     (define-key map "n" 'tar-next-line)
     (define-key map "\^N" 'tar-next-line)
     (define-key map [down] 'tar-next-line)
     (define-key map "o" 'tar-extract-other-window)
     (define-key map "p" 'tar-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\^P" 'tar-previous-line)
     (define-key map [up] 'tar-previous-line)
     (define-key map "R" 'tar-rename-entry)
@@ -615,7 +612,7 @@
   (if (buffer-live-p tar-data-buffer) (kill-buffer tar-data-buffer)))
 
 ;;;###autoload
-(define-derived-mode tar-mode nil "Tar"
+(define-derived-mode tar-mode special-mode "Tar"
   "Major mode for viewing a tar file as a dired-like listing of its contents.
 You can move around using the usual cursor motion commands.
 Letters no longer insert themselves.

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWaHya4QAHyrfgFgwUPf///Yj
1ID////wYCCOuB7mKtvm89nPbe9Wp59JtslLTWsKLucpyqjV9ddvcbblLrZNnbTkIZ17Dbz33nnD
Z7jdgjfb577tzV9LhAMgkgUVBXxYkWLINCE0ADRoyRGySBjUaD1AaD1ABKQBkBBTRNNTFDGUA0AA
AAJQCAkAKEyE9NJoNAAADQASaURqTSnmqafpPSh6mgAA00ADQ0ACKJAk0yNNJ5MJgJkDQqb0UaMR
6j1D0EUiaAAQRppMAjTSKbaUGQGEGk0gAECIv6JfuYKf88w96HgcIwUNDEV796LnbLJLImpQOzn5
xmIGJSgNpRUp6ME8WB5b9M69H6Hui26yu1mIkEjmm9DeFvM/4G9B0Q+gFX2BiWwWVA/FR/cfdC2L
fQbFQXs+YOj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L/Y9lDBE3HtE5qrsezCCedAVz4+oSejAp+e0TUhq7xTPYCakyIQmTvMT8odnsCQKQKt5aIl
4pzE7ASp1rB2i9qM3Am0TDyIA8piDWJ1iQITqEA6hJTxE1mEEykRgkDrYJpETRiSETgJAJkE90OV
gmF1rYoo0VXUCXhn8yJPXgTH5NxYAj2nqQabYO4E9gSREvtoXcvjpoq1aRIEDfagkuNarOkbuAN/
gCdgn8ULxMkHG86CYiTBXBTtEofaG5i58jch+kCX+AJ2Fl6ATWR3fKHcPvcyGeCooisGMixYosVV
FUiPQkNEDfkQIYJD0j1kgsWLFixYosUWKLFixYosUXsIbbEhAnsJBaCYhO4MkUBIS+qvTZqZpuE+
BO9ryO3s0I5yCoigQVPmiVGff83AlBT3BSsEu4+kvWW9q1tgJB2AlwWgpeCZysBOegJxAS0fIfN4
GKq4gr+7xQlOP3L5CrhBKxssgSGTSJWeQgEDefQT09VKxPYT+qPgJ2Q9FYlOaAfQSRPsTfE2Anvt
+ZnIg5+De5FnR7zHvP5PUSsTkpqvqJncyEAyvS0CBgvITIhU7gV6p7H5EtTUI7hLCsQSf6ofQT8C
VmUFYkXoXCYPATr22a4axNW2zLrEA4nHgEkkSkEkSkEkWCUbBKNglGwSjQSjYJRoJRsEo0Eo2CUb
BKNglGwSxKCUbBKDKCUb+AQ8uj5NzcTHETMh3IbBAJE8xKukTt99HdwEzCZUPGxSniJiJ1fDK8Ss
ADICQJJfkZAkQCYCeAnmUJ6shEW3g7X1CVXKe4laHo3x8CQKeAkbltEyIegl8ElCoTIJyc69In8i
7kinChIUPk1wgA==

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-08-28 20:38                   ` Wojciech Meyer
@ 2010-08-28 20:50                     ` Eli Zaretskii
  2010-08-28 22:17                       ` Wojciech Meyer
  0 siblings, 1 reply; 35+ messages in thread
From: Eli Zaretskii @ 2010-08-28 20:50 UTC (permalink / raw)
  To: Wojciech Meyer; +Cc: juri, emacs-devel, monnier, joakim, deniz.a.m.dogan

> From: Wojciech Meyer <wojciech.meyer@googlemail.com>
> Date: Sat, 28 Aug 2010 21:38:29 +0100
> Cc: Juri Linkov <juri@jurta.org>, Deniz Dogan <deniz.a.m.dogan@gmail.com>,
> 	Wojciech Meyer <wojciech.meyer@googlemail.com>, joakim@verona.se,
> 	emacs-devel@gnu.org
> 
> Here is a `bzr bundle' to make use of the `special-mode' in more places.

Thanks.

> In `archive-mode' I needed to get rid of optional argument `force',
> which was used to avoid somebody switching manually the mode

That "somebody" is archive-maybe-update, which calls archive-mode
with the `force' argument non-nil.  I don't see any changes in
archive-maybe-update to adjust for the loss of this feature.



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-08-28 20:50                     ` Eli Zaretskii
@ 2010-08-28 22:17                       ` Wojciech Meyer
  2010-08-29 15:18                         ` Wojciech Meyer
  0 siblings, 1 reply; 35+ messages in thread
From: Wojciech Meyer @ 2010-08-28 22:17 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: Wojciech Meyer, joakim, emacs-devel, juri, monnier,
	deniz.a.m.dogan

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

Eli Zaretskii <eliz@gnu.org> writes:

>> In `archive-mode' I needed to get rid of optional argument `force',
>> which was used to avoid somebody switching manually the mode
>
> That "somebody" is archive-maybe-update, which calls archive-mode
> with the `force' argument non-nil.  I don't see any changes in
> archive-maybe-update to adjust for the loss of this feature.

Yes, sorry, my fault to not check it (as i did for dired)!

Correct patch attached.

Cheers;

Wojciech


[-- Attachment #2: define-derived-mode-special.txt --]
[-- Type: text/plain, Size: 21557 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: wojciech.meyer@gmail.com-20100828220854-\
#   574a373p263zx55o
# target_branch: http://bzr.savannah.gnu.org/r/emacs/trunk
# testament_sha1: c7e126cfa572c47e18255bd7e35af3140c5be6f4
# timestamp: 2010-08-28 23:09:18 +0100
# source_branch: ../define-derived-mode/
# base_revision_id: eliz@gnu.org-20100828081013-yktp2zr7iafsxjtk
# 
# Begin patch
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2010-07-10 18:52:53 +0000
+++ lisp/arc-mode.el	2010-08-28 22:08:54 +0000
@@ -341,7 +341,6 @@
 (defvar archive-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'archive-next-line)
     (define-key map "a" 'archive-alternate-display)
     ;;(define-key map "c" 'archive-copy)
     (define-key map "d" 'archive-flag-deleted)
@@ -349,15 +348,12 @@
     (define-key map "e" 'archive-extract)
     (define-key map "f" 'archive-extract)
     (define-key map "\C-m" 'archive-extract)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "h" 'describe-mode)
     (define-key map "m" 'archive-mark)
     (define-key map "n" 'archive-next-line)
     (define-key map "\C-n" 'archive-next-line)
     (define-key map [down] 'archive-next-line)
     (define-key map "o" 'archive-extract-other-window)
     (define-key map "p" 'archive-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\C-p" 'archive-previous-line)
     (define-key map [up] 'archive-previous-line)
     (define-key map "r" 'archive-rename-entry)
@@ -632,24 +628,10 @@
 		(error "Entry is not a regular member of the archive"))))
       (if (not noerror)
           (error "Line does not describe a member of the archive")))))
-;; -------------------------------------------------------------------------
-;;; Section: the mode definition
-
-;;;###autoload
-(defun archive-mode (&optional force)
-  "Major mode for viewing an archive file in a dired-like way.
-You can move around using the usual cursor motion commands.
-Letters no longer insert themselves.
-Type `e' to pull a file out of the archive and into its own buffer;
-or click mouse-2 on the file's line in the archive mode buffer.
-
-If you edit a sub-file of this archive (as with the `e' command) and
-save it, the contents of that buffer will be saved back into the
-archive.
-
-\\{archive-mode-map}"
-  ;; This is not interactive because you shouldn't be turning this
-  ;; mode on and off.  You can corrupt things that way.
+
+(defun archive-setup-mode (&optional force)
+  "Wrap all the mode setup code into separate function callable from 
+the package code."
   (if (zerop (buffer-size))
       ;; At present we cannot create archives from scratch
       (funcall (or (default-value 'major-mode) 'fundamental-mode))
@@ -717,6 +699,30 @@
       (archive-summarize nil)
       (setq buffer-read-only t))))
 
+;; -------------------------------------------------------------------------
+;;; Section: the mode definition
+
+;;;###autoload
+(define-derived-mode archive-mode special-mode "Archive mode"
+  "Major mode for viewing an archive file in a dired-like way.
+You can move around using the usual cursor motion commands.
+Letters no longer insert themselves.
+Type `e' to pull a file out of the archive and into its own buffer;
+or click mouse-2 on the file's line in the archive mode buffer.
+
+If you edit a sub-file of this archive (as with the `e' command) and
+save it, the contents of that buffer will be saved back into the
+archive.
+
+\\{archive-mode-map}"
+  ;; 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.
+  ;;
+  (archive-setup-mode))
+  
+
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)
 
@@ -888,7 +894,7 @@
 	  (setq archive-files nil)
 	  (erase-buffer)
 	  (insert-file-contents name)
-	  (archive-mode t)
+	  (archive-setup-mode t)
 	  (goto-char archive-file-list-start)
 	  (archive-next-line lno))
 	(archive-delete-local name)
@@ -1396,7 +1402,7 @@
     (let ((revert-buffer-function nil)
 	  (coding-system-for-read 'no-conversion))
       (revert-buffer t t))
-    (archive-mode)
+    (archive-setup-mode)
     (goto-char archive-file-list-start)
     (archive-next-line no)))
 

=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2010-07-14 19:09:28 +0000
+++ lisp/bookmark.el	2010-08-28 17:45:38 +0000
@@ -1499,7 +1499,6 @@
 (defvar bookmark-bmenu-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map t)
-    (define-key map "q" 'quit-window)
     (define-key map "v" 'bookmark-bmenu-select)
     (define-key map "w" 'bookmark-bmenu-locate)
     (define-key map "2" 'bookmark-bmenu-2-window)
@@ -1515,11 +1514,9 @@
     (define-key map "\C-d" 'bookmark-bmenu-delete-backwards)
     (define-key map "x" 'bookmark-bmenu-execute-deletions)
     (define-key map "d" 'bookmark-bmenu-delete)
-    (define-key map " " 'next-line)
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
     (define-key map "\177" 'bookmark-bmenu-backup-unmark)
-    (define-key map "?" 'describe-mode)
     (define-key map "u" 'bookmark-bmenu-unmark)
     (define-key map "m" 'bookmark-bmenu-mark)
     (define-key map "l" 'bookmark-bmenu-load)
@@ -1609,7 +1606,7 @@
 
 
 
-(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)
   (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))
 
 

=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el	2010-07-14 15:57:54 +0000
+++ lisp/doc-view.el	2010-08-28 20:21:22 +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)
     (define-key map (kbd "r")         'doc-view-revert-buffer)
     map)
   "Keymap used by `doc-view-mode' when displaying a doc as a set of images.")
@@ -1207,7 +1206,7 @@
     l))
 
 ;;;###autoload
-(defun doc-view-mode ()
+(define-derived-mode doc-view-mode special-mode "Doc"
   "Major mode in DocView buffers.
 
 DocView Mode is an Emacs document viewer.  It displays PDF, PS
@@ -1216,7 +1215,6 @@
 You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
 toggle between displaying the document or editing it as text.
 \\{doc-view-mode-map}"
-  (interactive)
 
   (if (= (point-min) (point-max))
       ;; The doc is empty or doesn't exist at all, so fallback to
@@ -1311,15 +1309,14 @@
     (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc)
     (set (make-local-variable 'bookmark-make-record-function)
 	 'doc-view-bookmark-make-record)
-    (setq mode-name "DocView"
-	  buffer-read-only t
-	  major-mode 'doc-view-mode)
+    (setq buffer-read-only t)
     (doc-view-initiate-display)
     ;; Switch off view-mode explicitly, because doc-view-mode is the
     ;; canonical view mode for PDF/PS/DVI files.  This could be
     ;; switched on automatically depending on the value of
     ;; `view-read-only'.
     (set (make-local-variable 'view-read-only) nil)
+    (setq revert-buffer-function 'doc-view-revert-buffer)
     (run-mode-hooks 'doc-view-mode-hook)))
 
 ;;;###autoload

=== modified file 'lisp/image-mode.el'
--- lisp/image-mode.el	2010-08-17 21:19:11 +0000
+++ lisp/image-mode.el	2010-08-28 20:21:22 +0000
@@ -314,9 +314,7 @@
 (defvar image-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    (define-key map "q"         'quit-window)
     (define-key map "\C-c\C-c" 'image-toggle-display)
-    (define-key map (kbd "SPC")       'image-scroll-up)
     (define-key map (kbd "DEL")       'image-scroll-down)
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
@@ -346,18 +344,16 @@
 (put 'image-mode 'mode-class 'special)
 
 ;;;###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)
 
 	(if (not (image-get-display-property))
 	    (progn

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2010-08-08 21:12:29 +0000
+++ lisp/replace.el	2010-08-28 20:21:22 +0000
@@ -766,8 +766,6 @@
     (define-key map "\M-p" 'occur-prev)
     (define-key map "r" 'occur-rename-buffer)
     (define-key map "c" 'clone-buffer)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "q" 'quit-window)
     (define-key map "z" 'kill-this-buffer)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
     (define-key map [menu-bar] (make-sparse-keymap))
@@ -834,18 +832,15 @@
   :group 'matching)
 
 (put 'occur-mode 'mode-class 'special)
-(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)
-  (setq major-mode 'occur-mode)
-  (setq mode-name "Occur")
   (set (make-local-variable 'revert-buffer-function) 'occur-revert-function)
   (make-local-variable 'occur-revert-arguments)
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)

=== modified file 'lisp/tar-mode.el'
--- lisp/tar-mode.el	2010-05-03 02:29:46 +0000
+++ lisp/tar-mode.el	2010-08-28 17:55:47 +0000
@@ -524,7 +524,6 @@
 (defvar tar-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'tar-next-line)
     (define-key map "C" 'tar-copy)
     (define-key map "d" 'tar-flag-deleted)
     (define-key map "\^D" 'tar-flag-deleted)
@@ -532,14 +531,12 @@
     (define-key map "f" 'tar-extract)
     (define-key map "\C-m" 'tar-extract)
     (define-key map [mouse-2] 'tar-mouse-extract)
-    (define-key map "g" 'revert-buffer)
     (define-key map "h" 'describe-mode)
     (define-key map "n" 'tar-next-line)
     (define-key map "\^N" 'tar-next-line)
     (define-key map [down] 'tar-next-line)
     (define-key map "o" 'tar-extract-other-window)
     (define-key map "p" 'tar-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\^P" 'tar-previous-line)
     (define-key map [up] 'tar-previous-line)
     (define-key map "R" 'tar-rename-entry)
@@ -615,7 +612,7 @@
   (if (buffer-live-p tar-data-buffer) (kill-buffer tar-data-buffer)))
 
 ;;;###autoload
-(define-derived-mode tar-mode nil "Tar"
+(define-derived-mode tar-mode special-mode "Tar"
   "Major mode for viewing a tar file as a dired-like listing of its contents.
 You can move around using the usual cursor motion commands.
 Letters no longer insert themselves.

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWS9AJhUAIWXfgFgwWff///Yn
3KT////6YCPuy5L33OVXz7eXH33bzT3l9nN6U0iktte5hyHuYO+soD73Xb5ut2O2xNNe93ngxB7j
75p33z2+HvDN3G73BO+E5zA9q3G6lFVVVVVezSezdsTG9xoVx7dQkpoRoTQ0MjEBppDSJPakA0AA
PUaPUEoQABBTJTxERDxT9KA9RkBoNDaj1DQJQCEampso9IKn6ppk9qRpkBkMQDIaMgBJqIRNBQZN
GqZlPUeUGnogbUMgAAACJSCaMp6k8U/UyTBNPTRlT0aA1Mp6jQAGg9QRSE0AE00RpqR6J6KeVP9G
pT1PSDEaAYjBFRMAbnBOYpL8Rv7uFcaP9ftL4M7fhp/s8hx5a3nNxzx7fbWOu29a31XvCHl8P5DL
AUuUUA1RQqUfucJ24VdRH+vMHT/d+09DXO9cQ8kSPcl9WX1H+VX/sl9R+TL+RRTH+4pTRqIv7XL+
R+T1kdk/rMCoL06zzhqyuNtXbZyTZ+zvrHW7PUjvQGm/F+izpoxfstkr7ZP8KB8Cp7N86uCId2dd
1eHH4Vuu8xKvwsvYUVVOLRciLM9W4142lh/VQRDVUMqILrs4anWpbCLFKznGOu2qubOldnSapoDS
dnPaggHMk+BeOJTKdb1aYYdUviudl9JsbbZ2uRWWti8LaAULjpWJQta+UEFe7EOpNYBDMiemysE1
bhTpgJbATmCiuuHGK66+9u6AXQMSnEzr5ylKJB99SRxa20Xa9U/gqclgwgoskWCiMRAFAUVRQRAR
IoKRRRRZz9chA7/HPu1QQ6CIc+PnY8ppHVnTDo9ejg6ksDBQMDBQLcf0eylKy1IxIpiWezGBSy4v
T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EI4l2boa51Xc4Qo/d6RLhOZTSu8TlztEQMdF0JJCLogUGFCIGBSgj0Kr0p2+B8hM6aQmHSJn
LhRK/ITzE9hKmpBUSMRMBM3gTJ9K/CGwT3+lcINuHaiBwOHeFChKJChKJChKJChKJCg1BKGoJQ0C
UNQShqCUNQShoEoaglDUEoaglDUEqJQJQ1BKBlAlDQJQ19cIfDc+GjQl9CHiQ4IMkIBhHzEQ0CLv
jHZmIwEfeK9B8p0ibITkE6nsxvEtUAxAoiUXtWiJPYURMhO4kywnyZCit3Dv0P2ZVErip8xLkPi4
QyEip3iTcuYTah7hL0SiFYm0Tg+5eBzE/79v/xdyRThQkC9AJhU=

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-08-28 22:17                       ` Wojciech Meyer
@ 2010-08-29 15:18                         ` Wojciech Meyer
  2010-09-11 13:19                           ` Stefan Monnier
  0 siblings, 1 reply; 35+ messages in thread
From: Wojciech Meyer @ 2010-08-29 15:18 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: Wojciech Meyer, joakim, emacs-devel, juri, monnier,
	deniz.a.m.dogan

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

> Correct patch attached.

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?

Thanks,
Wojciech

[-- Attachment #2: define-derived-mode-special-FINAL.txt --]
[-- Type: text/plain, Size: 21895 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: wojciech.meyer@gmail.com-20100829150839-\
#   946nk06x5bq8glq3
# target_branch: http://bzr.savannah.gnu.org/r/emacs/trunk
# testament_sha1: ae60fb4dc86c7121984c9f2cbb1b030c3bb2cd8f
# timestamp: 2010-08-29 16:09:19 +0100
# source_branch: ../define-derived-mode/
# base_revision_id: eliz@gnu.org-20100828081013-yktp2zr7iafsxjtk
# 
# Begin patch
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2010-07-10 18:52:53 +0000
+++ lisp/arc-mode.el	2010-08-28 22:08:54 +0000
@@ -341,7 +341,6 @@
 (defvar archive-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'archive-next-line)
     (define-key map "a" 'archive-alternate-display)
     ;;(define-key map "c" 'archive-copy)
     (define-key map "d" 'archive-flag-deleted)
@@ -349,15 +348,12 @@
     (define-key map "e" 'archive-extract)
     (define-key map "f" 'archive-extract)
     (define-key map "\C-m" 'archive-extract)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "h" 'describe-mode)
     (define-key map "m" 'archive-mark)
     (define-key map "n" 'archive-next-line)
     (define-key map "\C-n" 'archive-next-line)
     (define-key map [down] 'archive-next-line)
     (define-key map "o" 'archive-extract-other-window)
     (define-key map "p" 'archive-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\C-p" 'archive-previous-line)
     (define-key map [up] 'archive-previous-line)
     (define-key map "r" 'archive-rename-entry)
@@ -632,24 +628,10 @@
 		(error "Entry is not a regular member of the archive"))))
       (if (not noerror)
           (error "Line does not describe a member of the archive")))))
-;; -------------------------------------------------------------------------
-;;; Section: the mode definition
-
-;;;###autoload
-(defun archive-mode (&optional force)
-  "Major mode for viewing an archive file in a dired-like way.
-You can move around using the usual cursor motion commands.
-Letters no longer insert themselves.
-Type `e' to pull a file out of the archive and into its own buffer;
-or click mouse-2 on the file's line in the archive mode buffer.
-
-If you edit a sub-file of this archive (as with the `e' command) and
-save it, the contents of that buffer will be saved back into the
-archive.
-
-\\{archive-mode-map}"
-  ;; This is not interactive because you shouldn't be turning this
-  ;; mode on and off.  You can corrupt things that way.
+
+(defun archive-setup-mode (&optional force)
+  "Wrap all the mode setup code into separate function callable from 
+the package code."
   (if (zerop (buffer-size))
       ;; At present we cannot create archives from scratch
       (funcall (or (default-value 'major-mode) 'fundamental-mode))
@@ -717,6 +699,30 @@
       (archive-summarize nil)
       (setq buffer-read-only t))))
 
+;; -------------------------------------------------------------------------
+;;; Section: the mode definition
+
+;;;###autoload
+(define-derived-mode archive-mode special-mode "Archive mode"
+  "Major mode for viewing an archive file in a dired-like way.
+You can move around using the usual cursor motion commands.
+Letters no longer insert themselves.
+Type `e' to pull a file out of the archive and into its own buffer;
+or click mouse-2 on the file's line in the archive mode buffer.
+
+If you edit a sub-file of this archive (as with the `e' command) and
+save it, the contents of that buffer will be saved back into the
+archive.
+
+\\{archive-mode-map}"
+  ;; 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.
+  ;;
+  (archive-setup-mode))
+  
+
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)
 
@@ -888,7 +894,7 @@
 	  (setq archive-files nil)
 	  (erase-buffer)
 	  (insert-file-contents name)
-	  (archive-mode t)
+	  (archive-setup-mode t)
 	  (goto-char archive-file-list-start)
 	  (archive-next-line lno))
 	(archive-delete-local name)
@@ -1396,7 +1402,7 @@
     (let ((revert-buffer-function nil)
 	  (coding-system-for-read 'no-conversion))
       (revert-buffer t t))
-    (archive-mode)
+    (archive-setup-mode)
     (goto-char archive-file-list-start)
     (archive-next-line no)))
 

=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2010-07-14 19:09:28 +0000
+++ lisp/bookmark.el	2010-08-28 17:45:38 +0000
@@ -1499,7 +1499,6 @@
 (defvar bookmark-bmenu-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map t)
-    (define-key map "q" 'quit-window)
     (define-key map "v" 'bookmark-bmenu-select)
     (define-key map "w" 'bookmark-bmenu-locate)
     (define-key map "2" 'bookmark-bmenu-2-window)
@@ -1515,11 +1514,9 @@
     (define-key map "\C-d" 'bookmark-bmenu-delete-backwards)
     (define-key map "x" 'bookmark-bmenu-execute-deletions)
     (define-key map "d" 'bookmark-bmenu-delete)
-    (define-key map " " 'next-line)
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
     (define-key map "\177" 'bookmark-bmenu-backup-unmark)
-    (define-key map "?" 'describe-mode)
     (define-key map "u" 'bookmark-bmenu-unmark)
     (define-key map "m" 'bookmark-bmenu-mark)
     (define-key map "l" 'bookmark-bmenu-load)
@@ -1609,7 +1606,7 @@
 
 
 
-(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)
   (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))
 
 

=== 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)
     (define-key map (kbd "r")         'doc-view-revert-buffer)
     map)
   "Keymap used by `doc-view-mode' when displaying a doc as a set of images.")
@@ -1207,7 +1206,7 @@
     l))
 
 ;;;###autoload
-(defun doc-view-mode ()
+(define-derived-mode doc-view-mode special-mode "Doc"
   "Major mode in DocView buffers.
 
 DocView Mode is an Emacs document viewer.  It displays PDF, PS
@@ -1216,7 +1215,6 @@
 You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
 toggle between displaying the document or editing it as text.
 \\{doc-view-mode-map}"
-  (interactive)
 
   (if (= (point-min) (point-max))
       ;; The doc is empty or doesn't exist at all, so fallback to
@@ -1311,15 +1309,14 @@
     (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc)
     (set (make-local-variable 'bookmark-make-record-function)
 	 'doc-view-bookmark-make-record)
-    (setq mode-name "DocView"
-	  buffer-read-only t
-	  major-mode 'doc-view-mode)
+    (setq buffer-read-only t)
     (doc-view-initiate-display)
     ;; Switch off view-mode explicitly, because doc-view-mode is the
     ;; canonical view mode for PDF/PS/DVI files.  This could be
     ;; switched on automatically depending on the value of
     ;; `view-read-only'.
     (set (make-local-variable 'view-read-only) nil)
+    (set (make-local-variable 'revert-buffer-function) 'doc-view-revert-buffer)
     (run-mode-hooks 'doc-view-mode-hook)))
 
 ;;;###autoload

=== modified file 'lisp/image-mode.el'
--- lisp/image-mode.el	2010-08-17 21:19:11 +0000
+++ lisp/image-mode.el	2010-08-28 20:21:22 +0000
@@ -314,9 +314,7 @@
 (defvar image-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    (define-key map "q"         'quit-window)
     (define-key map "\C-c\C-c" 'image-toggle-display)
-    (define-key map (kbd "SPC")       'image-scroll-up)
     (define-key map (kbd "DEL")       'image-scroll-down)
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
@@ -346,18 +344,16 @@
 (put 'image-mode 'mode-class 'special)
 
 ;;;###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)
 
 	(if (not (image-get-display-property))
 	    (progn

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2010-08-08 21:12:29 +0000
+++ lisp/replace.el	2010-08-28 20:21:22 +0000
@@ -766,8 +766,6 @@
     (define-key map "\M-p" 'occur-prev)
     (define-key map "r" 'occur-rename-buffer)
     (define-key map "c" 'clone-buffer)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "q" 'quit-window)
     (define-key map "z" 'kill-this-buffer)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
     (define-key map [menu-bar] (make-sparse-keymap))
@@ -834,18 +832,15 @@
   :group 'matching)
 
 (put 'occur-mode 'mode-class 'special)
-(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)
-  (setq major-mode 'occur-mode)
-  (setq mode-name "Occur")
   (set (make-local-variable 'revert-buffer-function) 'occur-revert-function)
   (make-local-variable 'occur-revert-arguments)
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)

=== modified file 'lisp/tar-mode.el'
--- lisp/tar-mode.el	2010-05-03 02:29:46 +0000
+++ lisp/tar-mode.el	2010-08-28 17:55:47 +0000
@@ -524,7 +524,6 @@
 (defvar tar-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'tar-next-line)
     (define-key map "C" 'tar-copy)
     (define-key map "d" 'tar-flag-deleted)
     (define-key map "\^D" 'tar-flag-deleted)
@@ -532,14 +531,12 @@
     (define-key map "f" 'tar-extract)
     (define-key map "\C-m" 'tar-extract)
     (define-key map [mouse-2] 'tar-mouse-extract)
-    (define-key map "g" 'revert-buffer)
     (define-key map "h" 'describe-mode)
     (define-key map "n" 'tar-next-line)
     (define-key map "\^N" 'tar-next-line)
     (define-key map [down] 'tar-next-line)
     (define-key map "o" 'tar-extract-other-window)
     (define-key map "p" 'tar-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\^P" 'tar-previous-line)
     (define-key map [up] 'tar-previous-line)
     (define-key map "R" 'tar-rename-entry)
@@ -615,7 +612,7 @@
   (if (buffer-live-p tar-data-buffer) (kill-buffer tar-data-buffer)))
 
 ;;;###autoload
-(define-derived-mode tar-mode nil "Tar"
+(define-derived-mode tar-mode special-mode "Tar"
   "Major mode for viewing a tar file as a dired-like listing of its contents.
 You can move around using the usual cursor motion commands.
 Letters no longer insert themselves.

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWb0YKQ8AIuZfgFgwWff///cn
3KT////6YCUbtsF9i2i7ePd0898++n3y7u9vvLQ9ZdmUqqNNHOZThAV7u7Xm13bk7PdnbK2duHED
DvFX33z7e0cPZ3vLdcGx8fHvvtfevca7xxygCq+jWwDVNjViaihiaDQgmQEaYJhBpommoH6oaBoA
AAAlCAAIIRBTyp+qNlHpAfqQ0DQAANAlAmQgmgmUniUDyg8oAADQDR6jQAk1EIpiDJMhNJ+pinqG
1A0GygNABpoAIpEmART00ym0ymTMJkZIyTTSek0A0Gj1HqCKQQCZMgJpoFPSmank0p+qPUMIyDCM
TTaaEoB2UKPQA/2N/ZRO5r/j9x80Mvjz3+hyPU9vDn1FPLHr9dY69t61vqvdCHd4n9BlgLLlFANU
UKYQfVQKhQM5mhdk7FO+vxFImn0TaWVhobRAdiHYF1mf+ivmPky/Iwpt9ApjkcpF/o6/I+ULTL2P
qmFNhUF63xwc6rKuNtZzhwbps/NrWOu7PQjvUDTfpfxWctGL8rcmvsyfWgexnur9DZJDu5cebzzZ
fROfTN4b3daxsIqdN8ZMY2q3W3Tj07M0X8qSQ4pOSQePZcOR11LYRYpWc4x17aq5s6V2dJqmgNJ2
OeypIBxJPwDeOEplOt6tMJOtL4VxcfUuty95vJE6tWLwtQChdHScWQqr6iIK90ik4K2XolopxrRE
291TvCJZCJzCQB3p72SdMfdm/gBukats8T5qqmoeWijzbT275k58AJ9YE6ARJBREAUiiMRAFAUVR
QRARIoKRRRRZy8xUOXauFkkTJU5dPC061sZxKbfMKxSztMJwSwMFAwMFAtx/N6UlWWbIyWRTFmcp
jqE2erfV7ZDqCwwNN5mpcoR5EZkuOdA8KqkC3WlhbLhcrOL4vYyPd1l82aLLhilhSVhSMsDqNmHB
h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h3kJDIE7DokFixYsWLFFixYosWLFiixYoouSGju0A
yU+okF4p04idglExSE3IgZ2ejpKZT3E/yE82uhh2039Z6UKS3TSJ6VuKl4QQRVOqpQW+7hWKYgHe
ANIpZn75bJZ6wKWoUgu6ikDFwA4CmbITzhbhTbeKdAUuGrucUGaB72y+IM7jRAkIB+DoUlOPwIux
yBAkKYlppgSQya5HYJgFR4gIQNzyE5c1MQnwE/cj4CZ8ZJvpEo8wEwEkJ9CWQkdPcU+7E/Gb0ICz
rgesBBDmXW+LSPK7wCCT+brErE0KZV3CZMdoTAQlbXBERBC2wEhgkQgXkpKOoQDWvd4HqJYuUYL9
YlhWIpR5idonMSkyEFKsXCWiYPSJe7Ke6HEJ79lNsPVf3AIcDhvCRIiSQSIkkEhqCUNQShqCUNQS
hoEoaglDUEoaglDQJQ1BKGoJQ1BKGoJUSgShqCUDKglDQJQ0CUNfUU8qzypKSCd4mkTqQ7wEJCch
KLxNHx1dGvaJqE9EOwdSHlYpX3iZBO1qyXCUigaASFJL7LIUj7CQpkJ3EmVJ7MhAArzubQfnfSJT
cp4CVoaG+DOJADvEjYtQnUhzEuFJIUCdQnB1r0oYCfrz/+LuSKcKEhejBSHg

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  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
  0 siblings, 2 replies; 35+ messages in thread
From: Stefan Monnier @ 2010-09-11 13:19 UTC (permalink / raw)
  To: Wojciech Meyer; +Cc: juri, Eli Zaretskii, emacs-devel, joakim, deniz.a.m.dogan

> 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



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-09-11 13:19                           ` Stefan Monnier
@ 2010-09-11 14:00                             ` Wojciech Meyer
  2010-09-13  1:34                             ` Wojciech Meyer
  1 sibling, 0 replies; 35+ messages in thread
From: Wojciech Meyer @ 2010-09-11 14:00 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Wojciech Meyer, joakim, emacs-devel, juri, Eli Zaretskii,
	deniz.a.m.dogan

Again, thanks a lot for spending time on it. In the meantime I will fix
these problems, and send you back the new one.

Thanks,
Wojciech

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 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



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  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
  1 sibling, 1 reply; 35+ messages in thread
From: Wojciech Meyer @ 2010-09-13  1:34 UTC (permalink / raw)
  To: Stefan Monnier
  Cc: Wojciech Meyer, joakim, emacs-devel, juri, Eli Zaretskii,
	deniz.a.m.dogan

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


Stefan Monnier <monnier@iro.umontreal.ca> writes:

Thanks for it, below is my update:

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

Done. I am investigating possibility of using swap-buffer with
archive-mode. This is not done yet, so you might consider not applying
diffs to `arc-mode.el' (however I am planning to fix it ASAP too..)

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

>
>> -(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).

Done.

>
>>    (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?

Done.

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

Done. However for some reasons I am not able to revert the buffer with
"g" (and not sure why, AFAIK I could do it before, investigating)
That's why I've left "g" as 'revert-buffer.

BTW:
    (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode)
				doc-view-previous-major-mode
			      major-mode)))
      (set (make-local-variable 'doc-view-previous-major-mode)
    prev-major-mode))

Here is code sensitive on previous major mode, please see comments
below.

Also, there is some problem with reverting itself:
it shows error message: `doc-view-revert-buffer: Variable binding depth
exceeds max-specpdl-size'. Did anybody notice something similar? (emacs
-Q, bzr trunk rev 101406).
        

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

This could be accomplished by either:
- change to `derived.el', saving previous mode (this might be useful),
- change to `derived.el' by being reactive on exception (which is
valuable anyway, but there should be a way of telling to re-throw it).
- changing `image-mode' to something else and wrapping the rest into
`defun' (ad-hoc solution, which I like at least)
- having a flag that body should be executed before or after the body
generated by `define-derived-mode', or having a key, similar to
defadvice, (I wonder if EIEIO could help doing all of this..).

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

I left it alone for time being, as the only drawback that user will
need to revert the mode by herself.

>
>> -(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.
>
>

Done.

BTW: Shall we have a special keyword for `derived-mode' that could possibly put together
default keyboard-map with mode (or allow user to use existing
keyboard-map), that would make developing new major modes more
consistent:

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

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

AFAIK there is `configuration by convention' (post-fix `-map') but IMHO
it would be nicer if the keymaps could be defined in the body of the
macro. (and possibly merged with derive-mode-set-keymap). Maybe even we
can consider, generating a separate function for user init code (the
body of `define-derived-mode').

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.

For convenience I am attaching set of patches each file separately, as
they are independent.

>         Stefan

Thanks,
Wojciech


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: arc-mode.el.diff --]
[-- Type: text/x-diff, Size: 4637 bytes --]

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2010-07-10 18:52:53 +0000
+++ lisp/arc-mode.el	2010-09-13 00:49:20 +0000
@@ -341,7 +341,6 @@
 (defvar archive-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'archive-next-line)
     (define-key map "a" 'archive-alternate-display)
     ;;(define-key map "c" 'archive-copy)
     (define-key map "d" 'archive-flag-deleted)
@@ -349,15 +348,12 @@
     (define-key map "e" 'archive-extract)
     (define-key map "f" 'archive-extract)
     (define-key map "\C-m" 'archive-extract)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "h" 'describe-mode)
     (define-key map "m" 'archive-mark)
     (define-key map "n" 'archive-next-line)
     (define-key map "\C-n" 'archive-next-line)
     (define-key map [down] 'archive-next-line)
     (define-key map "o" 'archive-extract-other-window)
     (define-key map "p" 'archive-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\C-p" 'archive-previous-line)
     (define-key map [up] 'archive-previous-line)
     (define-key map "r" 'archive-rename-entry)
@@ -632,31 +628,16 @@
 		(error "Entry is not a regular member of the archive"))))
       (if (not noerror)
           (error "Line does not describe a member of the archive")))))
-;; -------------------------------------------------------------------------
-;;; Section: the mode definition
-
-;;;###autoload
-(defun archive-mode (&optional force)
-  "Major mode for viewing an archive file in a dired-like way.
-You can move around using the usual cursor motion commands.
-Letters no longer insert themselves.
-Type `e' to pull a file out of the archive and into its own buffer;
-or click mouse-2 on the file's line in the archive mode buffer.
-
-If you edit a sub-file of this archive (as with the `e' command) and
-save it, the contents of that buffer will be saved back into the
-archive.
-
-\\{archive-mode-map}"
-  ;; This is not interactive because you shouldn't be turning this
-  ;; mode on and off.  You can corrupt things that way.
+
+(defun archive-setup-mode (&optional force)
+  "Wrap all the mode setup code into separate function callable from 
+the package code."
   (if (zerop (buffer-size))
       ;; At present we cannot create archives from scratch
       (funcall (or (default-value 'major-mode) 'fundamental-mode))
     (if (and (not force) archive-files) nil
       (let* ((type (archive-find-type))
 	     (typename (capitalize (symbol-name type))))
-	(kill-all-local-variables)
 	(make-local-variable 'archive-subtype)
 	(setq archive-subtype type)
 
@@ -701,8 +682,7 @@
 	(setq major-mode 'archive-mode)
 	(setq mode-name (concat typename "-Archive"))
 	;; Run archive-foo-mode-hook and archive-mode-hook
-	(run-mode-hooks (archive-name "mode-hook") 'archive-mode-hook)
-	(use-local-map archive-mode-map))
+	(run-mode-hooks (archive-name "mode-hook") 'archive-mode-hook))
 
       (make-local-variable 'archive-proper-file-start)
       (make-local-variable 'archive-file-list-start)
@@ -717,6 +697,30 @@
       (archive-summarize nil)
       (setq buffer-read-only t))))
 
+;; -------------------------------------------------------------------------
+;;; Section: the mode definition
+
+;;;###autoload
+(define-derived-mode archive-mode special-mode "Archive mode"
+  "Major mode for viewing an archive file in a dired-like way.
+You can move around using the usual cursor motion commands.
+Letters no longer insert themselves.
+Type `e' to pull a file out of the archive and into its own buffer;
+or click mouse-2 on the file's line in the archive mode buffer.
+
+If you edit a sub-file of this archive (as with the `e' command) and
+save it, the contents of that buffer will be saved back into the
+archive.
+
+\\{archive-mode-map}"
+  ;; 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.
+  ;;
+  (archive-setup-mode))
+  
+
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)
 
@@ -888,7 +892,7 @@
 	  (setq archive-files nil)
 	  (erase-buffer)
 	  (insert-file-contents name)
-	  (archive-mode t)
+	  (archive-setup-mode t)
 	  (goto-char archive-file-list-start)
 	  (archive-next-line lno))
 	(archive-delete-local name)
@@ -1396,7 +1400,7 @@
     (let ((revert-buffer-function nil)
 	  (coding-system-for-read 'no-conversion))
       (revert-buffer t t))
-    (archive-mode)
+    (archive-setup-mode)
     (goto-char archive-file-list-start)
     (archive-next-line no)))
 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: bookmark.el.diff --]
[-- Type: text/x-diff, Size: 3577 bytes --]

=== modified file 'lisp/bookmark.el'
--- lisp/bookmark.el	2010-07-14 19:09:28 +0000
+++ lisp/bookmark.el	2010-09-13 01:08:20 +0000
@@ -853,29 +853,22 @@
     (define-key map "\C-c\C-c" 'bookmark-send-edited-annotation)
     map)
   "Keymap for editing an annotation of a bookmark.")
-
-
-(defun bookmark-edit-annotation-mode (bookmark)
+ 
+(define-derived-mode bookmark-edit-annotation-mode nil "Edit Bookmark Annotation"
   "Mode for editing the annotation of bookmark BOOKMARK.
 When you have finished composing, type \\[bookmark-send-annotation].
 
 BOOKMARK is a bookmark name (a string) or a bookmark record.
 
 \\{bookmark-edit-annotation-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
+  (use-local-map bookmark-edit-annotation-mode-map)
   (make-local-variable 'bookmark-annotation-name)
-  (setq bookmark-annotation-name bookmark)
-  (use-local-map bookmark-edit-annotation-mode-map)
-  (setq major-mode 'bookmark-edit-annotation-mode
-        mode-name "Edit Bookmark Annotation")
   (insert (funcall bookmark-edit-annotation-text-func bookmark))
   (let ((annotation (bookmark-get-annotation bookmark)))
     (if (and annotation (not (string-equal annotation "")))
 	(insert annotation)))
   (run-mode-hooks 'text-mode-hook))
 
-
 (defun bookmark-send-edited-annotation ()
   "Use buffer contents as annotation for a bookmark.
 Lines beginning with `#' are ignored."
@@ -901,8 +894,8 @@
   "Pop up a buffer for editing bookmark BOOKMARK's annotation.
 BOOKMARK is a bookmark name (a string) or a bookmark record."
   (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*"))
-  (bookmark-edit-annotation-mode bookmark))
-
+  (bookmark-edit-annotation-mode)
+  (setq bookmark-annotation-name bookmark))
 
 (defun bookmark-insert-current-bookmark ()
   "Insert into the bookmark name currently being set the value of
@@ -1499,7 +1492,6 @@
 (defvar bookmark-bmenu-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map t)
-    (define-key map "q" 'quit-window)
     (define-key map "v" 'bookmark-bmenu-select)
     (define-key map "w" 'bookmark-bmenu-locate)
     (define-key map "2" 'bookmark-bmenu-2-window)
@@ -1515,11 +1507,9 @@
     (define-key map "\C-d" 'bookmark-bmenu-delete-backwards)
     (define-key map "x" 'bookmark-bmenu-execute-deletions)
     (define-key map "d" 'bookmark-bmenu-delete)
-    (define-key map " " 'next-line)
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
     (define-key map "\177" 'bookmark-bmenu-backup-unmark)
-    (define-key map "?" 'describe-mode)
     (define-key map "u" 'bookmark-bmenu-unmark)
     (define-key map "m" 'bookmark-bmenu-mark)
     (define-key map "l" 'bookmark-bmenu-load)
@@ -1609,7 +1599,7 @@
 
 
 
-(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.
@@ -1642,13 +1632,8 @@
   in another buffer.
 \\[bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer.
 \\[bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark."
-  (kill-all-local-variables)
-  (use-local-map bookmark-bmenu-mode-map)
-  (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))
+  (setq truncate-lines t))
 
 
 (defun bookmark-bmenu-toggle-filenames (&optional show)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: doc-view.el.diff --]
[-- Type: text/x-diff, Size: 2546 bytes --]

=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el	2010-07-14 15:57:54 +0000
+++ lisp/doc-view.el	2010-09-13 00:13:30 +0000
@@ -331,9 +331,7 @@
     (define-key map (kbd "C-c C-c")   'doc-view-toggle-display)
     ;; Open a new buffer with doc's text contents
     (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)
+    ;; Reconvert the current document.
     (define-key map (kbd "r")         'doc-view-revert-buffer)
     map)
   "Keymap used by `doc-view-mode' when displaying a doc as a set of images.")
@@ -1207,7 +1205,7 @@
     l))
 
 ;;;###autoload
-(defun doc-view-mode ()
+(define-derived-mode doc-view-mode special-mode "Doc"
   "Major mode in DocView buffers.
 
 DocView Mode is an Emacs document viewer.  It displays PDF, PS
@@ -1216,7 +1214,6 @@
 You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
 toggle between displaying the document or editing it as text.
 \\{doc-view-mode-map}"
-  (interactive)
 
   (if (= (point-min) (point-max))
       ;; The doc is empty or doesn't exist at all, so fallback to
@@ -1229,7 +1226,6 @@
     (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode)
 				doc-view-previous-major-mode
 			      major-mode)))
-      (kill-all-local-variables)
       (set (make-local-variable 'doc-view-previous-major-mode) prev-major-mode))
 
     ;; Figure out the document type.
@@ -1307,20 +1303,17 @@
     (set (make-local-variable 'mwheel-scroll-down-function)
 	 'doc-view-scroll-down-or-previous-page)
     (set (make-local-variable 'cursor-type) nil)
-    (use-local-map doc-view-mode-map)
     (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc)
     (set (make-local-variable 'bookmark-make-record-function)
 	 'doc-view-bookmark-make-record)
-    (setq mode-name "DocView"
-	  buffer-read-only t
-	  major-mode 'doc-view-mode)
+    (setq buffer-read-only t)
     (doc-view-initiate-display)
     ;; Switch off view-mode explicitly, because doc-view-mode is the
     ;; canonical view mode for PDF/PS/DVI files.  This could be
     ;; switched on automatically depending on the value of
     ;; `view-read-only'.
     (set (make-local-variable 'view-read-only) nil)
-    (run-mode-hooks 'doc-view-mode-hook)))
+    (set (make-local-variable 'revert-buffer-function) 'doc-view-revert-buffer)))
 
 ;;;###autoload
 (define-minor-mode doc-view-minor-mode


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: image-mode.el.diff --]
[-- Type: text/x-diff, Size: 1504 bytes --]

=== modified file 'lisp/image-mode.el'
--- lisp/image-mode.el	2010-08-29 16:17:13 +0000
+++ lisp/image-mode.el	2010-09-13 00:10:56 +0000
@@ -315,9 +315,7 @@
 (defvar image-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    (define-key map "q"         'quit-window)
     (define-key map "\C-c\C-c" 'image-toggle-display)
-    (define-key map (kbd "SPC")       'image-scroll-up)
     (define-key map (kbd "DEL")       'image-scroll-down)
     (define-key map [remap forward-char] 'image-forward-hscroll)
     (define-key map [remap backward-char] 'image-backward-hscroll)
@@ -347,19 +345,16 @@
 (put 'image-mode 'mode-class 'special)
 
 ;;;###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)
-
 	(if (not (image-get-display-property))
 	    (progn
 	      (image-toggle-display-image)
@@ -372,7 +367,6 @@
 		image-type (plist-get (cdr (image-get-display-property)) :type)))
 
 	(setq mode-name (if image-type (format "Image[%s]" image-type) "Image"))
-	(use-local-map image-mode-map)
 
 	;; Use our own bookmarking function for images.
 	(set (make-local-variable 'bookmark-make-record-function)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: replace.el.diff --]
[-- Type: text/x-diff, Size: 1306 bytes --]

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2010-08-29 16:17:13 +0000
+++ lisp/replace.el	2010-09-12 22:12:21 +0000
@@ -767,8 +767,6 @@
     (define-key map "\M-p" 'occur-prev)
     (define-key map "r" 'occur-rename-buffer)
     (define-key map "c" 'clone-buffer)
-    (define-key map "g" 'revert-buffer)
-    (define-key map "q" 'quit-window)
     (define-key map "z" 'kill-this-buffer)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
     (define-key map [menu-bar] (make-sparse-keymap))
@@ -835,18 +833,13 @@
   :group 'matching)
 
 (put 'occur-mode 'mode-class 'special)
-(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)
-  (setq major-mode 'occur-mode)
-  (setq mode-name "Occur")
   (set (make-local-variable 'revert-buffer-function) 'occur-revert-function)
   (make-local-variable 'occur-revert-arguments)
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: tar-mode.el.diff --]
[-- Type: text/x-diff, Size: 1413 bytes --]

=== modified file 'lisp/tar-mode.el'
--- lisp/tar-mode.el	2010-05-03 02:29:46 +0000
+++ lisp/tar-mode.el	2010-08-28 19:52:48 +0000
@@ -524,7 +524,6 @@
 (defvar tar-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map " " 'tar-next-line)
     (define-key map "C" 'tar-copy)
     (define-key map "d" 'tar-flag-deleted)
     (define-key map "\^D" 'tar-flag-deleted)
@@ -532,14 +531,12 @@
     (define-key map "f" 'tar-extract)
     (define-key map "\C-m" 'tar-extract)
     (define-key map [mouse-2] 'tar-mouse-extract)
-    (define-key map "g" 'revert-buffer)
     (define-key map "h" 'describe-mode)
     (define-key map "n" 'tar-next-line)
     (define-key map "\^N" 'tar-next-line)
     (define-key map [down] 'tar-next-line)
     (define-key map "o" 'tar-extract-other-window)
     (define-key map "p" 'tar-previous-line)
-    (define-key map "q" 'quit-window)
     (define-key map "\^P" 'tar-previous-line)
     (define-key map [up] 'tar-previous-line)
     (define-key map "R" 'tar-rename-entry)
@@ -615,7 +612,7 @@
   (if (buffer-live-p tar-data-buffer) (kill-buffer tar-data-buffer)))
 
 ;;;###autoload
-(define-derived-mode tar-mode nil "Tar"
+(define-derived-mode tar-mode special-mode "Tar"
   "Major mode for viewing a tar file as a dired-like listing of its contents.
 You can move around using the usual cursor motion commands.
 Letters no longer insert themselves.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-09-13  1:34                             ` Wojciech Meyer
@ 2010-09-13 10:11                               ` Stefan Monnier
  2010-09-13 10:22                                 ` Wojciech Meyer
  0 siblings, 1 reply; 35+ messages in thread
From: Stefan Monnier @ 2010-09-13 10:11 UTC (permalink / raw)
  To: Wojciech Meyer; +Cc: juri, Eli Zaretskii, emacs-devel, joakim, deniz.a.m.dogan

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



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Refreshing Info nodes
  2010-09-13 10:11                               ` Stefan Monnier
@ 2010-09-13 10:22                                 ` Wojciech Meyer
  0 siblings, 0 replies; 35+ messages in thread
From: Wojciech Meyer @ 2010-09-13 10:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: juri, Eli Zaretskii, emacs-devel, joakim, deniz.a.m.dogan

On Mon, Sep 13, 2010 at 11:11 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> 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.

I know.. and I thought I could look at it later.

>
>> 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".
>

OK.

>> 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, ...)).

Yes, I will do just major-mode swap for time being.

>
>> (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.

Actually that's what i though initially.

>
>> 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)

In the begining, I was not sure if i should leave those lines.

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

That was my consideration too.

>
>>  (put 'occur-mode 'mode-class 'special)
>> -(defun occur-mode ()
>> +(define-derived-mode occur-mode special-mode "Occur"
>
> Here also, the `put' is now redundant.

Yes.

>
>
>        Stefan
>

Thank you,
I will send the final version soon.
Wojciech



^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2010-09-13 10:22 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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