[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Message buffer names



Hi,

Thanks for the tip to modify wl-message-buffer-name.  As long as you don't
have too many message buffers lying around and you use uniquify, it's not
too difficult to keep track of message buffers.  One unexpected consequence
is that when you open a message, WL also seems to open the next one in the
background, unless it is the most recent message (easy to see by switching
to ibuffer or some other buffer list).  Perhaps this can be turned off in
some setting for catching or prefetching.

The patch below works, but I had to do some tweaking to get only the subject
rather than the folder name and the subject as the buffer name (which result
in very long buffer names).  Perhaps the way to go is to use the subject as
the buffer name, but also create a filter group in ibuffer to list WL
messages separately and use uniquify to distinguigh between different
messages with the same subject.

By the way, Re: Charles Schwieters' message, C-x 5 2 also works properly
now, displaying the message buffer in the new frame.  I'm not sure why that
is.

Cheers,
Greg

On Mon, 13 Apr 2015 21:13:32 +0900, Kazuhiro Ito wrote:
> Hi,
> 
> > Is there a good reason for making the message buffer hidden?
> 
> I don't know the reason.  But one of reasons may be that it is hard
> for user to decide which buffer to switch because buffer's name is
> unrelated with contents.
> 
> > Is there a way to set the name of the message buffer to something
> > that Emacs doesn't hide?
> 
> Modify wl-message-buffer-name's value.  At least, strip leading SPACE.
> 
> > Even better, can the buffer name be constructed from, e.g., the subject?
> 
> Plese try the below patch.
> 
> -- 
> Kazuhiro Ito
> [2 diff.diff <application/octet-stream (7bit)>]
> diff --git a/wl/wl-message.el b/wl/wl-message.el
> index 45cdaa8..bd50672 100644
> --- a/wl/wl-message.el
> +++ b/wl/wl-message.el
> @@ -532,6 +532,19 @@ Returns non-nil if bottom of message."
>      (if (window-live-p summary-win)
>  	(select-window summary-win))))
>  
> +(defun wl-message-default-buffer-name (folder number)
> +  (let ((subject
> +	 (ignore-errors
> +	   (elmo-message-field folder number 'subject)))
> +	(fname (elmo-folder-name-internal folder)))
> +    (concat (if (memq 'read-folder wl-use-folder-petname)
> +		(wl-folder-get-petname fname)
> +	      fname)
> +	    "/"
> +	    (format "%d" number)
> +	    (when (and subject (> (length subject) 0))
> +	      (concat " " subject)))))
> +
>  ;; Use message buffer cache.
>  (defun wl-message-buffer-display (folder number display-type
>  					 &optional force-reload unread)
> @@ -563,6 +576,12 @@ Returns non-nil if bottom of message."
>      (when (or force-reload redisplay)
>        (condition-case err
>  	  (with-current-buffer hit
> +	    (let ((buffer-name
> +		   (concat
> +		    wl-message-buffer-name
> +		    (funcall wl-message-buffer-name-function folder number))))
> +	      (unless (equal (buffer-name) buffer-name)
> +		(rename-buffer buffer-name t)))
>  	    (when (or force-reload
>  		      (null entity)
>  		      (not (elmo-mime-entity-display-p
> diff --git a/wl/wl-vars.el b/wl/wl-vars.el
> index b743b3c..9f5922d 100644
> --- a/wl/wl-vars.el
> +++ b/wl/wl-vars.el
> @@ -1699,6 +1699,12 @@ Allowed situations are:
>    :group 'wl-summary
>    :group 'wl-pref)
>  
> +(defcustom wl-message-buffer-name-function
> +  'wl-message-default-buffer-name
> +  "*A function for naming message buffer.  It is called with two arguments, folder and number.  Then it returns a string for message buffer's name.  Actual buffer name is concatenated with `wl-message-buffer-name'."
> +  :type 'function
> +  :group 'wl-pref)
> +
>  (defcustom wl-message-id-use-message-from
>    (if (boundp 'wl-message-id-use-wl-from)
>        wl-message-id-use-wl-from t)