unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Activating a minor-mode
@ 2022-03-14 18:13 angelomolina--- via Users list for the GNU Emacs text editor
       [not found] ` <My8ckXL--3-2@tutanota.com-My8dEhi----2>
  0 siblings, 1 reply; 13+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-14 18:13 UTC (permalink / raw)
  To: Help Gnu Emacs

Have a minor mode with the following code.  I want to enable `F11` to execute `voyager-sweep`.

But having difficulty get the minor mode to function.  Would I need an `add-hook` ? 

Have added the following

(defun typex-toro-voyager ()
  "Launches toro voyager."
  (add-to-list 'load-path "~/Opstk/bin/arktika")
  (require 'toro "toro-voyager"))

(typex-toromona-voyager)

Here is the relevant code that defines the minor-mode.

(defun voyager-keytrigger ()
   "Set keybinding for changing mode"
   (global-unset-key [f11])
   (global-set-key (kbd "<f11>") 'voyager-sweep) )

;;;###autoload
(define-minor-mode toro-minor-mode
  "todo"
  :lighter " toro"  ; indicator in mode-line

  (set-face-attribute 'font-lock-comment-face nil
     :weight (face-attribute 'default :weight))

  (when toro-minor-mode  ; evaluates true when mode enabled
    (set-face-attribute 'default nil :weight 'bold)
    (toro-voyager-keytrigger)  ))



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

* Re: Activating a minor-mode
       [not found] ` <My8ckXL--3-2@tutanota.com-My8dEhi----2>
@ 2022-03-14 19:20   ` angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-14 21:55     ` [External] : " Drew Adams
       [not found]     ` <SJ0PR10MB5488471EF6654E78C062A2D5F30F9@SJ0PR10MB5488.namprd10.prod.outlook.com-My9Qgei--7-2>
  0 siblings, 2 replies; 13+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-14 19:20 UTC (permalink / raw)
  To: angelomolina; +Cc: Help Gnu Emacs

I also want to activate the minor-mode globally.  How could I activate a minor-mode globally?



Mar 14, 2022, 18:13 by help-gnu-emacs@gnu.org:

> Have a minor mode with the following code.  I want to enable `F11` to execute `voyager-sweep`.
>
> But having difficulty get the minor mode to function.  Would I need an `add-hook` ? 
>
> Have added the following
>
> (defun typex-toro-voyager ()
>   "Launches toro voyager."
>   (add-to-list 'load-path "~/Opstk/bin/arktika")
>   (require 'toro "toro-voyager"))
>
> (typex-toromona-voyager)
>
> Here is the relevant code that defines the minor-mode.
>
> (defun voyager-keytrigger ()
>    "Set keybinding for changing mode"
>    (global-unset-key [f11])
>    (global-set-key (kbd "<f11>") 'voyager-sweep) )
>
> ;;;###autoload
> (define-minor-mode toro-minor-mode
>   "todo"
>   :lighter " toro"  ; indicator in mode-line
>
>   (set-face-attribute 'font-lock-comment-face nil
>      :weight (face-attribute 'default :weight))
>
>   (when toro-minor-mode  ; evaluates true when mode enabled
>     (set-face-attribute 'default nil :weight 'bold)
>     (toro-voyager-keytrigger)  ))
>



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

* RE: [External] : Re: Activating a minor-mode
  2022-03-14 19:20   ` angelomolina--- via Users list for the GNU Emacs text editor
@ 2022-03-14 21:55     ` Drew Adams
  2022-03-15  6:28       ` tomas
       [not found]     ` <SJ0PR10MB5488471EF6654E78C062A2D5F30F9@SJ0PR10MB5488.namprd10.prod.outlook.com-My9Qgei--7-2>
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2022-03-14 21:55 UTC (permalink / raw)
  To: angelomolina@tutanota.com
  Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

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

> I also want to activate the minor-mode globally.
> How could I activate a minor-mode globally?

I also want a falafel.  Or a burrito.  And a beer.  Right now!
___

Have you tried to *ask Emacs*?

Start with `C-h f define-minor-mode'.

Check the Emacs manual, with `i minor mode'.

Check the Elisp manual, with `i minor mode':

https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Minor-Modes.html
___

You'll generally get more, and better, help from Emacs itself.

And having _tried_ to *ask Emacs* you'll generally get more, and better, help from mailing lists and online Q&A.

(Just a suggestion - unsolicited, free advice.)

And no, it's not obvious at the outset how to ask Emacs.  But that's really the first, and the most empowering, thing to learn.

Ask Emacs how to ask Emacs...
Ask Elisp how to ask Elisp...

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13525 bytes --]

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

