Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* binding a summary key to *two* commands
@ 2015-01-20 17:54 Hikaru Ichijyo
  2015-01-20 18:08 ` Adam Sjøgren
       [not found] ` <mailman.18212.1421777358.1147.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Hikaru Ichijyo @ 2015-01-20 17:54 UTC (permalink / raw)
  To: info-gnus-english

Anyone have any idea how I could make *two* summary buffer commands emit
from one keystroke?  I've tried the snippet below, but it's giving me
errors about the wrong number of arguments.  Basically, I'm trying to
make "D" expire and read next unread, while "d" just expires and moves
forward without reading.  The only part not working here is the "D".


(defun delete-then-read-next ()
  (interactive)
  (gnus-summary-mark-as-expirable)
  (gnus-summary-next-unread-article)
)
(add-to-list 'mm-attachment-override-types "image/.*")
(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
(add-hook 'gnus-summary-mode-hook (lambda ()
    (local-set-key "D" 'delete-then-read-next)
    (local-set-key "d" 'gnus-summary-put-mark-as-expirable-next)
    (local-set-key "u" 'gnus-summary-clear-mark-forward)
    (local-set-key "x" 'gnus-summary-expire-articles)
    (local-set-key "s" 'gnus-summary-move-article)))

-- 
He that would make his own liberty secure must guard even his enemy from
oppression; for if he violates this duty, he establishes a precedent
that will reach to himself.
					--Thomas Paine

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

* Re: binding a summary key to *two* commands
  2015-01-20 17:54 binding a summary key to *two* commands Hikaru Ichijyo
@ 2015-01-20 18:08 ` Adam Sjøgren
       [not found] ` <mailman.18212.1421777358.1147.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Sjøgren @ 2015-01-20 18:08 UTC (permalink / raw)
  To: info-gnus-english

Hikaru writes:

> (defun delete-then-read-next ()
>   (interactive)
>   (gnus-summary-mark-as-expirable)

Have you tried giving this function an argument (say 1)?

Just a guess from reading the documentation of it:

,----[ C-h f gnus-summary-mark-as-expirable RET ]
| gnus-summary-mark-as-expirable is an interactive compiled Lisp
| function in `gnus-sum.el'.
| 
| (gnus-summary-mark-as-expirable N)
| 
| Mark N articles forward as expirable.
| If N is negative, mark backward instead.  The difference between N and
| the actual number of articles marked is returned.
`----



  Best regards,

    Adam

-- 
 "My brain always rejects attitude transplants."              Adam Sjøgren
                                                         asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

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

* Re: binding a summary key to *two* commands
       [not found] ` <mailman.18212.1421777358.1147.info-gnus-english@gnu.org>
@ 2015-01-20 22:11   ` Hikaru Ichijyo
  2015-01-21  3:43   ` Hikaru Ichijyo
  1 sibling, 0 replies; 5+ messages in thread
From: Hikaru Ichijyo @ 2015-01-20 22:11 UTC (permalink / raw)
  To: info-gnus-english

asjo@koldfront.dk (Adam Sjøgren) writes:

> Hikaru writes:
>
>> (defun delete-then-read-next ()
>>   (interactive)
>>   (gnus-summary-mark-as-expirable)
>
> Have you tried giving this function an argument (say 1)?
>
> Just a guess from reading the documentation of it:
>
> ,----[ C-h f gnus-summary-mark-as-expirable RET ]
> | gnus-summary-mark-as-expirable is an interactive compiled Lisp
> | function in `gnus-sum.el'.
> | 
> | (gnus-summary-mark-as-expirable N)
> | 
> | Mark N articles forward as expirable.
> | If N is negative, mark backward instead.  The difference between N and
> | the actual number of articles marked is returned.

Yes, that's it exactly, thanks.

-- 
He that would make his own liberty secure must guard even his enemy from
oppression; for if he violates this duty, he establishes a precedent
that will reach to himself.
					--Thomas Paine
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

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

* Re: binding a summary key to *two* commands
       [not found] ` <mailman.18212.1421777358.1147.info-gnus-english@gnu.org>
  2015-01-20 22:11   ` Hikaru Ichijyo
@ 2015-01-21  3:43   ` Hikaru Ichijyo
  2015-01-22 22:53     ` Emanuel Berg
  1 sibling, 1 reply; 5+ messages in thread
From: Hikaru Ichijyo @ 2015-01-21  3:43 UTC (permalink / raw)
  To: info-gnus-english

Ok, the function I was trying to make, debugged, in case anyone wants
it.  If you press "d", it sets the expirable mark and moves forward
without reading the next message (good if you're in the middle of a lot
of trash messages); if you press "D", it sets expirable and reads the
next one (good if you're in a lot of message you want to read but not
keep).  When RET is pressed in the Summary buffer on an article that
isn't yet being displayed, it calls gnus-summary-scroll-up, which only
does what it's name says if the article had already been displayed.  If
not (as in this case), it reads the article under point in the Summary.


(defun delete-then-read-next ()
  (interactive)
  (gnus-summary-mark-as-expirable 1)
  (gnus-summary-scroll-up 1)
)
(add-hook 'gnus-summary-mode-hook (lambda ()
    (local-set-key "D" 'delete-then-read-next)
    (local-set-key "d" 'gnus-summary-put-mark-as-expirable-next)
    (local-set-key "u" 'gnus-summary-clear-mark-forward)
    (local-set-key "x" 'gnus-summary-expire-articles)
    (local-set-key "s" 'gnus-summary-move-article)))

-- 
He that would make his own liberty secure must guard even his enemy from
oppression; for if he violates this duty, he establishes a precedent
that will reach to himself.
					--Thomas Paine

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

* Re: binding a summary key to *two* commands
  2015-01-21  3:43   ` Hikaru Ichijyo
@ 2015-01-22 22:53     ` Emanuel Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Emanuel Berg @ 2015-01-22 22:53 UTC (permalink / raw)
  To: info-gnus-english

Hikaru Ichijyo <ichijyo@macross.sdf.jp> writes:

> Ok, the function I was trying to make, debugged, in
> case anyone wants it.

That's exactly right!

1. Write a defun that is (interactive).

2. Stack the commands as you have been using them up
   to today.

3. Use the help for each command or compile the Elisp
   to learn if some command is available in some
   other, better form.

4. Re-bind the old key to your new defun.

Plain and simple. Sometimes...

-- 
underground experts united

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

end of thread, other threads:[~2015-01-22 22:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 17:54 binding a summary key to *two* commands Hikaru Ichijyo
2015-01-20 18:08 ` Adam Sjøgren
     [not found] ` <mailman.18212.1421777358.1147.info-gnus-english@gnu.org>
2015-01-20 22:11   ` Hikaru Ichijyo
2015-01-21  3:43   ` Hikaru Ichijyo
2015-01-22 22:53     ` Emanuel Berg

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 NNTP newsgroup(s).