all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* nxml-mode uses wrong method to run 'nxml-mode-hook
@ 2008-06-15  5:53 sand
  2008-06-16  9:32 ` Jason Rumney
  0 siblings, 1 reply; 4+ messages in thread
From: sand @ 2008-06-15  5:53 UTC (permalink / raw)
  To: emacs-devel

The bottom of the function 'nxml-mode' ("nxml/nxml-mode.el", line 554;
your mileage may vary) has

  (run-hooks 'nxml-mode-hook)

It should use 'run-mode-hooks', because this is a major mode
definition.  Can someone fix that?

It looks like there are some other major modes with the same problem.
For example: terminal-mode, view-mode, remember-mode, erc, rmail,
rcirc.  Most of the matches below are minor modes, though.

  find . -type f -name '*.el.gz' -print0 | xargs -0 -e zegrep -nH -e 'run-hooks .*-mode-hook'
  ./terminal.el.gz:1162:  (run-hooks 'terminal-mode-hook)
  ./calc/calc-embed.el.gz:325:          (run-hooks 'calc-embedded-mode-hook))
  ./ehelp.el.gz:108:  ;(run-hooks 'electric-help-mode-hook)
  ./ehelp.el.gz:162:           (run-hooks 'electric-help-mode-hook)
  ./isearch.el.gz:780:  (run-hooks 'isearch-mode-hook)
  ./vc-dispatcher.el.gz:1370:  (run-hooks 'vc-dir-mode-hook))
  ./iimage.el.gz:140:  (run-hooks 'iimage-mode-hook)
  ./view.el.gz:504:  (run-hooks 'view-mode-hook))
  ./emulation/crisp.el.gz:371:    (run-hooks 'crisp-mode-hook)))
  ./gnus/gnus-salt.el.gz:130:      (gnus-run-hooks 'gnus-pick-mode-hook))))
  ./gnus/gnus-salt.el.gz:362:      (gnus-run-hooks 'gnus-binary-mode-hook))))
  ./gnus/gnus-topic.el.gz:1178:      (gnus-run-hooks 'gnus-topic-mode-hook))
  ./gnus/gnus-agent.el.gz:537:    (gnus-run-hooks 'gnus-agent-mode-hook
  ./gnus/mml.el.gz:1134:    (run-hooks 'mml-mode-hook)))
  ./gnus/gnus-dired.el.gz:105:	(run-hooks 'gnus-dired-mode-hook)))))
  ./gnus/gnus-ml.el.gz:105:      (gnus-run-hooks 'gnus-mailing-list-mode-hook))))
  ./gnus/gnus-start.el.gz:2966:  (gnus-run-hooks 'gnus-slave-mode-hook))
  ./gnus/gnus-undo.el.gz:116:    (gnus-run-hooks 'gnus-undo-mode-hook)))
  ./gnus/gnus-draft.el.gz:77:      (gnus-run-hooks 'gnus-draft-mode-hook))))
  ./epa.el.gz:330:  (run-hooks 'epa-key-list-mode-hook))
  ./epa.el.gz:347:  (run-hooks 'epa-key-mode-hook))
  ./epa.el.gz:358:  (run-hooks 'epa-info-mode-hook))
  ./org/org-table.el.gz:3208:	  (run-hooks 'orgtbl-mode-hook))
  ./textmodes/reftex-index.el.gz:323:  (run-hooks 'reftex-index-mode-hook))
  ./textmodes/reftex-index.el.gz:1324:  (run-hooks 'reftex-index-phrases-mode-hook))
  ./textmodes/picture.el.gz:749:    (run-hooks 'edit-picture-hook 'picture-mode-hook)
  ./textmodes/flyspell.el.gz:395:  (run-hooks 'flyspell-prog-mode-hook))
  ./textmodes/reftex-sel.el.gz:63:  (run-hooks 'reftex-select-label-mode-hook))
  ./textmodes/reftex-sel.el.gz:91:  (run-hooks 'reftex-select-bib-mode-hook))
  ./textmodes/text-mode.el.gz:97:  (run-hooks 'paragraph-indent-text-mode-hook))
  ./textmodes/reftex-toc.el.gz:81:  (run-hooks 'reftex-toc-mode-hook))
  ./textmodes/two-column.el.gz:321:  (run-hooks '2C-mode-hook))
  ./textmodes/remember.el.gz:545:  (run-hooks 'remember-mode-hook))
  ./textmodes/reftex.el.gz:570:        (run-hooks 'reftex-mode-hook))
  ./speedbar.el.gz:1141:    (run-hooks 'speedbar-mode-hook))
  ./progmodes/vera-mode.el.gz:333:  (run-hooks 'vera-mode-hook))
  ./progmodes/gdb-ui.el.gz:323:  (run-hooks 'gdb-mode-hook))
  ./progmodes/gdb-ui.el.gz:672:  (run-hooks 'gdb-mode-hook))
  ./progmodes/gud.el.gz:769:  (run-hooks 'gud-gdb-mode-hook))
  ./progmodes/gud.el.gz:1026:  (run-hooks 'sdb-mode-hook)
  ./progmodes/gud.el.gz:1338:  (run-hooks 'dbx-mode-hook)
  ./progmodes/gud.el.gz:1415:  (run-hooks 'xdb-mode-hook))
  ./progmodes/gud.el.gz:1545:  (run-hooks 'perldb-mode-hook))
  ./progmodes/gud.el.gz:1650:  (run-hooks 'pdb-mode-hook))
  ./progmodes/gud.el.gz:2305:  (run-hooks 'jdb-mode-hook)
  ./progmodes/idlw-help.el.gz:328:  (run-hooks 'idlwave-help-mode-hook))
  ./progmodes/vhdl-mode.el.gz:4769:    (run-hooks 'vhdl-mode-hook)))
  ./progmodes/verilog-mode.el.gz:2532:  (run-hooks 'verilog-mode-hook))
  ./recentf.el.gz:1349:    (run-hooks 'recentf-mode-hook)
  ./ediff-mult.el.gz:436:  (run-hooks 'ediff-meta-mode-hook))
  ./ediff-util.el.gz:98:  ;; We use run-hooks instead of run-mode-hooks for two reasons.
  ./ediff-util.el.gz:102:  ;; Second, changing run-hooks to run-mode-hooks would require an
  ./ediff-util.el.gz:104:  (run-hooks 'ediff-mode-hook))
  ./eshell/esh-mode.el.gz:434:      (run-hooks 'eshell-first-time-mode-hook))
  ./winner.el.gz:389:      (run-hooks 'winner-mode-hook)
  ./nxml/nxml-mode.el.gz:554:  (run-hooks 'nxml-mode-hook))
  ./simple.el.gz:392:    (run-hooks 'after-change-major-mode-hook)))
  ./erc/erc.el.gz:1462:  (run-hooks 'erc-mode-hook))
  ./erc/erc-dcc.el.gz:1043:  (run-hooks 'erc-dcc-chat-mode-hook))
  ./allout.el.gz:2078:      (run-hooks 'allout-mode-hook))
  ./savehist.el.gz:223:    (run-hooks 'savehist-mode-hook))
  ./play/bubbles.el.gz:934:  (run-hooks 'bubbles-mode-hook))
  ./tar-mode.el.gz:660:	 (run-hooks 'tar-subfile-mode-hook))
  ./calculator.el.gz:711:        (run-hooks 'calculator-mode-hook)
  ./mail/rmailedit.el.gz:149:  (run-hooks 'rmail-mode-hook)
  ./mail/rmail.el.gz:860:	    (run-hooks 'rmail-mode-hook))))))
  ./mail/rmail.el.gz:1369:	  (run-hooks 'rmail-mode-hook)))))
  ./mail/footnote.el.gz:758:    (run-hooks 'footnote-mode-hook)))
  ./locate.el.gz:332:    (run-hooks 'dired-mode-hook)
  ./subr.el.gz:1324:    (run-hooks 'after-change-major-mode-hook)))
  ./net/dig.el.gz:155:      (run-hooks 'dig-mode-hook))))
  ./net/rcirc.el.gz:915:  (run-hooks 'rcirc-mode-hook))


Thanks,

Derek

-- 
Derek Upham
sand@blarg.net




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

* Re: nxml-mode uses wrong method to run 'nxml-mode-hook
  2008-06-15  5:53 nxml-mode uses wrong method to run 'nxml-mode-hook sand
@ 2008-06-16  9:32 ` Jason Rumney
  2008-06-16 11:10   ` Lennart Borgman
  2008-06-16 16:34   ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Rumney @ 2008-06-16  9:32 UTC (permalink / raw)
  To: sand; +Cc: emacs-devel

sand@blarg.net wrote:
> The bottom of the function 'nxml-mode' ("nxml/nxml-mode.el", line 554;
> your mileage may vary) has
>
>   (run-hooks 'nxml-mode-hook)
>
> It should use 'run-mode-hooks', because this is a major mode
> definition.  Can someone fix that?
>
> It looks like there are some other major modes with the same problem.
> For example: terminal-mode, view-mode, remember-mode, erc, rmail,
> rcirc.  Most of the matches below are minor modes, though.
>   

The other major modes don't seem to be editing modes, and most of them 
have been in Emacs for a long time, so I am not sure if they should be 
changed, or if they have been left deliberately. But I have changed 
nxml-mode.





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

* Re: nxml-mode uses wrong method to run 'nxml-mode-hook
  2008-06-16  9:32 ` Jason Rumney