* RE: [External] : Re: Activating a minor-mode
       [not found]     ` <SJ0PR10MB5488471EF6654E78C062A2D5F30F9@SJ0PR10MB5488.namprd10.prod.outlook.com-My9Qgei--7-2>
@ 2022-03-14 22:15       ` angelomolina--- via Users list for the GNU Emacs text editor
  2022-03-14 23:29         ` Drew Adams
  0 siblings, 1 reply; 13+ messages in thread
From: angelomolina--- via Users list for the GNU Emacs text editor @ 2022-03-14 22:15 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'


Mar 14, 2022, 21:55 by drew.adams@oracle.com:

>> I also want to activate the minor-mode globally.
>> How could I activate a minor-mode globally?
>>
>
> I also want a falafel.  Or a burrito.  And a beer.  Right now!
> ___
>
> Have you tried to *ask Emacs*?
>
> Start with `C-h f define-minor-mode'.
>
> Check the Emacs manual, with `i minor mode'.
>
> Check the Elisp manual, with `i minor mode':
>

It only describes how to code and define a minor-mode rather than using.  Because of the utility
of using a minor-mode, I do not see some focused information on how to construct and use a
minor-mode using some examples.  There is only an introduction to lisp but is quite basic.





> https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Minor-Modes.html
> ___
>
> You'll generally get more, and better, help from Emacs itself.
>
> And having _tried_ to *ask Emacs* you'll generally get more, and better, help from mailing lists and online Q&A.
>
> (Just a suggestion - unsolicited, free advice.)
>
> And no, it's not obvious at the outset how to ask Emacs.  But that's really the first, and the most empowering, thing to learn.
>
> Ask Emacs how to ask Emacs...
> Ask Elisp how to ask Elisp...
>



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

* RE: [External] : Re: Activating a minor-mode
  2022-03-14 22:15       ` angelomolina--- via Users list for the GNU Emacs text editor
@ 2022-03-14 23:29         ` Drew Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2022-03-14 23:29 UTC (permalink / raw)
  To: angelomolina@tutanota.com
  Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

>> I also want to activate the minor-mode globally.
>> How could I activate a minor-mode globally?
>
> Start with `C-h f define-minor-mode'.
> Check the Emacs manual, with `i minor mode'.
> Check the Elisp manual, with `i minor mode':
>
> It only describes how to code and define a minor-mode rather than using.  Because of the utility
of using a minor-mode, I do not see some focused information on how to construct and use a
minor-mode using some examples.  There is only an introduction to lisp but is quite basic.

Your knowledge is what is quite basic.
Nothing wrong with that; we're all ignorant.

You just don't know how to ask Emacs well yet.
Learn that better - it's the key to the lock.

* Is the minor mode defined for use globally,
  e.g. defined with :global t?

* If not, is there a globalized version of the
  minor mode (`define-globalized-minor-mode')?

* If not, can you define your own globalized
  version of it, and use that?

* If not, can you turn on the minor mode in mode hooks?

All of these possibilities are covered in the doc.
And the source code defining the mode tells you
more (everything).

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

* Re: [External] : Re: Activating a minor-mode
  2022-03-14 21:55     ` [External] : " Drew Adams
@ 2022-03-15  6:28       ` tomas
  2022-03-15 14:08         ` Eli Zaretskii
  0 siblings, 1 reply; 13+ messages in thread
From: tomas @ 2022-03-15  6:28 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Mon, Mar 14, 2022 at 09:55:42PM +0000, Drew Adams wrote:
> > I also want to activate the minor-mode globally.
> > How could I activate a minor-mode globally?
> 
> I also want a falafel.  Or a burrito.  And a beer.  Right now!

I tried M-x falafel. It didn't work :-(

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: [External] : Re: Activating a minor-mode
  2022-03-15  6:28       ` tomas
@ 2022-03-15 14:08         ` Eli Zaretskii
  2022-03-15 15:35           ` tomas
  2022-03-15 16:05           ` Drew Adams
  0 siblings, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-03-15 14:08 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 15 Mar 2022 07:28:12 +0100
> From: <tomas@tuxteam.de>
> 
> > I also want a falafel.  Or a burrito.  And a beer.  Right now!
> 
> I tried M-x falafel. It didn't work :-(

Your Emacs wasn't compiled with libfalafel, which is an optional
feature.



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

* Re: [External] : Re: Activating a minor-mode
  2022-03-15 14:08         ` Eli Zaretskii
@ 2022-03-15 15:35           ` tomas
  2022-03-15 16:05           ` Drew Adams
  1 sibling, 0 replies; 13+ messages in thread
From: tomas @ 2022-03-15 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Tue, Mar 15, 2022 at 04:08:58PM +0200, Eli Zaretskii wrote:
> > Date: Tue, 15 Mar 2022 07:28:12 +0100
> > From: <tomas@tuxteam.de>
> > 
> > > I also want a falafel.  Or a burrito.  And a beer.  Right now!
> > 
> > I tried M-x falafel. It didn't work :-(
> 
> Your Emacs wasn't compiled with libfalafel, which is an optional
> feature.

Darn, that is part of openkiosk, which doesn't install cleanly on
my computer ;-)

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* RE: [External] : Re: Activating a minor-mode
  2022-03-15 14:08         ` Eli Zaretskii
  2022-03-15 15:35           ` tomas
