unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17009: Please add a hook to visual-line-mode
@ 2014-03-14  0:56 Reuben Thomas
  2014-03-14  7:50 ` Glenn Morris
  0 siblings, 1 reply; 11+ messages in thread
From: Reuben Thomas @ 2014-03-14  0:56 UTC (permalink / raw)
  To: 17009

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

It would be nice to be able to activate window-margin-mode when
visual-line-mode is turned on:

https://github.com/aculich/window-margin.el

-- 
http://rrt.sc3d.org

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

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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14  0:56 bug#17009: Please add a hook to visual-line-mode Reuben Thomas
@ 2014-03-14  7:50 ` Glenn Morris
  2014-03-14 12:17   ` Reuben Thomas
  0 siblings, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2014-03-14  7:50 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 17009


Modes defined with define-minor-mode have hooks.

C-h v visual-line-mode-hook

    visual-line-mode-hook is a variable defined in `simple.el'.
    Its value is (visual-line-mode-set-explicitly)

    This variable may be risky if used as a file-local variable.

    Documentation:
    Hook run after entering or leaving `visual-line-mode'.
    No problems result if this variable is not bound.
    `add-hook' automatically binds it.  (This is true for all hook
    variables.)





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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14  7:50 ` Glenn Morris
@ 2014-03-14 12:17   ` Reuben Thomas
  2014-03-14 13:39     ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Reuben Thomas @ 2014-03-14 12:17 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17009

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

On 14 March 2014 07:50, Glenn Morris <rgm@gnu.org> wrote:

>
> Modes defined with define-minor-mode have hooks.
>
> C-h v visual-line-mode-hook
>
>     visual-line-mode-hook is a variable defined in `simple.el'.
>     Its value is (visual-line-mode-set-explicitly)
>
>     This variable may be risky if used as a file-local variable.
>
>     Documentation:
>     Hook run after entering or leaving `visual-line-mode'.
>     No problems result if this variable is not bound.
>     `add-hook' automatically binds it.  (This is true for all hook
>     variables.)
>

Great! Is this new in 24.4, because this doesn't work for me?

-- 
http://rrt.sc3d.org

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

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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 12:17   ` Reuben Thomas
@ 2014-03-14 13:39     ` Stefan Monnier
  2014-03-14 13:48       ` Reuben Thomas
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2014-03-14 13:39 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 17009

> Great! Is this new in 24.4, because this doesn't work for me?

No, it's been there from the very beginning.  What do you mean by
"doesn't work"?


        Stfean





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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 13:39     ` Stefan Monnier
@ 2014-03-14 13:48       ` Reuben Thomas
  2014-03-14 14:28         ` Dmitry Gutov
  2014-03-14 16:49         ` Stefan
  0 siblings, 2 replies; 11+ messages in thread
From: Reuben Thomas @ 2014-03-14 13:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 17009

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

On 14 March 2014 13:39, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > Great! Is this new in 24.4, because this doesn't work for me?
>
> No, it's been there from the very beginning.  What do you mean by
> "doesn't work"?
>

C-h v visual-line-mode-hook [No match]

So this is a hook that magically comes into existence if I assign to it:
having done so, C-h v now works.

This is all rather confusing; thanks for straightening me out.

-- 
http://rrt.sc3d.org

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

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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 13:48       ` Reuben Thomas
@ 2014-03-14 14:28         ` Dmitry Gutov
  2014-03-14 16:49         ` Stefan
  1 sibling, 0 replies; 11+ messages in thread
From: Dmitry Gutov @ 2014-03-14 14:28 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 17009

Reuben Thomas <rrt@sc3d.org> writes:

> So this is a hook that magically comes into existence if I assign to it:
> having done so, C-h v now works.

That's true of all hooks: a hook variable doesn't have to be defined for
`add-hook' or `run-hooks' to work. Of course, the latter won't do
anything in that case.





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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 13:48       ` Reuben Thomas
  2014-03-14 14:28         ` Dmitry Gutov
@ 2014-03-14 16:49         ` Stefan
  2014-03-14 17:00           ` Reuben Thomas
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan @ 2014-03-14 16:49 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 17009

