unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Running a major-mode without invoking its hooks
@ 2014-07-22 14:20 Bozhidar Batsov
  2014-07-22 14:51 ` Lennart Borgman
  2014-07-23  4:25 ` Dmitry
  0 siblings, 2 replies; 4+ messages in thread
From: Bozhidar Batsov @ 2014-07-22 14:20 UTC (permalink / raw)
  To: emacs-devel

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

Hi guys,

I was wondering what’s the preferred approach to run a major mode without triggering any if its hooks. I looked at the Elisp manual, but didn’t find anything on the subject. Google searches yield nothing useful as well. (here’s an example that lead to my question - imagine you’re enabling some major mode in a temp buffer just to get proper font-locking for a string you inserted in the temp buffer, but you wouldn’t want to enable whitespace-mode as well, which might add font-locking of it’s own. Obviously you can disable whitespace-mode directly, but there has to be some more generic solution)

-- 
Cheers,
Bozhidar

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

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

* Re: Running a major-mode without invoking its hooks
  2014-07-22 14:20 Running a major-mode without invoking its hooks Bozhidar Batsov
@ 2014-07-22 14:51 ` Lennart Borgman
  2014-07-23  4:25 ` Dmitry
  1 sibling, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2014-07-22 14:51 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: emacs-devel

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

On Tue, Jul 22, 2014 at 4:20 PM, Bozhidar Batsov <bozhidar@batsov.com>
wrote:

> Hi guys,
>
> I was wondering what’s the preferred approach to run a major mode without
> triggering any if its hooks. I looked at the Elisp manual, but didn’t find
> anything on the subject. Google searches yield nothing useful as well.
> (here’s an example that lead to my question - imagine you’re enabling some
> major mode in a temp buffer just to get proper font-locking for a string
> you inserted in the temp buffer, but you wouldn’t want to enable
> whitespace-mode as well, which might add font-locking of it’s own.
> Obviously you can disable whitespace-mode directly, but there has to be
> some more generic solution)
>
> Please look at the code in nXhtml for multiple major modes.

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

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

* Re: Running a major-mode without invoking its hooks
  2014-07-22 14:20 Running a major-mode without invoking its hooks Bozhidar Batsov
  2014-07-22 14:51 ` Lennart Borgman
@ 2014-07-23  4:25 ` Dmitry
  2014-07-23  9:54   ` Bozhidar Batsov
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry @ 2014-07-23  4:25 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: emacs-devel

Hi Bozhidar,

Bozhidar Batsov <bozhidar@batsov.com> writes:
> I was wondering what’s the preferred approach to run a major mode
> without triggering any if its hooks.

Try binding `delay-mode-hooks' to t around the call.

And maybe `delayed-mode-hooks' to nil, also, so that they aren't
triggered later.



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

* Re: Running a major-mode without invoking its hooks
  2014-07-23  4:25 ` Dmitry
@ 2014-07-23  9:54   ` Bozhidar Batsov
  0 siblings, 0 replies; 4+ messages in thread
From: Bozhidar Batsov @ 2014-07-23  9:54 UTC (permalink / raw)
  To: Dmitry; +Cc: emacs-devel

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

On July 23, 2014 at 7:25:39 AM, Dmitry (dgutov@yandex.ru) wrote:
Hi Bozhidar, 

Bozhidar Batsov <bozhidar@batsov.com> writes: 
> I was wondering what’s the preferred approach to run a major mode 
> without triggering any if its hooks. 

Try binding `delay-mode-hooks' to t around the call. 

And maybe `delayed-mode-hooks' to nil, also, so that they aren't 
triggered later. 
Exactly what I needed - works like a charm. Thanks, Dmitry!



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

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

end of thread, other threads:[~2014-07-23  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-22 14:20 Running a major-mode without invoking its hooks Bozhidar Batsov
2014-07-22 14:51 ` Lennart Borgman
2014-07-23  4:25 ` Dmitry
2014-07-23  9:54   ` Bozhidar Batsov

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