[PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap

classic Classic list List threaded Threaded
3 messages Options
Keith Packard Keith Packard
Reply | Threaded
Open this post in threaded view
|

[PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap

I created the notmuch-show-hook precisely so I could add these two
options, but I suspect most people will want them, so I just made them
the default. If you don't want them, you can use remove-hook to get
rid of this.

Signed-off-by: Keith Packard <[hidden email]>
---
 notmuch.el |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 1bb1294..c95cb43 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -698,6 +698,14 @@ view, (remove the \"inbox\" tag from each), with either
   :options '(goto-address)
   :group 'notmuch)
 
+; Make show mode a bit prettier, highlighting URLs and using word wrap
+
+(defun notmuch-show-pretty-hook ()
+  (goto-address-mode 1)
+  (visual-line-mode))
+
+(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook)
+
 (defun notmuch-show (thread-id &optional parent-buffer)
   "Run \"notmuch show\" with the given thread ID and display results.
 
--
1.6.5.2


Alexander Botero-Lowry Alexander Botero-Lowry
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap

On Wed, 18 Nov 2009 00:29:59 -0800, Keith Packard <[hidden email]> wrote:
> I created the notmuch-show-hook precisely so I could add these two
> options, but I suspect most people will want them, so I just made them
> the default. If you don't want them, you can use remove-hook to get
> rid of this.
>
Yes, hooks should be added for search as well. :)

> +; Make show mode a bit prettier, highlighting URLs and using word wrap
> +
> +(defun notmuch-show-pretty-hook ()
> +  (goto-address-mode 1)
> +  (visual-line-mode))
> +
visual-line-mode turns out to make subject look pretty ugly if there is a
continuation. It doesn't do much good for the citation headers
either. We probably need to do our own intelligent wrapping rather then
use visual-line-mode to make this actually look right.

goto-address-mode is important though. :)

alex

Carl Worth-2 Carl Worth-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap

In reply to this post by Keith Packard
On Wed, 18 Nov 2009 00:29:59 -0800, Keith Packard <[hidden email]> wrote:
> I created the notmuch-show-hook precisely so I could add these two
> options, but I suspect most people will want them, so I just made them
> the default. If you don't want them, you can use remove-hook to get
> rid of this.

Thanks, Keith!

I had actually held off on pushing your original commit to add the hook
because I didn't like that it wasn't documenting what the hook was good
for. But now that we've got some good, suggested behavior there, I'm
much happier. So both are pushed now.

On Wed, 18 Nov 2009 00:52:34 -0800, Alexander Botero-Lowry <[hidden email]> wrote:
> Yes, hooks should be added for search as well. :)

Not a bad idea at all.

> visual-line-mode turns out to make subject look pretty ugly if there is a
> continuation. It doesn't do much good for the citation headers
> either. We probably need to do our own intelligent wrapping rather then
> use visual-line-mode to make this actually look right.

Yes, this stuff isn't perfect yet, but I think it's better than nothing.
We can do our own wrapping if these things get too annoying.

-Carl