> C-h v visual-line-mode-hook [No match]

Who cares?  Use it anyway: it will work.

Quoting the message Glenn send you earlier:

>     No problems result if this variable is not bound.
>     `add-hook' automatically binds it.  (This is true for all hook
>     variables.)


-- Stefan





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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 16:49         ` Stefan
@ 2014-03-14 17:00           ` Reuben Thomas
  2014-03-14 17:12             ` Glenn Morris
  0 siblings, 1 reply; 11+ messages in thread
From: Reuben Thomas @ 2014-03-14 17:00 UTC (permalink / raw)
  To: Stefan; +Cc: 17009

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

On 14 March 2014 16:49, Stefan <monnier@iro.umontreal.ca> wrote:

> > C-h v visual-line-mode-hook [No match]
>
> Who cares?  Use it anyway: it will work.
>

Even from a careful reading of the documentation, it's not obvious that the
variable not being bound means that its documentation will not be
available: it's reasonable to think that C-h v not working means that
something is wrong. Sure, it works, but discoverability is not great.

-- 
http://rrt.sc3d.org

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

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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 17:00           ` Reuben Thomas
@ 2014-03-14 17:12             ` Glenn Morris
  2014-03-26 13:49               ` Kevin Rodgers
  0 siblings, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2014-03-14 17:12 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 17009

Reuben Thomas wrote:

> Even from a careful reading of the documentation, it's not obvious that the
> variable not being bound means that its documentation will not be
> available: it's reasonable to think that C-h v not working means that
> something is wrong. Sure, it works, but discoverability is not great.

That's the part that will be different in 24.4.


2013-05-27  Stefan Monnier  <monnier@iro.umontreal.ca>

            * emacs-lisp/easy-mmode.el (define-minor-mode):
            * emacs-lisp/derived.el (define-derived-mode): Always defvar
            the mode hook and provide a docstring.





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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-14 17:12             ` Glenn Morris
@ 2014-03-26 13:49               ` Kevin Rodgers
  2014-03-26 14:21                 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Kevin Rodgers @ 2014-03-26 13:49 UTC (permalink / raw)
  To: 17009

On 3/14/14 11:12 AM, Glenn Morris wrote:
> Reuben Thomas wrote:
>
>> Even from a careful reading of the documentation, it's not obvious that the
>> variable not being bound means that its documentation will not be
>> available: it's reasonable to think that C-h v not working means that
>> something is wrong. Sure, it works, but discoverability is not great.
>
> That's the part that will be different in 24.4.
>
>
> 2013-05-27  Stefan Monnier<monnier@iro.umontreal.ca>
>
>              * emacs-lisp/easy-mmode.el (define-minor-mode):
>              * emacs-lisp/derived.el (define-derived-mode): Always defvar
>              the mode hook and provide a docstring.

:-)

http://lists.gnu.org/archive/html/help-gnu-emacs/2008-03/msg00136.html

-- 
Kevin Rodgers
Denver, Colorado, USA






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

* bug#17009: Please add a hook to visual-line-mode
  2014-03-26 13:49               ` Kevin Rodgers
@ 2014-03-26 14:21                 ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2014-03-26 14:21 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: 17009

> http://lists.gnu.org/archive/html/help-gnu-emacs/2008-03/msg00136.html

Oh, yes, I know, this is a very long standing issue, both with
define-derived-mode and define-minor-mode.


        Stefan





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

end of thread, other threads:[~2014-03-26 14:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-14  0:56 bug#17009: Please add a hook to visual-line-mode Reuben Thomas
2014-03-14  7:50 ` Glenn Morris
2014-03-14 12:17   ` Reuben Thomas
2014-03-14 13:39     ` Stefan Monnier
2014-03-14 13:48       ` Reuben Thomas
2014-03-14 14:28         ` Dmitry Gutov
2014-03-14 16:49         ` Stefan
2014-03-14 17:00           ` Reuben Thomas
2014-03-14 17:12             ` Glenn Morris
2014-03-26 13:49               ` Kevin Rodgers
2014-03-26 14:21                 ` Stefan Monnier

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