unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Notmuch-tree add/remove/toggle tag
@ 2014-05-06 10:39 'Mash
  2014-05-06 11:08 ` Mark Walters
  0 siblings, 1 reply; 3+ messages in thread
From: 'Mash @ 2014-05-06 10:39 UTC (permalink / raw)
  To: notmuch

I am trying to setup a tag toggle to be used in the Notmuch-tree.

I referred to "Add a key binding to add/remove/toggle a tag":  
http://notmuchmail.org/emacstips/#index8h2

Looking at "notmuch-tree.el" I noticed

(defun notmuch-tree-get-tags ()
   "Return the tags of the current message."
   (notmuch-tree-get-prop :tags))

and

(defun notmuch-tree-tag (tag-changes)
   "Change tags for the current message"
   (interactive
    (list (notmuch-read-tag-changes (notmuch-tree-get-tags) "Tag message")))
   (notmuch-tag (notmuch-tree-get-message-id) tag-changes)
   (notmuch-tree-tag-update-display tag-changes))

Which in my mind would be substituted for "notmuch-show-tag-message"  
and "notmuch-show-get-tags" respectively in the "add a toggle  
"deleted" key" example.

(define-key notmuch-tree-mode-map "d"
   (lambda ()
     "toggle deleted tag for message"
     (interactive)
     (notmuch-tree-tag
      (if (member "deleted" (notmuch-tree-get-tags))
          "-deleted" "+deleted"))))

The problem is that in notmuch-tree when I get the following message:  
"Entering debugger... button-at: Args out of range: 0" and the tag  
fails to be toggled.

Not quite sure where I am going wrong here?

Thanks,

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

* Re: Notmuch-tree add/remove/toggle tag
  2014-05-06 10:39 Notmuch-tree add/remove/toggle tag 'Mash
@ 2014-05-06 11:08 ` Mark Walters
  2014-05-06 11:18   ` 'Mash
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Walters @ 2014-05-06 11:08 UTC (permalink / raw)
  To: 'Mash, notmuch

'Mash <subscribe@toshine.net> writes:

> I am trying to setup a tag toggle to be used in the Notmuch-tree.
>
> I referred to "Add a key binding to add/remove/toggle a tag":  
> http://notmuchmail.org/emacstips/#index8h2
>
> Looking at "notmuch-tree.el" I noticed
>
> (defun notmuch-tree-get-tags ()
>    "Return the tags of the current message."
>    (notmuch-tree-get-prop :tags))
>
> and
>
> (defun notmuch-tree-tag (tag-changes)
>    "Change tags for the current message"
>    (interactive
>     (list (notmuch-read-tag-changes (notmuch-tree-get-tags) "Tag message")))
>    (notmuch-tag (notmuch-tree-get-message-id) tag-changes)
>    (notmuch-tree-tag-update-display tag-changes))
>
> Which in my mind would be substituted for "notmuch-show-tag-message"  
> and "notmuch-show-get-tags" respectively in the "add a toggle  
> "deleted" key" example.
>
> (define-key notmuch-tree-mode-map "d"
>    (lambda ()
>      "toggle deleted tag for message"
>      (interactive)
>      (notmuch-tree-tag
>       (if (member "deleted" (notmuch-tree-get-tags))
>           "-deleted" "+deleted"))))

Hi

I think you want 

       (if (member "deleted" (notmuch-tree-get-tags))
           (list "-deleted")
         (list "+deleted")))))

at the end. It looks like the wiki could do some tidying, which I will
try and have  a look at at some point.

Best wishes

Mark

>
> The problem is that in notmuch-tree when I get the following message:  
> "Entering debugger... button-at: Args out of range: 0" and the tag  
> fails to be toggled.
>
> Not quite sure where I am going wrong here?
>
> Thanks,
>
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: Notmuch-tree add/remove/toggle tag
  2014-05-06 11:08 ` Mark Walters
@ 2014-05-06 11:18   ` 'Mash
  0 siblings, 0 replies; 3+ messages in thread
From: 'Mash @ 2014-05-06 11:18 UTC (permalink / raw)
  To: Mark Walters; +Cc: notmuch


Quoting Mark Walters <markwalters1009@gmail.com>:

> 'Mash <subscribe@toshine.net> writes:
>
>> I am trying to setup a tag toggle to be used in the Notmuch-tree.
>>
>> I referred to "Add a key binding to add/remove/toggle a tag":
>> http://notmuchmail.org/emacstips/#index8h2
>>
>> Looking at "notmuch-tree.el" I noticed
>>
>> (defun notmuch-tree-get-tags ()
>>    "Return the tags of the current message."
>>    (notmuch-tree-get-prop :tags))
>>
>> and
>>
>> (defun notmuch-tree-tag (tag-changes)
>>    "Change tags for the current message"
>>    (interactive
>>     (list (notmuch-read-tag-changes (notmuch-tree-get-tags) "Tag message")))
>>    (notmuch-tag (notmuch-tree-get-message-id) tag-changes)
>>    (notmuch-tree-tag-update-display tag-changes))
>>
>> Which in my mind would be substituted for "notmuch-show-tag-message"
>> and "notmuch-show-get-tags" respectively in the "add a toggle
>> "deleted" key" example.
>>
>> (define-key notmuch-tree-mode-map "d"
>>    (lambda ()
>>      "toggle deleted tag for message"
>>      (interactive)
>>      (notmuch-tree-tag
>>       (if (member "deleted" (notmuch-tree-get-tags))
>>           "-deleted" "+deleted"))))
>
> Hi
>
> I think you want
>
>        (if (member "deleted" (notmuch-tree-get-tags))
>            (list "-deleted")
>          (list "+deleted")))))
>
> at the end. It looks like the wiki could do some tidying, which I will
> try and have  a look at at some point.
>
> Best wishes
>
> Mark

Excellent!

Many thanks for your quick response.

I am attempting to move from > 8 years of using Mutt in an Emacs Term  
to Notmuch. Slow going so far, especially trying to get the workflow  
sorted. (The reason for the move is Mutt in Emacs24 Term is  
horrifically sluggish for some reason I am yet to discover.)

I need to investigate a keybinding to go straight to notmuch-tree now.

Thanks again,

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

end of thread, other threads:[~2014-05-06 11:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06 10:39 Notmuch-tree add/remove/toggle tag 'Mash
2014-05-06 11:08 ` Mark Walters
2014-05-06 11:18   ` 'Mash

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).