unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to autoload easy-menu?
@ 2023-10-09  0:07 Joseph Turner
  2023-10-12 21:17 ` Joseph Turner
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Turner @ 2023-10-09  0:07 UTC (permalink / raw)
  To: Emacs Devel Mailing List

Hello!

I would like to add an autoloaded menu bar to hyperdrive.el
(<https://git.sr.ht/~ushin/hyperdrive.el>).  I see that jabber.el
accomplishes this by autoloading define-key-after.

Would you someone kindly point me toward an example of an autoloaded
menu-bar using easymenu.el?

Thank you!!

Joseph



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

* Re: How to autoload easy-menu?
  2023-10-09  0:07 How to autoload easy-menu? Joseph Turner
@ 2023-10-12 21:17 ` Joseph Turner
  2023-10-13  7:13   ` Eshel Yaron
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Turner @ 2023-10-12 21:17 UTC (permalink / raw)
  To: Emacs Devel Mailing List; +Cc: Adam Porter


Joseph Turner <joseph@breatheoutbreathe.in> writes:
> Would you someone kindly point me toward an example of an autoloaded
> menu-bar using easymenu.el?

Here's how we do it in hyperdrive.el now:

https://git.sr.ht/~ushin/hyperdrive.el/tree/55c04f5d6071ca9737675af8374257a520313e51/item/hyperdrive.el#L1111

The downside is that hyperdrive.el and its dependencies will now always
be loaded when Emacs starts and `menu-bar-mode` is enabled.

Please share your suggestions! Thank you!!

Joseph



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

* Re: How to autoload easy-menu?
  2023-10-12 21:17 ` Joseph Turner
@ 2023-10-13  7:13   ` Eshel Yaron
  2023-10-14  4:35     ` Joseph Turner
  0 siblings, 1 reply; 6+ messages in thread
From: Eshel Yaron @ 2023-10-13  7:13 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Emacs Devel Mailing List, Adam Porter

Hello Joseph,

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>> Would you someone kindly point me toward an example of an autoloaded
>> menu-bar using easymenu.el?
>
> Here's how we do it in hyperdrive.el now:
>
> https://git.sr.ht/~ushin/hyperdrive.el/tree/55c04f5d6071ca9737675af8374257a520313e51/item/hyperdrive.el#L1111
>
> The downside is that hyperdrive.el and its dependencies will now always
> be loaded when Emacs starts and `menu-bar-mode` is enabled.
>
> Please share your suggestions! Thank you!!

I've just installed `hyperdrive` and restarted Emacs.  Without changing
anything in my init file, I now see the "Hyperdrive" menu under "Tools"
in the menu bar.  Personally, I find that a little too intrusive, since
I don't expect merely installing a package to change Emacs without an
explicit toggle.  So my suggestion would be to add a global minor mode,
maybe called `hyperdrive-menu-mode`, that adds the "Hyperdrive" menu
under "Tools".  Then you can autoload `hyperdrive-menu-mode`, so users
just need to do call this mode in their init file if they so desire.


Best,

Eshel



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

* Re: How to autoload easy-menu?
  2023-10-13  7:13   ` Eshel Yaron
@ 2023-10-14  4:35     ` Joseph Turner
  2023-10-14 10:33       ` Eshel Yaron
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Turner @ 2023-10-14  4:35 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: Emacs Devel Mailing List, Adam Porter


Eshel Yaron <me@eshelyaron.com> writes:
>
> I've just installed `hyperdrive` and restarted Emacs.  Without changing
> anything in my init file, I now see the "Hyperdrive" menu under "Tools"
> in the menu bar.  Personally, I find that a little too intrusive, since
> I don't expect merely installing a package to change Emacs without an
> explicit toggle.  So my suggestion would be to add a global minor mode,
> maybe called `hyperdrive-menu-mode`, that adds the "Hyperdrive" menu
> under "Tools".  Then you can autoload `hyperdrive-menu-mode`, so users
> just need to do call this mode in their init file if they so desire.

Thank you for testing out hyperdrive.el!!!  Now, the "Tools > Hyperdrive"
menu is added only after the user calls `hyperdrive-menu-bar-mode':

https://git.sr.ht/~ushin/hyperdrive.el/commit/0869edbd

We may consider adding a defcustom to make `hyperdrive-menu-bar-mode'
add "Hyperdrive" menu to the global map instead of a submenu. WDYT?

Thank you!!

Joseph



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

* Re: How to autoload easy-menu?
  2023-10-14  4:35     ` Joseph Turner
@ 2023-10-14 10:33       ` Eshel Yaron
  2023-10-15  1:35         ` Joseph Turner
  0 siblings, 1 reply; 6+ messages in thread
