Gnus development mailing list
 help / color / mirror / Atom feed
* Re: Add command argument to mm pipe functions
       [not found] <sa3tytf6aqf.fsf@cigue.easter-eggs.fr>
@ 2010-02-18 18:48 ` Reiner Steib
  2010-02-18 19:25   ` Julien Danjou
  0 siblings, 1 reply; 2+ messages in thread
From: Reiner Steib @ 2010-02-18 18:48 UTC (permalink / raw)
  To: Julien Danjou; +Cc: bugs, ding

On Wed, Feb 17 2010, Julien Danjou wrote:

> This patch allows to set an optional command. 

I can't find a patch in your mail.

> It's kinda handy. I can now pipe a mime message to a predefined
> command depending on the group I'm reading.

Can you give an example?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

* Re: Add command argument to mm pipe functions
  2010-02-18 18:48 ` Add command argument to mm pipe functions Reiner Steib
@ 2010-02-18 19:25   ` Julien Danjou
  0 siblings, 0 replies; 2+ messages in thread
From: Julien Danjou @ 2010-02-18 19:25 UTC (permalink / raw)
  To: Reiner Steib; +Cc: bugs, ding

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

Reiner Steib <reinersteib+gmane@imap.cc> writes:

>> This patch allows to set an optional command. 
> I can't find a patch in your mail.

Ah. Did I screw that *again*? Sorry, attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Gnus mime patch --]
[-- Type: text/x-diff, Size: 3822 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: julien@danjou.info-20100217163450-8uxnn22svu8y6v8p
# target_branch: http://bzr.savannah.gnu.org/r/emacs/trunk/
# testament_sha1: c69df82004749958febdc3c978f83c8274857efa
# timestamp: 2010-02-17 17:37:22 +0100
# base_revision_id: lekktu@gmail.com-20100214173409-8wkin7zb3gijhq8g
# 
# Begin patch
=== modified file 'lisp/gnus/gnus-art.el'
--- lisp/gnus/gnus-art.el	2010-01-13 08:35:10 +0000
+++ lisp/gnus/gnus-art.el	2010-02-17 16:34:50 +0000
@@ -4974,13 +4974,14 @@
     (when data
       (mm-save-part data))))
 
-(defun gnus-mime-pipe-part ()
-  "Pipe the MIME part under point to a process."
+(defun gnus-mime-pipe-part (&optional cmd)
+  "Pipe the MIME part under point to a process.
+Use CMD as the process."
   (interactive)
   (gnus-article-check-buffer)
   (let ((data (get-text-property (point) 'gnus-data)))
     (when data
-      (mm-pipe-part data))))
+      (mm-pipe-part data cmd))))
 
 (defun gnus-mime-view-part ()
   "Interactively choose a viewing method for the MIME part under point."

=== modified file 'lisp/gnus/mm-decode.el'
--- lisp/gnus/mm-decode.el	2010-01-13 08:35:10 +0000
+++ lisp/gnus/mm-decode.el	2010-02-17 16:34:12 +0000
@@ -1292,12 +1292,13 @@
 	  (mm-write-region (point-min) (point-max) file nil nil nil 'binary t)
 	(set-default-file-modes current-file-modes)))))
 
-(defun mm-pipe-part (handle)
-  "Pipe HANDLE to a process."
+(defun mm-pipe-part (handle &optional cmd)
+  "Pipe HANDLE to a process.
+Use CMD as the process."
   (let* ((name (mail-content-type-get (mm-handle-type handle) 'name))
-	 (command
-	  (gnus-read-shell-command
-           "Shell command on MIME part: " mm-last-shell-command)))
+	 (command (or cmd
+		      (gnus-read-shell-command
+		       "Shell command on MIME part: " mm-last-shell-command))))
     (mm-with-unibyte-buffer
       (mm-insert-part handle)
       (mm-add-meta-html-tag handle)

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWfrwwj0AAxffgFgwUWP/935n
SgC////wUAX48HFKENV0FAA4SVTQaaNAZGagADQAAAACShMFPVPekmIp4oMmTQAAAZABKIEak9Q8
UeptNTymgB6mnqNpAGmgBzAATJgATCYJhDAEYAEkQpjQCaABPU0aI1NMhpoHkgyRIJAgLgUUVcJN
kYMZ611fB7llhY+k3BgNcObWUIBsGkJ5XjovUmcWvqQKnKpc01TPWGWo1GcUVQVTX6IUyvJRaloU
ncrGOZIjaXuKV3pwmrJzrNms+jLG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oXiagG08Oj5EfRRiJASjCGRMVkWAkhDzET8qAo1ehtJG
wCoP+Pcj0AtN5oMs0HVbkBmZjXAw4zruWa5JdFtXALICYrTgWgQHA59UHTQKxfFAVULcQPggmcls
RggzKRlAXejIHLSwrLSAYEjXmu64W2LkyoKoTGDcKCcvQDCmUARS0PEgILCCA+4sRRpBMwsRDi65
gySpFkGSaB8DOKRfSC/EoX2ImytLsVonAXRBl5IDuRxJ7xhhaUOQDBKVBJEp7nCkkG8XNPw3VDBB
LabyMhFJ0JhQQIlPfFFoZQckIkSQOMXCyB6HIEj7klxGnaMFY5kA5MO9hu9BMVrFIHyFzCLbEzGD
hAgZg8RyZkExlIvpJhkEgqSmlJhXngszaKaAkeQrlp5oDodRi66kDoLyF8hQFuAkLMsNJSuSDoFc
DnFUW8UhcfSqqJmf8XckU4UJD68MI9A=

[-- Attachment #3: Type: text/plain, Size: 954 bytes --]


>> It's kinda handy. I can now pipe a mime message to a predefined
>> command depending on the group I'm reading.
>
> Can you give an example?

Sure. This is the snippet I wrote for Gnus:

;; Git apply
(defcustom jd:gnus-group-git-list
  '(("awesome"
     "$HOME/Work/src/awesome/src")
    ("xcb"
     "$HOME/Work/src/libxcb/src"))
  "A list of group / project dir match to apply git patches")

(defun jd:gnus-group-git-get-dir ()
  "Set the project git dir of the current selected group"
  (cadr
   (assoc*
    gnus-newsgroup-name
    jd:gnus-group-git-list
    :test (lambda (x y) (string-match y x)))))

(defun jd:gnus-group-git-am ()
  (interactive)
  (let ((git-dir (jd:gnus-group-git-get-dir)))
    (when git-dir
      (gnus-mime-pipe-part
       (format "git --git-dir=%s/.git am -s" git-dir)))))


<#secure method=pgpmime mode=sign>

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

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

end of thread, other threads:[~2010-02-18 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <sa3tytf6aqf.fsf@cigue.easter-eggs.fr>
2010-02-18 18:48 ` Add command argument to mm pipe functions Reiner Steib
2010-02-18 19:25   ` Julien Danjou

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).