[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode
From: |
Kévin Le Gouguec |
Subject: |
Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode |
Date: |
Thu, 07 May 2020 17:33:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> +(defmacro org-test-with-minor-mode (mode state &rest body)
>> + "Run BODY after setting MODE to STATE.
>> +Restore MODE to its former state afterward."
>> + (declare (debug (sexp sexp body)) (indent 2))
>> + `(let ((old-state ,mode))
>> + (,mode (if ,state 1 0))
>> + ,@body
>> + (,mode (if old-state 1 0))))
>
> This should probably use `unwind-protect` in case `body` exits
> non-locally.
> [ And also, for buffer-local minor modes, we should try and be careful
> to restore the mode in the same buffer, tho this can be pushed as
> a responsability of `body`. ]
Thanks for confirming my nagging feeling that this macro was a bit too
naive :)
Nicolas actually ditched it and turned on/off electric-indent-local-mode
in the temporary buffer where the Org commands are run; that should take
care of these issues IIUC.
- Re: Reconciling org-mode idiosyncrasies with Emacs core, (continued)
- Re: Reconciling org-mode idiosyncrasies with Emacs core, Nicolas Goaziou, 2020/05/04
- Re: Reconciling org-mode idiosyncrasies with Emacs core, Kévin Le Gouguec, 2020/05/04
- [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode (was: Reconciling org-mode idiosyncrasies with Emacs core), Kévin Le Gouguec, 2020/05/06
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Nicolas Goaziou, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Kévin Le Gouguec, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Nicolas Goaziou, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Kévin Le Gouguec, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Kévin Le Gouguec, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Nicolas Goaziou, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode, Stefan Monnier, 2020/05/07
- Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode,
Kévin Le Gouguec <=