From: Eshel Yaron @ 2023-10-14 10:33 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Emacs Devel Mailing List, Adam Porter

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Thank you for testing out hyperdrive.el!!!  Now, the "Tools > Hyperdrive"
> menu is added only after the user calls `hyperdrive-menu-bar-mode':
>
> https://git.sr.ht/~ushin/hyperdrive.el/commit/0869edbd
>

Nice :)

FYI when trying this on macOS I had some issues with the `hyper-gateway`
program, it basically fails and quits after most hyperdrive.el commands.
For example, when I call `hyperdrive-hyper-gateway-version` it prints:

--8<---------------cut here---------------start------------->8---
Request: {
  method: 'GET',
  url: '/',
  headers: {
    host: 'localhost:4973',
    'user-agent': 'curl/8.1.2',
    accept: '*/*',
    'accept-encoding': 'deflate, gzip'
  }
}
Requested: {
  method: 'GET',
  url: 'hyper://',
  status: 500,
  responseHeaders: { 'content-type': 'text/plain; charset=utf-8' }
}
Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
    at new NodeError (node:internal/errors:406:5)
    at ServerResponse.writeHead (node:_http_server:345:11)
    at Server.<anonymous> (file:///usr/local/lib/node_modules/hyper-gateway/src/index.js:131:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
    at new NodeError (node:internal/errors:406:5)
    at ServerResponse.writeHead (node:_http_server:345:11)
    at Server.<anonymous> (file:///usr/local/lib/node_modules/hyper-gateway/src/index.js:139:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
--8<---------------cut here---------------end--------------->8---


> We may consider adding a defcustom to make `hyperdrive-menu-bar-mode'
> add "Hyperdrive" menu to the global map instead of a submenu. WDYT?

I don't really have a strong opinion about this one.


Cheers,

Eshel



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

* Re: How to autoload easy-menu?
  2023-10-14 10:33       ` Eshel Yaron
@ 2023-10-15  1:35         ` Joseph Turner
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph Turner @ 2023-10-15  1:35 UTC (permalink / raw)
  To: Eshel Yaron; +Cc: Emacs Devel Mailing List, Adam Porter


Eshel Yaron <me@eshelyaron.com> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Thank you for testing out hyperdrive.el!!!  Now, the "Tools > Hyperdrive"
>> menu is added only after the user calls `hyperdrive-menu-bar-mode':
>>
>> https://git.sr.ht/~ushin/hyperdrive.el/commit/0869edbd
>>
>
> Nice :)
>
> FYI when trying this on macOS I had some issues with the `hyper-gateway`
> program, it basically fails and quits after most hyperdrive.el commands.
> For example, when I call `hyperdrive-hyper-gateway-version` it prints:
>
> --8<---------------cut here---------------start------------->8---
> Request: {
>   method: 'GET',
>   url: '/',
>   headers: {
>     host: 'localhost:4973',
>     'user-agent': 'curl/8.1.2',
>     accept: '*/*',
>     'accept-encoding': 'deflate, gzip'
>   }
> }
> Requested: {
>   method: 'GET',
>   url: 'hyper://',
>   status: 500,
>   responseHeaders: { 'content-type': 'text/plain; charset=utf-8' }
> }
> Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
>     at new NodeError (node:internal/errors:406:5)
>     at ServerResponse.writeHead (node:_http_server:345:11)
>     at Server.<anonymous> (file:///usr/local/lib/node_modules/hyper-gateway/src/index.js:131:11)
>     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
>   code: 'ERR_HTTP_HEADERS_SENT'
> }
> node:internal/errors:497
>     ErrorCaptureStackTrace(err);
>     ^
>
> Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client
>     at new NodeError (node:internal/errors:406:5)
>     at ServerResponse.writeHead (node:_http_server:345:11)
>     at Server.<anonymous> (file:///usr/local/lib/node_modules/hyper-gateway/src/index.js:139:11)
>     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
>   code: 'ERR_HTTP_HEADERS_SENT'
> }
> --8<---------------cut here---------------end--------------->8---

Thank you for the report!!  We can track it here:

https://github.com/RangerMauve/hyper-gateway/issues/20

>> We may consider adding a defcustom to make `hyperdrive-menu-bar-mode'
>> add "Hyperdrive" menu to the global map instead of a submenu. WDYT?
>
> I don't really have a strong opinion about this one.

Okay :)

Joseph



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

end of thread, other threads:[~2023-10-15  1:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09  0:07 How to autoload easy-menu? Joseph Turner
2023-10-12 21:17 ` Joseph Turner
2023-10-13  7:13   ` Eshel Yaron
2023-10-14  4:35     ` Joseph Turner
2023-10-14 10:33       ` Eshel Yaron
2023-10-15  1:35         ` Joseph Turner

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