[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated
From: |
Nicolas Goaziou |
Subject: |
Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated |
Date: |
Wed, 15 Jan 2014 22:26:14 +0100 |
Bastien <address@hidden> writes:
> Nicolas Goaziou <address@hidden> writes:
>
>> Bastien <address@hidden> writes:
>>
>>> Nicolas Goaziou <address@hidden> writes:
>>>
>>>> (cond (org-startup-indented (require 'org-indent) (org-indent-mode 1))
>>>> ((org-bound-and-true-p org-indent-mode) (org-indent-mode -1)))
>>>
>>> This will not work, because (org-bound-and-true-p org-indent-mode)
>>> returns nil at the time `org-mode' is called.
>>
>> If it returns nil, it means that `org-startup-indented' is nil and
>> either `org-indent' isn't loaded or `org-indent-mode' is off.
>>
>> I don't get why it wouldn't work.
>
> Try to edebug-defun `org-mode' with the recipe I posted and you'll
> see: yes, `org-startup-indented' and `org-indent-mode' are off,
> but the org-indent properties have not been removed from the before,
> as they are by manually turning off with M-x org-indent-mode RET
I see, thank you. But I still don't understand where, and when,
`org-indent-mode' is reset.
Anyway, we can also patch `org-mode-restart', from
(defun org-mode-restart ()
(interactive)
(funcall major-mode)
(hack-local-variables)
(message "%s restarted" major-mode))
to,
(defun org-mode-restart ()
(interactive)
(let ((indent-status (org-bound-and-true-p org-indent-mode)))
(funcall major-mode)
(hack-local-variables)
(when (and indent-status (not (org-bound-and-true-p org-indent-mode)))
(org-indent-mode -1)))
(message "%s restarted" major-mode))
Still not pretty, but a bit better, IMO.
Also, there's a dangling (defvar org-indent-mode nil) in org.el that
looks suspicious. I don't think we need it if we use
`org-bound-and-true-p' whenever we need to check for `org-indent-mode'
value.
Regards,
--
Nicolas Goaziou
- [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Bastien, 2014/01/14
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Nicolas Goaziou, 2014/01/15
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Bastien, 2014/01/15
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Nicolas Goaziou, 2014/01/15
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Bastien, 2014/01/15
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Bastien, 2014/01/15
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated,
Nicolas Goaziou <=
- Re: [O] [BUG, PATCH] org-indent-mode not correctly deactivated, Bastien, 2014/01/15