emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
@ 2020-09-21 21:53 Gustavo Barros
  2021-05-03 20:31 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo Barros @ 2020-09-21 21:53 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi All,

since some time I've been facing a small annoyance in the agenda, as 
when I move point in my weekly agenda to a day which is not the first 
one display and then hit "f" (`org-agenda-later') the agenda buffer is 
scrolled up, hiding the top of the buffer, even though there is no lack 
of space in the frame to fit the whole window.

This is not something that started after the most recent release, I had 
been observing this previously.  But I thought I might have missed some 
fix, and waited to see if the issue was still up after the release came. 
And it is.  I'd say since a couple of weeks, but it is easy to be 
tricked by memory in these cases, and it might be more.

I did some bisecting to be able to come up with a proper ECM, and it 
turned out to boil down to the interaction between my 
`scroll-conservatively' setting, and a combination in 
`org-agenda-custom-commands' of two agendas with different time spans 
(one weekly, the other daily).


An ECM to reproduce the issue is:

- Start 'emacs -Q'

- Do an initial setup:
  #+begin_src emacs-lisp
  (add-to-list 'load-path "~/.emacs.d/elpa/org-plus-contrib-20200921")
  ;; Latest Org weekly build (Org 9.4)

  (setq scroll-conservatively 10000)

  ;; Not essential to reproduce, but included just to emphasize there is 
  no lack
  ;; of space to trigger the scrolling.
  (setq org-agenda-window-setup 'only-window)

  (setq org-agenda-custom-commands
        '(("w" "Agenda"
           ((agenda ""
                    ((org-agenda-overriding-header "Agenda (Week)")))
            (agenda ""
                    ((org-agenda-overriding-header "Habits (Day)")
                     (org-agenda-span 'day)))))))
  #+end_src

Now, open this agenda with "M-x org-agenda RET w", move point to a day 
further down the first agenda block (e.g. today is Monday, go to 
Saturday).  Call `org-agenda-later' ("f") and observe the buffer was 
scrolled up so that the day of the week you were before is now made the 
first line of the buffer, and the previous ones are hidden.

As these kinds of scrolling settings interactions might be somewhat 
tricky to reproduce, I attach a couple of screenshots of the resulting 
situation before and after calling `org-agenda-later' as described in 
the ECM.

Best regards,
Gustavo.





Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.20, cairo version 1.16.0)
 of 2020-08-11
Package: Org mode version 9.4 (9.4-7-g3eccc5-elpaplus @ 
/home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)

current state:
==============
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
		     org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
		   [add-hook change-major-mode-hook org-show-all append 
		   local]
		   5]
		 #[0 "\300\301\302\303\304$\207"
		   [add-hook change-major-mode-hook 
		   org-babel-show-result-all
		    append local]
		   5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes
		 org-eldoc-load)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 
 "\n\n(fn ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
		      org-babel-header-arg-expand)
 org-agenda-loop-over-headlines-in-active-region nil
 org-src-lang-modes '(("arduino" . arduino) ("redis" . redis) ("php" 
 . php)
		      ("C" . c) ("C++" . c++) ("asymptote" . asy)
		      ("bash" . sh) ("beamer" . latex) ("calc" 
		      . fundamental)
		      ("cpp" . c++) ("ditaa" . artist) ("dot" 
		      . fundamental)
		      ("elisp" . emacs-lisp) ("ocaml" . tuareg)
		      ("screen" . shell-script) ("shell" . sh)
		      ("sqlite" . sql))
 org-occur-hook '(org-first-headline-recenter)
 org-agenda-window-setup 'only-window
 org-cycle-hook '(org-cycle-hide-archived-subtrees 
 org-cycle-hide-drawers
		  org-cycle-show-empty-lines
		  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
			  org-babel-speed-command-activate)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
			org-attach-complete-link)
		       ("id" :follow org-id-open)
		       ("eww" :follow org-eww-open :store 
		       org-eww-store-link)
		       ("rmail" :follow org-rmail-open :store
			org-rmail-store-link)
		       ("mhe" :follow org-mhe-open :store 
		       org-mhe-store-link)
		       ("irc" :follow org-irc-visit :store 
		       org-irc-store-link
			:export org-irc-export)
		       ("info" :follow org-info-open :export 
		       org-info-export
			:store org-info-store-link)
		       ("gnus" :follow org-gnus-open :store
			org-gnus-store-link)
		       ("docview" :follow org-docview-open :export
			org-docview-export :store 
			org-docview-store-link)
		       ("bibtex" :follow org-bibtex-open :store
			org-bibtex-store-link)
		       ("bbdb" :follow org-bbdb-open :export 
		       org-bbdb-export
			:complete org-bbdb-complete-link :store
			org-bbdb-store-link)
		       ("w3m" :store org-w3m-store-link) ("file+sys")
		       ("file+emacs") ("shell" :follow 
		       org-link--open-shell)
		       ("news" :follow
			#[514 "\301\300\302Q\"\207"
			  ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
			)
		       ("mailto" :follow
			#[514 "\301\300\302Q\"\207"
			  ["mailto" browse-url ":"] 6 "\n\n(fn URL 
			  ARG)"]
			)
		       ("https" :follow
			#[514 "\301\300\302Q\"\207"
			  ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
			)
		       ("http" :follow
			#[514 "\301\300\302Q\"\207"
			  ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]
			)
		       ("ftp" :follow
			#[514 "\301\300\302Q\"\207" ["ftp" browse-url 
                         ":"]
			  6 "\n\n(fn URL ARG)"]
			)
		       ("help" :follow org-link--open-help)
		       ("file" :complete org-link-complete-file)
		       ("elisp" :follow org-link--open-elisp)
		       ("doi" :follow org-link--open-doi))
 org-link-elisp-confirm-function 'yes-or-no-p
 org-agenda-custom-commands '(("w" "Agenda"
			       ((agenda ""
				 ((org-agenda-overriding-header
				   "Agenda (Week)")
				  )
				 )
				(agenda ""
				 ((org-agenda-overriding-header "Habits 
				 (Day)")
				  (org-agenda-span 'day))
				 )
				)
			       )
			      )
 )
 

[-- Attachment #2: before.png --]
[-- Type: image/png, Size: 43444 bytes --]

[-- Attachment #3: after.png --]
[-- Type: image/png, Size: 32654 bytes --]

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

* Re: Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
  2020-09-21 21:53 Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)] Gustavo Barros
@ 2021-05-03 20:31 ` Bastien
  2021-05-03 21:47   ` Gustavo Barros
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2021-05-03 20:31 UTC (permalink / raw)
  To: Gustavo Barros; +Cc: emacs-orgmode

Hi Gustavo,

Gustavo Barros <gusbrs.2016@gmail.com> writes:

> since some time I've been facing a small annoyance in the agenda, as 
> when I move point in my weekly agenda to a day which is not the first 
> one display and then hit "f" (`org-agenda-later') the agenda buffer is 
> scrolled up, hiding the top of the buffer, even though there is no lack 
> of space in the frame to fit the whole window.

Fixed in maint, thanks.

-- 
 Bastien


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

* Re: Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
  2021-05-03 20:31 ` Bastien
@ 2021-05-03 21:47   ` Gustavo Barros
  2021-05-03 22:26     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo Barros @ 2021-05-03 21:47 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

On Mon, 03 May 2021 at 17:31, Bastien <bzg@gnu.org> wrote:

> Hi Gustavo,
>
> Gustavo Barros <gusbrs.2016@gmail.com> writes:
>
>> since some time I've been facing a small annoyance in the agenda, as 
>> when I move point in my weekly agenda to a day which is not the first 
>> one display and then hit "f" (`org-agenda-later') the agenda buffer 
>> is 
>> scrolled up, hiding the top of the buffer, even though there is no 
>> lack 
>> of space in the frame to fit the whole window.
>
> Fixed in maint, thanks.

Thank you for looking into this.

But I think the commit, though indeed avoids the reported undue 
scrolling, brings other undesired side effects.  Usually, 
`org-agenda-later' will carry over the current day of the week to the 
next week.  If we call it on Thursday, point will be placed on the same 
week day of the next week.

Just calling `(set-window-start nil 1)' there breaks this regularity. 
It is easy to generate a case where this happens.  Just squeeze the 
height of your window on a "populated" agenda, and choose a day for 
which that day next week won't fit in the window if position 1 is shown, 
and call it from there.

Perhaps doing so before the call to 
`org-agenda-find-same-or-today-or-agenda' would be a possibility? 
(untested)

Best,
Gustavo.




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

* Re: Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
  2021-05-03 21:47   ` Gustavo Barros
@ 2021-05-03 22:26     ` Bastien
  2021-05-03 22:47       ` Gustavo Barros
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2021-05-03 22:26 UTC (permalink / raw)
  To: Gustavo Barros; +Cc: emacs-orgmode

Hi Gustavo,

well, clearly my mind is dull right now - I pushed another better fix,
but please report any better solution if you have one.

Thanks!

-- 
 Bastien


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

* Re: Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
  2021-05-03 22:26     ` Bastien
@ 2021-05-03 22:47       ` Gustavo Barros
  0 siblings, 0 replies; 5+ messages in thread
From: Gustavo Barros @ 2021-05-03 22:47 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

On Mon, 03 May 2021 at 19:26, Bastien <bzg@gnu.org> wrote:

>
> well, clearly my mind is dull right now - I pushed another better fix,
> but please report any better solution if you have one.
>

Thank you.

No, not really, I just happened to spot an offending case of the 
previous commit.  Unfortunately, I don't have a silver bullet here.

Gustavo.


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

end of thread, other threads:[~2021-05-03 23:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-21 21:53 Bug: org-agenda-later scrolls buffer unnecessarily [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)] Gustavo Barros
2021-05-03 20:31 ` Bastien
2021-05-03 21:47   ` Gustavo Barros
2021-05-03 22:26     ` Bastien
2021-05-03 22:47       ` Gustavo Barros

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