@ 2022-03-15 16:05           ` Drew Adams
  2022-03-15 16:56             ` Eli Zaretskii
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2022-03-15 16:05 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs@gnu.org

> > > I also want a falafel.  Or a burrito.  And a beer.  Right now!
> >
> > I tried M-x falafel. It didn't work :-(
> 
> Your Emacs wasn't compiled with libfalafel, which is an optional
> feature.

Optional, but _necessary_.




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

* Re: [External] : Re: Activating a minor-mode
  2022-03-15 16:05           ` Drew Adams
@ 2022-03-15 16:56             ` Eli Zaretskii
  2022-03-15 17:11               ` Robert Pluim
  2022-03-15 19:49               ` Drew Adams
  0 siblings, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-03-15 16:56 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Drew Adams <drew.adams@oracle.com>
> Date: Tue, 15 Mar 2022 16:05:17 +0000
> Accept-Language: en-US
> 
> > > > I also want a falafel.  Or a burrito.  And a beer.  Right now!
> > >
> > > I tried M-x falafel. It didn't work :-(
> > 
> > Your Emacs wasn't compiled with libfalafel, which is an optional
> > feature.
> 
> Optional, but _necessary_.

Only if you like falafel.



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

* Re: [External] : Re: Activating a minor-mode
  2022-03-15 16:56             ` Eli Zaretskii
@ 2022-03-15 17:11               ` Robert Pluim
  2022-03-15 19:49               ` Drew Adams
  1 sibling, 0 replies; 13+ messages in thread
From: Robert Pluim @ 2022-03-15 17:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>>>>> On Tue, 15 Mar 2022 18:56:55 +0200, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Drew Adams <drew.adams@oracle.com>
    >> Date: Tue, 15 Mar 2022 16:05:17 +0000
    >> Accept-Language: en-US
    >> 
    >> > > > I also want a falafel.  Or a burrito.  And a beer.  Right now!
    >> > >
    >> > > I tried M-x falafel. It didn't work :-(
    >> > 
    >> > Your Emacs wasn't compiled with libfalafel, which is an optional
    >> > feature.
    >> 
    >> Optional, but _necessary_.

    Eli> Only if you like falafel.

Some people like falafel, some people like sabich. Canʼt we all just
get along?

Robert
-- 



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

* RE: [External] : Re: Activating a minor-mode
  2022-03-15 16:56             ` Eli Zaretskii
  2022-03-15 17:11               ` Robert Pluim
@ 2022-03-15 19:49               ` Drew Adams
  2022-03-15 20:22                 ` tomas
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2022-03-15 19:49 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs@gnu.org

> > > > > I also want a falafel.  Or a burrito.  And a beer.  Right now!
> > > >
> > > > I tried M-x falafel. It didn't work :-(
> > >
> > > Your Emacs wasn't compiled with libfalafel,
> > > which is an optional feature.
> >
> > Optional, but _necessary_.
> 
> Only if you like falafel.

Perhaps the condition is really:

  unless you don't like falafel
      OR falafel doesn't like you

Some people might love falafel, but after
eating it they feelawful.  Allergies or
otherwise.

(I falafel just voicing that possibility.)



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

* Re: [External] : Re: Activating a minor-mode
  2022-03-15 19:49               ` Drew Adams
@ 2022-03-15 20:22                 ` tomas
  0 siblings, 0 replies; 13+ messages in thread
From: tomas @ 2022-03-15 20:22 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Tue, Mar 15, 2022 at 07:49:01PM +0000, Drew Adams wrote:

[...]

> Some people might love falafel, but after
> eating it they feelawful [...]
                 ^^^^^^^^^

*snort*

Now I'm lucky I wasn't having a coffee (or, Zeus forbid, a Tzatziki).
That would be all over my keyboard.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2022-03-15 20:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-14 18:13 Activating a minor-mode angelomolina--- via Users list for the GNU Emacs text editor
     [not found] ` <My8ckXL--3-2@tutanota.com-My8dEhi----2>
2022-03-14 19:20   ` angelomolina--- via Users list for the GNU Emacs text editor
2022-03-14 21:55     ` [External] : " Drew Adams
2022-03-15  6:28       ` tomas
2022-03-15 14:08         ` Eli Zaretskii
2022-03-15 15:35           ` tomas
2022-03-15 16:05           ` Drew Adams
2022-03-15 16:56             ` Eli Zaretskii
2022-03-15 17:11               ` Robert Pluim
2022-03-15 19:49               ` Drew Adams
2022-03-15 20:22                 ` tomas
     [not found]     ` <SJ0PR10MB5488471EF6654E78C062A2D5F30F9@SJ0PR10MB5488.namprd10.prod.outlook.com-My9Qgei--7-2>
2022-03-14 22:15       ` angelomolina--- via Users list for the GNU Emacs text editor
2022-03-14 23:29         ` Drew Adams

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