[PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-06-03 Thread Carl Worth
On Thu, 29 Apr 2010 09:28:23 +0100, David Edmondson  wrote:
> Add `notmuch-column-control', which has three potential sets of
> values:
...
> `notmuch-hello-tag-width' is now `notmuch-column-control', given that
> your proposed first sentence is a better explanation of the purpose.

A lovely solution. Committed locally now.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



Re: [PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-06-03 Thread Carl Worth
On Thu, 29 Apr 2010 09:28:23 +0100, David Edmondson d...@dme.org wrote:
 Add `notmuch-column-control', which has three potential sets of
 values:
...
 `notmuch-hello-tag-width' is now `notmuch-column-control', given that
 your proposed first sentence is a better explanation of the purpose.

A lovely solution. Committed locally now.

-Carl


pgpPn56lMvEMO.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-04-29 Thread David Edmondson
Add `notmuch-column-control', which has three potential sets of
values:

- t: automatically calculate the number of columns per line based on
  the tags to be shown and the window width,
- an integer: a lower bound on the number of characters that will be
  used to display each column,
- a float: a fraction of the window width that is the lower bound on
  the number of characters that should be used for each column.

So:
- if you would like two columns of tags, set this to 0.5.
- if you would like a single column of tags, set this to 1.0.
- if you would like tags to be 30 characters wide, set this to
  30.
- if you don't want to worry about all of this nonsense, leave
  this set to `t'.
---

`notmuch-hello-tag-width' is now `notmuch-column-control', given that
your proposed first sentence is a better explanation of the purpose.

 emacs/notmuch-hello.el |   63 +++
 1 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1358387..acf40bc 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -65,6 +65,32 @@
   "Background colour for the notmuch logo."
   :group 'notmuch)

+(defcustom notmuch-column-control t
+  "Controls the number of columns for saved searches/tags in notmuch view.
+
+This variable has three potential sets of values:
+
+- t: automatically calculate the number of columns possible based
+  on the tags to be shown and the window width,
+- an integer: a lower bound on the number of characters that will
+  be used to display each column,
+- a float: a fraction of the window width that is the lower bound
+  on the number of characters that should be used for each
+  column.
+
+So:
+- if you would like two columns of tags, set this to 0.5.
+- if you would like a single column of tags, set this to 1.0.
+- if you would like tags to be 30 characters wide, set this to
+  30.
+- if you don't want to worry about all of this nonsense, leave
+  this set to `t'."
+  :group 'notmuch
+  :type '(choice
+ (const :tag "Automatically calculated" t)
+ (integer :tag "Number of characters")
+ (float :tag "Fraction of window")))
+
 (defvar notmuch-hello-url "http://notmuchmail.org;
   "The `notmuch' web site.")

@@ -146,13 +172,38 @@ diagonal."
 (defun notmuch-saved-search-count (search)
   (car (process-lines notmuch-command "count" search)))

+(defun notmuch-hello-tags-per-line (widest)
+  "Determine how many tags to show per line and how wide they
+should be. Returns a cons cell `(tags-per-line width)'."
+  (let ((tags-per-line
+(cond
+ ((integerp notmuch-column-control)
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 (max notmuch-column-control widest)
+
+ ((floatp notmuch-column-control)
+  (let* ((available-width (- (window-width) notmuch-hello-indent))
+ (proposed-width (max (* available-width 
notmuch-column-control) widest)))
+(floor available-width proposed-width)))
+
+ (t
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 widest)))
+
+(cons tags-per-line (/ (- (window-width) notmuch-hello-indent
+ (* tags-per-line (+ 7 1)))
+  tags-per-line
+
 (defun notmuch-hello-insert-tags (tag-alist widest target)
-  (let* ((tags-per-line (max 1
-(/ (- (window-width) notmuch-hello-indent)
-   ;; Count is 7 wide (6 digits plus
-   ;; space), 1 for the space after the
-   ;; name.
-   (+ 7 1 widest
+  (let* ((tags-and-width (notmuch-hello-tags-per-line widest))
+(tags-per-line (car tags-and-width))
+(widest (cdr tags-and-width))
 (count 0)
 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
 ;; Hack the display of the buttons used.
-- 
1.7.0



[PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-04-29 Thread David Edmondson
Add `notmuch-column-control', which has three potential sets of
values:

- t: automatically calculate the number of columns per line based on
  the tags to be shown and the window width,
- an integer: a lower bound on the number of characters that will be
  used to display each column,
- a float: a fraction of the window width that is the lower bound on
  the number of characters that should be used for each column.

So:
- if you would like two columns of tags, set this to 0.5.
- if you would like a single column of tags, set this to 1.0.
- if you would like tags to be 30 characters wide, set this to
  30.
- if you don't want to worry about all of this nonsense, leave
  this set to `t'.
---

`notmuch-hello-tag-width' is now `notmuch-column-control', given that
your proposed first sentence is a better explanation of the purpose.

 emacs/notmuch-hello.el |   63 +++
 1 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1358387..acf40bc 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -65,6 +65,32 @@
   Background colour for the notmuch logo.
   :group 'notmuch)
 
+(defcustom notmuch-column-control t
+  Controls the number of columns for saved searches/tags in notmuch view.
+
+This variable has three potential sets of values:
+
+- t: automatically calculate the number of columns possible based
+  on the tags to be shown and the window width,
+- an integer: a lower bound on the number of characters that will
+  be used to display each column,
+- a float: a fraction of the window width that is the lower bound
+  on the number of characters that should be used for each
+  column.
+
+So:
+- if you would like two columns of tags, set this to 0.5.
+- if you would like a single column of tags, set this to 1.0.
+- if you would like tags to be 30 characters wide, set this to
+  30.
+- if you don't want to worry about all of this nonsense, leave
+  this set to `t'.
+  :group 'notmuch
+  :type '(choice
+ (const :tag Automatically calculated t)
+ (integer :tag Number of characters)
+ (float :tag Fraction of window)))
+
 (defvar notmuch-hello-url http://notmuchmail.org;
   The `notmuch' web site.)
 
@@ -146,13 +172,38 @@ diagonal.
 (defun notmuch-saved-search-count (search)
   (car (process-lines notmuch-command count search)))
 
+(defun notmuch-hello-tags-per-line (widest)
+  Determine how many tags to show per line and how wide they
+should be. Returns a cons cell `(tags-per-line width)'.
+  (let ((tags-per-line
+(cond
+ ((integerp notmuch-column-control)
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 (max notmuch-column-control widest)
+
+ ((floatp notmuch-column-control)
+  (let* ((available-width (- (window-width) notmuch-hello-indent))
+ (proposed-width (max (* available-width 
notmuch-column-control) widest)))
+(floor available-width proposed-width)))
+
+ (t
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 widest)))
+
+(cons tags-per-line (/ (- (window-width) notmuch-hello-indent
+ (* tags-per-line (+ 7 1)))
+  tags-per-line
+
 (defun notmuch-hello-insert-tags (tag-alist widest target)
-  (let* ((tags-per-line (max 1
-(/ (- (window-width) notmuch-hello-indent)
-   ;; Count is 7 wide (6 digits plus
-   ;; space), 1 for the space after the
-   ;; name.
-   (+ 7 1 widest
+  (let* ((tags-and-width (notmuch-hello-tags-per-line widest))
+(tags-per-line (car tags-and-width))
+(widest (cdr tags-and-width))
 (count 0)
 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
 ;; Hack the display of the buttons used.
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-04-27 Thread d...@dme.org
From: David Edmondson 

Add `notmuch-hello-tag-width', which has three potential sets of
values:

- t: automatically calculate the number of tags per line possible
  based on the tags to be shown and the window width,
- an integer: a lower bound on the number of characters that will
  be used to display each tag,
- a float: a fraction of the window width that is the lower bound
  on the number of characters that should be used for each tag.

So:
- if you would like two columns of tags, set this to 0.5.
- if you would like a single column of tags, set this to 1.0.
- if you would like tags to be 30 characters wide, set this to
  30.
- if you don't want to worry about all of this nonsense, leave
  this set to `t'.
---

Carl, for 0.4. You mentioned that you might like to have a single
column of tags/saved searches, but others appear to like multiple
columns. So, make it configurable.

 emacs/notmuch-hello.el |   62 +++
 1 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 378d41c..f7703d9 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -141,13 +141,63 @@ diagonal."
 (defun notmuch-saved-search-count (search)
   (car (process-lines notmuch-command "count" search)))

+(defcustom notmuch-hello-tag-width t
+  "How wide should a tag be?
+
+This variable has three potential sets of values:
+
+- t: automatically calculate the number of tags per line possible
+  based on the tags to be shown and the window width,
+- an integer: a lower bound on the number of characters that will
+  be used to display each tag,
+- a float: a fraction of the window width that is the lower bound
+  on the number of characters that should be used for each tag.
+
+So:
+- if you would like two columns of tags, set this to 0.5.
+- if you would like a single column of tags, set this to 1.0.
+- if you would like tags to be 30 characters wide, set this to
+  30.
+- if you don't want to worry about all of this nonsense, leave
+  this set to `t'."
+  :group 'notmuch
+  :type '(choice
+ (const :tag "Automatically calculated" t)
+ (integer :tag "Number of characters")
+ (float :tag "Fraction of window")))
+
+(defun notmuch-hello-tags-per-line (widest)
+  "Determine how many tags to show per line and how wide they
+should be. Returns a cons cell `(tags-per-line width)'."
+  (let ((tags-per-line
+(cond
+ ((integerp notmuch-hello-tag-width)
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 (max notmuch-hello-tag-width widest)
+
+ ((floatp notmuch-hello-tag-width)
+  (let* ((available-width (- (window-width) notmuch-hello-indent))
+ (proposed-width (max (* available-width 
notmuch-hello-tag-width) widest)))
+(floor available-width proposed-width)))
+
+ (t
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 widest)))
+
+(cons tags-per-line (/ (- (window-width) notmuch-hello-indent
+ (* tags-per-line (+ 7 1)))
+  tags-per-line
+
 (defun notmuch-hello-insert-tags (tag-alist widest target)
-  (let* ((tags-per-line (max 1
-(/ (- (window-width) notmuch-hello-indent)
-   ;; Count is 7 wide (6 digits plus
-   ;; space), 1 for the space after the
-   ;; name.
-   (+ 7 1 widest
+  (let* ((tags-and-width (notmuch-hello-tags-per-line widest))
+(tags-per-line (car tags-and-width))
+(widest (cdr tags-and-width))
 (count 0)
 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
 ;; Hack the display of the buttons used.
-- 
1.7.0



[PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-04-27 Thread Carl Worth
On Tue, 27 Apr 2010 15:58:39 +0100, dme at dme.org wrote:
> From: David Edmondson 
> Carl, for 0.4. You mentioned that you might like to have a single
> column of tags/saved searches, but others appear to like multiple
> columns. So, make it configurable.

A nice feature.

Some notes:

> +(defcustom notmuch-hello-tag-width t
> +  "How wide should a tag be?

At the end of 0.3 I went through and removed "hello" from all variables
exported through the customize interface. Instead we're just letting
this be the "notmuch" view in the most user-facing documentation.

(Then we can clarify other variables that affect search results or when
showing threads.)

But "Tag Width" isn't quite enough to make this variable's meaning clear
either. We do display tags at other places---in search and thread views,
for example. And this also affects the width of the "saved search"
items. So I don't have a concrete suggestion for a new name yet.

The first sentence of the documentation could be something like:

"Controls the number of columns for saved searches/tags in notmuch view."

Or something like that. The remainder of the documentation is nicely
detailed. Thank you.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-04-27 Thread dme
From: David Edmondson d...@dme.org

Add `notmuch-hello-tag-width', which has three potential sets of
values:

- t: automatically calculate the number of tags per line possible
  based on the tags to be shown and the window width,
- an integer: a lower bound on the number of characters that will
  be used to display each tag,
- a float: a fraction of the window width that is the lower bound
  on the number of characters that should be used for each tag.

So:
- if you would like two columns of tags, set this to 0.5.
- if you would like a single column of tags, set this to 1.0.
- if you would like tags to be 30 characters wide, set this to
  30.
- if you don't want to worry about all of this nonsense, leave
  this set to `t'.
---

Carl, for 0.4. You mentioned that you might like to have a single
column of tags/saved searches, but others appear to like multiple
columns. So, make it configurable.

 emacs/notmuch-hello.el |   62 +++
 1 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 378d41c..f7703d9 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -141,13 +141,63 @@ diagonal.
 (defun notmuch-saved-search-count (search)
   (car (process-lines notmuch-command count search)))
 
+(defcustom notmuch-hello-tag-width t
+  How wide should a tag be?
+
+This variable has three potential sets of values:
+
+- t: automatically calculate the number of tags per line possible
+  based on the tags to be shown and the window width,
+- an integer: a lower bound on the number of characters that will
+  be used to display each tag,
+- a float: a fraction of the window width that is the lower bound
+  on the number of characters that should be used for each tag.
+
+So:
+- if you would like two columns of tags, set this to 0.5.
+- if you would like a single column of tags, set this to 1.0.
+- if you would like tags to be 30 characters wide, set this to
+  30.
+- if you don't want to worry about all of this nonsense, leave
+  this set to `t'.
+  :group 'notmuch
+  :type '(choice
+ (const :tag Automatically calculated t)
+ (integer :tag Number of characters)
+ (float :tag Fraction of window)))
+
+(defun notmuch-hello-tags-per-line (widest)
+  Determine how many tags to show per line and how wide they
+should be. Returns a cons cell `(tags-per-line width)'.
+  (let ((tags-per-line
+(cond
+ ((integerp notmuch-hello-tag-width)
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 (max notmuch-hello-tag-width widest)
+
+ ((floatp notmuch-hello-tag-width)
+  (let* ((available-width (- (window-width) notmuch-hello-indent))
+ (proposed-width (max (* available-width 
notmuch-hello-tag-width) widest)))
+(floor available-width proposed-width)))
+
+ (t
+  (max 1
+   (/ (- (window-width) notmuch-hello-indent)
+  ;; Count is 7 wide (6 digits plus space), 1 for the space
+  ;; after the name.
+  (+ 7 1 widest)))
+
+(cons tags-per-line (/ (- (window-width) notmuch-hello-indent
+ (* tags-per-line (+ 7 1)))
+  tags-per-line
+
 (defun notmuch-hello-insert-tags (tag-alist widest target)
-  (let* ((tags-per-line (max 1
-(/ (- (window-width) notmuch-hello-indent)
-   ;; Count is 7 wide (6 digits plus
-   ;; space), 1 for the space after the
-   ;; name.
-   (+ 7 1 widest
+  (let* ((tags-and-width (notmuch-hello-tags-per-line widest))
+(tags-per-line (car tags-and-width))
+(widest (cdr tags-and-width))
 (count 0)
 (reordered-list (notmuch-hello-reflect tag-alist tags-per-line))
 ;; Hack the display of the buttons used.
-- 
1.7.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Allow tuning of the tag/saved search layout.

2010-04-27 Thread Carl Worth
On Tue, 27 Apr 2010 15:58:39 +0100, d...@dme.org wrote:
 From: David Edmondson d...@dme.org
 Carl, for 0.4. You mentioned that you might like to have a single
 column of tags/saved searches, but others appear to like multiple
 columns. So, make it configurable.

A nice feature.

Some notes:

 +(defcustom notmuch-hello-tag-width t
 +  How wide should a tag be?

At the end of 0.3 I went through and removed hello from all variables
exported through the customize interface. Instead we're just letting
this be the notmuch view in the most user-facing documentation.

(Then we can clarify other variables that affect search results or when
showing threads.)

But Tag Width isn't quite enough to make this variable's meaning clear
either. We do display tags at other places---in search and thread views,
for example. And this also affects the width of the saved search
items. So I don't have a concrete suggestion for a new name yet.

The first sentence of the documentation could be something like:

Controls the number of columns for saved searches/tags in notmuch view.

Or something like that. The remainder of the documentation is nicely
detailed. Thank you.

-Carl


pgpaux6DPoZJJ.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch