emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marco Wahl <marcowahlsoft@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: point moves and zoom level reverts when refreshing agenda
Date: Tue, 05 Jun 2018 16:18:20 +0200	[thread overview]
Message-ID: <841sdlco5v.fsf@gmail.com> (raw)
In-Reply-To: 84vab61lf3.fsf@gmail.com

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


>> 2] i also find that refreshing resets the zoom level created using
>> text-scale-increase.  i wonder if this can also be preserved.  to me,
>> refreshing refers to updating the contents of the agenda view, not
>> things like text scale.
>
> This is a wanted feature AFAICT.  I think the following patch is a
> reliable way to achieve the preservation of text-scale for agenda-redo.

The following is an alternative patch which I think is preferable.  It
just keeps the needed local variables for the text-scale (aka zoom) in
good order in function org-agenda-mode.

Further I use this patch already for some days and could not find any
issue.


Ciao,
     Marco


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-agenda-Keep-local-variables-defining-text-scale.patch --]
[-- Type: text/x-patch, Size: 2969 bytes --]

From 74aa62a7d777319f14896f3814cae474d947f3a7 Mon Sep 17 00:00:00 2001
From: Marco Wahl <marcowahlsoft@gmail.com>
Date: Mon, 4 Jun 2018 15:17:29 +0200
Subject: [PATCH] org-agenda: Keep local-variables defining text-scale

* lisp/org-agenda.el (org-agenda-mode): Save and restore local
	   variables text-scale-mode-amount, text-scale-mode,
	   text-scale-mode-lighter, face-remapping-alist.  In effect
	   this keeps the text-scale at agenda rebuild and redo.

This commit is predicated on the newsgroup post of Samuel Wales "point
moves and zoom level reverts when refreshing agenda" at Sun, 27 May
2018.
---
 lisp/org-agenda.el | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 24b752498..4b95b8c59 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2184,29 +2184,37 @@ The following commands are available:
 
 \\{org-agenda-mode-map}"
   (interactive)
-  (cond (org-agenda-doing-sticky-redo
-	 ;; Refreshing sticky agenda-buffer
-	 ;;
-	 ;; Preserve the value of `org-agenda-local-vars' variables,
-	 ;; while letting `kill-all-local-variables' kill the rest
-	 (let ((save (buffer-local-variables)))
-	   (kill-all-local-variables)
+  (let ((agenda-local-vars-to-keep
+	 '(text-scale-mode-amount
+	   text-scale-mode
+	   text-scale-mode-lighter
+	   face-remapping-alist))
+	(save (buffer-local-variables)))
+    (kill-all-local-variables)
+    (cond (org-agenda-doing-sticky-redo
+	   ;; Refreshing sticky agenda-buffer
+	   ;;
+	   ;; Preserve the value of `org-agenda-local-vars' variables.
 	   (mapc #'make-local-variable org-agenda-local-vars)
 	   (dolist (elem save)
 	     (pcase elem
 	       (`(,var . ,val)		;ignore unbound variables
 		(when (and val (memq var org-agenda-local-vars))
-		  (set var val))))))
-	 (setq-local org-agenda-this-buffer-is-sticky t))
-	(org-agenda-sticky
-	 ;; Creating a sticky Agenda buffer for the first time
-	 (kill-all-local-variables)
-	 (mapc 'make-local-variable org-agenda-local-vars)
-	 (setq-local org-agenda-this-buffer-is-sticky t))
-	(t
-	 ;; Creating a non-sticky agenda buffer
-	 (kill-all-local-variables)
-	 (setq-local org-agenda-this-buffer-is-sticky nil)))
+		  (set var val)))))
+	   (setq-local org-agenda-this-buffer-is-sticky t))
+	  (org-agenda-sticky
+	   ;; Creating a sticky Agenda buffer for the first time
+	   (mapc 'make-local-variable org-agenda-local-vars)
+	   (setq-local org-agenda-this-buffer-is-sticky t))
+	  (t
+	   ;; Creating a non-sticky agenda buffer
+	   (setq-local org-agenda-this-buffer-is-sticky nil)))
+    (mapc #'make-local-variable agenda-local-vars-to-keep)
+    (dolist (elem save)
+      (pcase elem
+	(`(,var . ,val)		;ignore unbound variables
+	 (when (and val (memq var agenda-local-vars-to-keep))
+	   (set var val))))))
   (setq org-agenda-undo-list nil
 	org-agenda-pending-undo-list nil
 	org-agenda-bulk-marked-entries nil)
-- 
2.17.1


  reply	other threads:[~2018-06-05 14:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27 21:19 point moves and zoom level reverts when refreshing agenda Samuel Wales
2018-05-27 21:24 ` Samuel Wales
2018-05-29 16:22 ` Marco Wahl
2018-06-05 14:18   ` Marco Wahl [this message]
2018-06-05 19:00     ` Samuel Wales
2018-06-05 20:35       ` Marco Wahl
2018-06-19 18:22         ` Nicolas Goaziou
2018-06-24  8:15           ` Marco Wahl
2018-06-24 21:10             ` Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=841sdlco5v.fsf@gmail.com \
    --to=marcowahlsoft@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).