@ 2008-06-16 11:10   ` Lennart Borgman
  2008-06-16 16:34   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2008-06-16 11:10 UTC (permalink / raw)
  To: Jason Rumney; +Cc: sand, emacs-devel

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

Maybe it would be good to mention run-mode-hooks or perhaps better link to
(info "(elisp) Mode Hooks") from (info "(elisp) Running Hooks")?

On 6/16/08, Jason Rumney <jasonr@gnu.org> wrote:
>
> sand@blarg.net wrote:
>
>> The bottom of the function 'nxml-mode' ("nxml/nxml-mode.el", line 554;
>> your mileage may vary) has
>>
>>  (run-hooks 'nxml-mode-hook)
>>
>> It should use 'run-mode-hooks', because this is a major mode
>> definition.  Can someone fix that?
>>
>> It looks like there are some other major modes with the same problem.
>> For example: terminal-mode, view-mode, remember-mode, erc, rmail,
>> rcirc.  Most of the matches below are minor modes, though.
>>
>>
>
> The other major modes don't seem to be editing modes, and most of them have
> been in Emacs for a long time, so I am not sure if they should be changed,
> or if they have been left deliberately. But I have changed nxml-mode.
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1507 bytes --]

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

* Re: nxml-mode uses wrong method to run 'nxml-mode-hook
  2008-06-16  9:32 ` Jason Rumney
  2008-06-16 11:10   ` Lennart Borgman
@ 2008-06-16 16:34   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-06-16 16:34 UTC (permalink / raw)
  To: Jason Rumney; +Cc: sand, emacs-devel

>> The bottom of the function 'nxml-mode' ("nxml/nxml-mode.el", line 554;
>> your mileage may vary) has
>> 
>> (run-hooks 'nxml-mode-hook)
>> 
>> It should use 'run-mode-hooks', because this is a major mode
>> definition.  Can someone fix that?
>> 
>> It looks like there are some other major modes with the same problem.
>> For example: terminal-mode, view-mode, remember-mode, erc, rmail,
>> rcirc.  Most of the matches below are minor modes, though.
> The other major modes don't seem to be editing modes, and most of them have
> been in Emacs for a long time, so I am not sure if they should be changed,
> or if they have been left deliberately.

They should all use run-mode-hooks, AFAIK.  So unless there's a comment
justifying the use of `run-hooks', it should be changed.

> But I have changed nxml-mode.

Thank you,


        Stefan




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

end of thread, other threads:[~2008-06-16 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-15  5:53 nxml-mode uses wrong method to run 'nxml-mode-hook sand
2008-06-16  9:32 ` Jason Rumney
2008-06-16 11:10   ` Lennart Borgman
2008-06-16 16:34   ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.