emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-mhe-store-link alters window layout
@ 2011-02-07 10:29 Stephen Eglen
  2011-02-08 15:44 ` Thomas Baumann
  2011-02-08 15:55 ` [Accepted] " Bastien Guerry
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Eglen @ 2011-02-07 10:29 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: thomas.baumann, Stephen Eglen

If I run M-x org-store-link when my current emacs frame is just showing
one MH-E window (and nothing else in the frame), e.g. the "show-+inbox"
buffer, then the link to that email is created okay, but the window
frames are altered so that the +inbox summary window is also shown.
In general, the previous window contents are forgotten.  I suggest
adding a 'save-window-excursion' into org-mhe-store-link so that the
window arrangement is preserved on exit from the function.

Patch below is long just because of the extra indentation.

Stephen

diff --git a/lisp/org-mhe.el b/lisp/org-mhe.el
index c384062..c9b0481 100644
--- a/lisp/org-mhe.el
+++ b/lisp/org-mhe.el
@@ -83,27 +83,28 @@ supported by MH-E."
   "Store a link to an MH-E folder or message."
   (when (or (equal major-mode 'mh-folder-mode)
 	    (equal major-mode 'mh-show-mode))
-    (let* ((from (org-mhe-get-header "From:"))
-	   (to (org-mhe-get-header "To:"))
-	   (message-id (org-mhe-get-header "Message-Id:"))
-	   (subject (org-mhe-get-header "Subject:"))
-	   (date (org-mhe-get-header "Date:"))
-	   (date-ts (and date (format-time-string
-			       (org-time-stamp-format t) (date-to-time date))))
-	   (date-ts-ia (and date (format-time-string
-				  (org-time-stamp-format t t)
-				  (date-to-time date))))
-	   link desc)
-      (org-store-link-props :type "mh" :from from :to to
-			    :subject subject :message-id message-id)
-      (when date
-	(org-add-link-props :date date :date-timestamp date-ts
-			    :date-timestamp-inactive date-ts-ia))
-      (setq desc (org-email-link-description))
-      (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
-				(org-remove-angle-brackets message-id)))
-      (org-add-link-props :link link :description desc)
-      link)))
+    (save-window-excursion
+      (let* ((from (org-mhe-get-header "From:"))
+	     (to (org-mhe-get-header "To:"))
+	     (message-id (org-mhe-get-header "Message-Id:"))
+	     (subject (org-mhe-get-header "Subject:"))
+	     (date (org-mhe-get-header "Date:"))
+	     (date-ts (and date (format-time-string
+				 (org-time-stamp-format t) (date-to-time date))))
+	     (date-ts-ia (and date (format-time-string
+				    (org-time-stamp-format t t)
+				    (date-to-time date))))
+	     link desc)
+	(org-store-link-props :type "mh" :from from :to to
+			      :subject subject :message-id message-id)
+	(when date
+	  (org-add-link-props :date date :date-timestamp date-ts
+			      :date-timestamp-inactive date-ts-ia))
+	(setq desc (org-email-link-description))
+	(setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
+				  (org-remove-angle-brackets message-id)))
+	(org-add-link-props :link link :description desc)
+	link))))
 
 (defun org-mhe-open (path)
   "Follow an MH-E message link specified by PATH."

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

* Re: org-mhe-store-link alters window layout
  2011-02-07 10:29 org-mhe-store-link alters window layout Stephen Eglen
@ 2011-02-08 15:44 ` Thomas Baumann
  2011-02-08 15:55   ` Bastien
  2011-02-08 15:55 ` [Accepted] " Bastien Guerry
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Baumann @ 2011-02-08 15:44 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Carsten Dominik


Looks good to me, thank you for bringing this up.

Carsten, could you please check the patch in?

Thanks again
Thomas

Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> writes:

> If I run M-x org-store-link when my current emacs frame is just showing
> one MH-E window (and nothing else in the frame), e.g. the "show-+inbox"
> buffer, then the link to that email is created okay, but the window
> frames are altered so that the +inbox summary window is also shown.
> In general, the previous window contents are forgotten.  I suggest
> adding a 'save-window-excursion' into org-mhe-store-link so that the
> window arrangement is preserved on exit from the function.
>
> Patch below is long just because of the extra indentation.
>
> Stephen
>
> diff --git a/lisp/org-mhe.el b/lisp/org-mhe.el
> index c384062..c9b0481 100644
> --- a/lisp/org-mhe.el
> +++ b/lisp/org-mhe.el
> @@ -83,27 +83,28 @@ supported by MH-E."
>    "Store a link to an MH-E folder or message."
>    (when (or (equal major-mode 'mh-folder-mode)
>  	    (equal major-mode 'mh-show-mode))
> -    (let* ((from (org-mhe-get-header "From:"))
> -	   (to (org-mhe-get-header "To:"))
> -	   (message-id (org-mhe-get-header "Message-Id:"))
> -	   (subject (org-mhe-get-header "Subject:"))
> -	   (date (org-mhe-get-header "Date:"))
> -	   (date-ts (and date (format-time-string
> -			       (org-time-stamp-format t) (date-to-time date))))
> -	   (date-ts-ia (and date (format-time-string
> -				  (org-time-stamp-format t t)
> -				  (date-to-time date))))
> -	   link desc)
> -      (org-store-link-props :type "mh" :from from :to to
> -			    :subject subject :message-id message-id)
> -      (when date
> -	(org-add-link-props :date date :date-timestamp date-ts
> -			    :date-timestamp-inactive date-ts-ia))
> -      (setq desc (org-email-link-description))
> -      (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
> -				(org-remove-angle-brackets message-id)))
> -      (org-add-link-props :link link :description desc)
> -      link)))
> +    (save-window-excursion
> +      (let* ((from (org-mhe-get-header "From:"))
> +	     (to (org-mhe-get-header "To:"))
> +	     (message-id (org-mhe-get-header "Message-Id:"))
> +	     (subject (org-mhe-get-header "Subject:"))
> +	     (date (org-mhe-get-header "Date:"))
> +	     (date-ts (and date (format-time-string
> +				 (org-time-stamp-format t) (date-to-time date))))
> +	     (date-ts-ia (and date (format-time-string
> +				    (org-time-stamp-format t t)
> +				    (date-to-time date))))
> +	     link desc)
> +	(org-store-link-props :type "mh" :from from :to to
> +			      :subject subject :message-id message-id)
> +	(when date
> +	  (org-add-link-props :date date :date-timestamp date-ts
> +			      :date-timestamp-inactive date-ts-ia))
> +	(setq desc (org-email-link-description))
> +	(setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
> +				  (org-remove-angle-brackets message-id)))
> +	(org-add-link-props :link link :description desc)
> +	link))))
>  
>  (defun org-mhe-open (path)
>    "Follow an MH-E message link specified by PATH."
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* [Accepted] org-mhe-store-link alters window layout
  2011-02-07 10:29 org-mhe-store-link alters window layout Stephen Eglen
  2011-02-08 15:44 ` Thomas Baumann
@ 2011-02-08 15:55 ` Bastien Guerry
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien Guerry @ 2011-02-08 15:55 UTC (permalink / raw)
  To: emacs-orgmode

Patch 584 (http://patchwork.newartisans.com/patch/584/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C1337.1297074568%40maps%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] org-mhe-store-link alters window layout
> Date: Mon, 07 Feb 2011 15:29:28 -0000
> From: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
> X-Patchwork-Id: 584
> Message-Id: <1337.1297074568@maps>
> To: emacs-orgmode@gnu.org
> Cc: thomas.baumann@ch.tum.de, Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
> 
> If I run M-x org-store-link when my current emacs frame is just showing
> one MH-E window (and nothing else in the frame), e.g. the "show-+inbox"
> buffer, then the link to that email is created okay, but the window
> frames are altered so that the +inbox summary window is also shown.
> In general, the previous window contents are forgotten.  I suggest
> adding a 'save-window-excursion' into org-mhe-store-link so that the
> window arrangement is preserved on exit from the function.
> 
> Patch below is long just because of the extra indentation.
> 
> Stephen
> 
> 
> diff --git a/lisp/org-mhe.el b/lisp/org-mhe.el
> index c384062..c9b0481 100644
> --- a/lisp/org-mhe.el
> +++ b/lisp/org-mhe.el
> @@ -83,27 +83,28 @@ supported by MH-E."
>    "Store a link to an MH-E folder or message."
>    (when (or (equal major-mode 'mh-folder-mode)
>  	    (equal major-mode 'mh-show-mode))
> -    (let* ((from (org-mhe-get-header "From:"))
> -	   (to (org-mhe-get-header "To:"))
> -	   (message-id (org-mhe-get-header "Message-Id:"))
> -	   (subject (org-mhe-get-header "Subject:"))
> -	   (date (org-mhe-get-header "Date:"))
> -	   (date-ts (and date (format-time-string
> -			       (org-time-stamp-format t) (date-to-time date))))
> -	   (date-ts-ia (and date (format-time-string
> -				  (org-time-stamp-format t t)
> -				  (date-to-time date))))
> -	   link desc)
> -      (org-store-link-props :type "mh" :from from :to to
> -			    :subject subject :message-id message-id)
> -      (when date
> -	(org-add-link-props :date date :date-timestamp date-ts
> -			    :date-timestamp-inactive date-ts-ia))
> -      (setq desc (org-email-link-description))
> -      (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
> -				(org-remove-angle-brackets message-id)))
> -      (org-add-link-props :link link :description desc)
> -      link)))
> +    (save-window-excursion
> +      (let* ((from (org-mhe-get-header "From:"))
> +	     (to (org-mhe-get-header "To:"))
> +	     (message-id (org-mhe-get-header "Message-Id:"))
> +	     (subject (org-mhe-get-header "Subject:"))
> +	     (date (org-mhe-get-header "Date:"))
> +	     (date-ts (and date (format-time-string
> +				 (org-time-stamp-format t) (date-to-time date))))
> +	     (date-ts-ia (and date (format-time-string
> +				    (org-time-stamp-format t t)
> +				    (date-to-time date))))
> +	     link desc)
> +	(org-store-link-props :type "mh" :from from :to to
> +			      :subject subject :message-id message-id)
> +	(when date
> +	  (org-add-link-props :date date :date-timestamp date-ts
> +			      :date-timestamp-inactive date-ts-ia))
> +	(setq desc (org-email-link-description))
> +	(setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
> +				  (org-remove-angle-brackets message-id)))
> +	(org-add-link-props :link link :description desc)
> +	link))))
>  
>  (defun org-mhe-open (path)
>    "Follow an MH-E message link specified by PATH."
> 

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

* Re: Re: org-mhe-store-link alters window layout
  2011-02-08 15:44 ` Thomas Baumann
@ 2011-02-08 15:55   ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2011-02-08 15:55 UTC (permalink / raw)
  To: Thomas Baumann; +Cc: Carsten Dominik, emacs-orgmode

Thomas Baumann <dtbaumann@yahoo.de> writes:

> Looks good to me, thank you for bringing this up.
>
> Carsten, could you please check the patch in?

I applied this patch, thanks for double-checking it!

-- 
 Bastien

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

end of thread, other threads:[~2011-02-08 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 10:29 org-mhe-store-link alters window layout Stephen Eglen
2011-02-08 15:44 ` Thomas Baumann
2011-02-08 15:55   ` Bastien
2011-02-08 15:55 ` [Accepted] " Bastien Guerry

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