emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Scheduling in a narrowed subtree: Bug?
@ 2019-09-09 20:17 Michaël Cadilhac
  2019-09-09 22:13 ` Gustavo Barros
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michaël Cadilhac @ 2019-09-09 20:17 UTC (permalink / raw)
  To: Org-Mode mailing list

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

Is this the expected behavior?

1. Create an empty org file
2. Insert
* Test
* Test 2
3. With the cursor at Test, hit C-x n s to narrow the view to the Test
subtree
4. Hit C-c C-s to schedule the line at any date.

As a result, the SCHEDULED keyword is _not_ included in the narrow view,
and inserting things after the Test heading moves the SCHEDULED keyword
away from its second-line position.

Cheers,
Michaël

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

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

* Re: Scheduling in a narrowed subtree: Bug?
  2019-09-09 20:17 Scheduling in a narrowed subtree: Bug? Michaël Cadilhac
@ 2019-09-09 22:13 ` Gustavo Barros
  2019-09-10  7:53 ` Fraga, Eric
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gustavo Barros @ 2019-09-09 22:13 UTC (permalink / raw)
  To: Michaël Cadilhac; +Cc: Org-Mode mailing list


On Mon, Sep 09 2019, Michaël Cadilhac wrote:

> Is this the expected behavior?
>
> 1. Create an empty org file
> 2. Insert
> * Test
> * Test 2
> 3. With the cursor at Test, hit C-x n s to narrow the view to the Test subtree
> 4. Hit C-c C-s to schedule the line at any date.
>
> As a result, the SCHEDULED keyword is _not_ included in the narrow view, and inserting things after the Test heading
> moves the SCHEDULED keyword away from its second-line position.

This is likely related to
https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00087.html

Regards,
Gustavo.

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

* Re: Scheduling in a narrowed subtree: Bug?
  2019-09-09 20:17 Scheduling in a narrowed subtree: Bug? Michaël Cadilhac
  2019-09-09 22:13 ` Gustavo Barros
@ 2019-09-10  7:53 ` Fraga, Eric
  2019-09-10 21:10 ` Gustavo Barros
  2020-05-06  0:44 ` Nicolas Goaziou
  3 siblings, 0 replies; 5+ messages in thread
From: Fraga, Eric @ 2019-09-10  7:53 UTC (permalink / raw)
  To: Michaël Cadilhac; +Cc: Org-Mode mailing list

On Monday,  9 Sep 2019 at 15:17, Michaël Cadilhac wrote:
> Is this the expected behavior?
>
> 1. Create an empty org file
> 2. Insert
> * Test
> * Test 2
> 3. With the cursor at Test, hit C-x n s to narrow the view to the Test
> subtree
> 4. Hit C-c C-s to schedule the line at any date.
>
> As a result, the SCHEDULED keyword is _not_ included in the narrow view,
> and inserting things after the Test heading moves the SCHEDULED keyword
> away from its second-line position.

I can confirm this.

However, normally, I do not use narrowing to subtree but instead use a
function based on the code originally from

http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html

My code looks like this:

#+begin_src org
  (defun narrow-or-widen-dwim (p)
    "Widen if buffer is narrowed, narrow-dwim otherwise.
  Dwim means: region, org-src-block, org-subtree, or defun,
  whichever applies first. Narrowing to org-src-block actually
  calls `org-edit-src-code'.

  With prefix P, don't widen, just narrow even if buffer is
  already narrowed."
    (interactive "P")
    (declare (interactive-only))
    (cond ((and (buffer-narrowed-p) (not p)) (widen))
          ((region-active-p)
           (narrow-to-region (region-beginning) (region-end)))
          ((derived-mode-p 'org-mode)
           ;; `org-edit-src-code' is not a real narrowing
           ;; command. Remove this first conditional if you
           ;; don't want it.
           (cond ((ignore-errors (org-edit-src-code))
                  (delete-other-windows))
                 ((ignore-errors (org-narrow-to-block) t))
                 ((ignore-errors (org-narrow-to-element) t))
                 (t (org-narrow-to-subtree))))
          ((derived-mode-p 'latex-mode)
           (LaTeX-narrow-to-environment))
          (t (narrow-to-defun))))
#+end_src

This tries a number of different narrowing functions first.  Using
this, everything works fine.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-401-gfabd6d

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

* Re: Scheduling in a narrowed subtree: Bug?
  2019-09-09 20:17 Scheduling in a narrowed subtree: Bug? Michaël Cadilhac
  2019-09-09 22:13 ` Gustavo Barros
  2019-09-10  7:53 ` Fraga, Eric
@ 2019-09-10 21:10 ` Gustavo Barros
  2020-05-06  0:44 ` Nicolas Goaziou
  3 siblings, 0 replies; 5+ messages in thread
From: Gustavo Barros @ 2019-09-10 21:10 UTC (permalink / raw)
  To: Michaël Cadilhac; +Cc: Org-Mode mailing list


On Mon, Sep 09 2019, Michaël Cadilhac wrote:

> Is this the expected behavior?
>
> 1. Create an empty org file
> 2. Insert
> * Test
> * Test 2
> 3. With the cursor at Test, hit C-x n s to narrow the view to the Test subtree
> 4. Hit C-c C-s to schedule the line at any date.
>
> As a result, the SCHEDULED keyword is _not_ included in the narrow view, and inserting things after the Test heading
> moves the SCHEDULED keyword away from its second-line position.
>
> Cheers,
> Michaël

This is likely related to
https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00087.html

Regards,
Gustavo.

PS: I had tried to send this yesterday, but I think I have screwed up
the sending then.  If this is gets to you in duplicity, my apologies for
the noise.

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

* Re: Scheduling in a narrowed subtree: Bug?
  2019-09-09 20:17 Scheduling in a narrowed subtree: Bug? Michaël Cadilhac
                   ` (2 preceding siblings ...)
  2019-09-10 21:10 ` Gustavo Barros
@ 2020-05-06  0:44 ` Nicolas Goaziou
  3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2020-05-06  0:44 UTC (permalink / raw)
  To: Michaël Cadilhac; +Cc: Org-Mode mailing list

Hello,

Michaël Cadilhac <michael@cadilhac.name> writes:

> Is this the expected behavior?
>
> 1. Create an empty org file
> 2. Insert
> * Test
> * Test 2
> 3. With the cursor at Test, hit C-x n s to narrow the view to the Test
> subtree
> 4. Hit C-c C-s to schedule the line at any date.
>
> As a result, the SCHEDULED keyword is _not_ included in the narrow view,
> and inserting things after the Test heading moves the SCHEDULED keyword
> away from its second-line position.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou


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

end of thread, other threads:[~2020-05-06  0:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 20:17 Scheduling in a narrowed subtree: Bug? Michaël Cadilhac
2019-09-09 22:13 ` Gustavo Barros
2019-09-10  7:53 ` Fraga, Eric
2019-09-10 21:10 ` Gustavo Barros
2020-05-06  0:44 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).