unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32307: [feature request] Add standard hooks to toggle common features
@ 2018-07-30  0:52 Fu Yuan
  2019-07-13  3:15 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Fu Yuan @ 2018-07-30  0:52 UTC (permalink / raw)
  To: 32307

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


  
  


  
  
  
    
    	
    	By "standard features" I mean line numbering, format on save, auto-parens, etc.
The current situation have these downsides:
1. complexity in configuration.
Some of the packages that provide these features also provide toggling command,e.g. toggle-line-number or autoparens-mode.However, some __are not__, e.g. format on save.Toggling such feature requires users to implement their own commands.What's worse, they need to implement a toggling commandfor __each and every__ language.
2. problem when other package needs to toggle
For example, I wrote a package that needs to temporarily disable auto-parens.I have to write code that handles electric-pair-mode, autoparens and paredit.Further more, byte compiler is not happybecause I was referring functions it doesn't know about.
Here is my thought about it:
Provide toggle commands and corresponding hook for each of these features.Feature providers add their toggle function to the proper hook.When user toggles on/off, the toggle command runs each functionin the hook with an aregument indicating that user is turning on or turning off,maybe t and nil.
How do you think? Have there been similar discussions?


    	

    	Sincerely, Yuan
    
  

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

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

* bug#32307: [feature request] Add standard hooks to toggle common features
  2018-07-30  0:52 bug#32307: [feature request] Add standard hooks to toggle common features Fu Yuan
@ 2019-07-13  3:15 ` Lars Ingebrigtsen
  2019-09-27 16:35   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-13  3:15 UTC (permalink / raw)
  To: Fu Yuan; +Cc: 32307

Fu Yuan <casouri@gmail.com> writes:

> 2. problem when other package needs to toggle
>
> For example, I wrote a package that needs to temporarily disable auto-parens.
> I have to write code that handles electric-pair-mode, autoparens and paredit.
> Further more, byte compiler is not happy
> because I was referring functions it doesn't know about.

You can use declare-function to tell the compiler about the functions.

> Here is my thought about it:
>
> Provide toggle commands and corresponding hook for each of these features.
> Feature providers add their toggle function to the proper hook.
> When user toggles on/off, the toggle command runs each function
> in the hook with an aregument indicating that user is turning on or turning off,
> maybe t and nil.

I'm not quite sure I understand you here.  The vast majority of modes
can be called with an argument to turn them off or on.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#32307: [feature request] Add standard hooks to toggle common features
  2019-07-13  3:15 ` Lars Ingebrigtsen
@ 2019-09-27 16:35   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-27 16:35 UTC (permalink / raw)
  To: Fu Yuan; +Cc: 32307

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> Here is my thought about it:
>>
>> Provide toggle commands and corresponding hook for each of these features.
>> Feature providers add their toggle function to the proper hook.
>> When user toggles on/off, the toggle command runs each function
>> in the hook with an aregument indicating that user is turning on or
>> turning off,
>> maybe t and nil.
>
> I'm not quite sure I understand you here.  The vast majority of modes
> can be called with an argument to turn them off or on.

More information was requested, but no response was given within a few
months, so I'm closing this bug report.  If the problem still exists,
please reopen this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2019-09-27 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30  0:52 bug#32307: [feature request] Add standard hooks to toggle common features Fu Yuan
2019-07-13  3:15 ` Lars Ingebrigtsen
2019-09-27 16:35   ` Lars Ingebrigtsen

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