From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/78388 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.gnus.general Subject: Re: quoting code blocks in Gnus without Org functions Date: Wed, 06 Apr 2011 16:45:58 +0200 Message-ID: References: <87hbadqran.fsf@ericabrahamsen.net> <87sjtw40jh.fsf@ericabrahamsen.net> <87ipurqzjr.fsf_-_@lifelogs.com> <87sjtvpiju.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: dough.gmane.org 1302101197 27745 80.91.229.12 (6 Apr 2011 14:46:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 6 Apr 2011 14:46:37 +0000 (UTC) Cc: ding@gnus.org To: Ted Zlatanov Original-X-From: ding-owner+M26691@lists.math.uh.edu Wed Apr 06 16:46:33 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7U06-000771-0y for ding-account@gmane.org; Wed, 06 Apr 2011 16:46:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Q7Tzk-00028J-HO; Wed, 06 Apr 2011 09:46:08 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Q7Tzi-000289-UZ for ding@lists.math.uh.edu; Wed, 06 Apr 2011 09:46:06 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Q7Tzh-0003qN-OC for ding@lists.math.uh.edu; Wed, 06 Apr 2011 09:46:06 -0500 Original-Received: from prometheus.naquadah.org ([212.85.154.174] helo=mx1.naquadah.org) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Q7Tzg-00006i-VY for ding@gnus.org; Wed, 06 Apr 2011 16:46:05 +0200 Original-Received: from cigue.easter-eggs.fr (coquelicot-a.easter-eggs.com [82.235.59.105]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPSA id 8F3255C135; Wed, 6 Apr 2011 16:45:59 +0200 (CEST) Mail-Followup-To: Ted Zlatanov , ding@gnus.org In-Reply-To: <87sjtvpiju.fsf@lifelogs.com> (Ted Zlatanov's message of "Wed, 06 Apr 2011 09:21:09 -0500") User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:78388 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Apr 06 2011, Ted Zlatanov wrote: > I want to copy some text into the clipboard and then paste it into an > Emacs buffer (not necessarily Gnus). The original mode, e.g. lisp-mode, > should be considered when specifying the language of the code block. So > if I copy my function, it should look like this when pasted: > > #+begin_src lisp > (define-skeleton skeleton-src-quote > "Insert a quoted Gnus source listing" "language: " > \n > > "#+begin_src " str \n > > "(CODE GOES HERE)" \n > > "#+end_src" \n \n) > #+end_src > > ...and I'd like to do it all without using Org functionality. Is that > possible? Well, Org is only used to colorize the text rendered in Gnus, something which is transparent since Org is included in Emacs. What you want to do seems totally doable if we can have some information about which buffer comes the yank from. But I doubt this is the case. However you can still write something like (pseudo code :-)) and bind it to a key: (defun gnus-yank-code (code) (interactive (get-selection-content-if-active) (let ((buf (choose-a-buffer-using-something-like-gnus-dired-mail-buffers)) (mode (symbol-name major-mode))) (with-current-buffer buf (insert "#+begin_src " mode "\n") (insert code) (insert "+end_src"))))) =2D-=20 Julien Danjou =E2=9D=B1 http://julien.danjou.info --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJNnHymAAoJEGEbqVCLeKXC1nwP/iJzQpP/OGyKphD42IMm9QY/ egXdba/+uspxtEABPGCeSNIs5h2Qj9fV3fsCsBzLGQjkT/A3IjyP7fxOlxY4HaIT uVyKy0bHgZSPvHL2Ag+CmM2c1+YygmHtrZtxkyvY2cNHJeFpfWwoSrr8alzSV0bq 0I4fSYcfw2f1NE5WbQESBDgcmPdYpdSTWQVfGuUifnWR76D51JgIRT2uOk4pdQ4y /cWN3YmVnp/wtjNblcbmWr/Qups9dKUHqV6XSFM8OINuNPZDM159+5lGUUzPbxwr u1TiRrctgcV2u5kocNMo2v+PHO7OkHDn1MaBik+OpT74qEBlvEXIA+p3HQ69+4Mu 0MTlUt8sLNy2VgkBVT6HcmGkdEAhjWYE0E2TrtUcQIs+SfI5NuR0klwyJT6SvR6H a52dn3tLI4UtX4MHzygVzfslHGtWRnM2MIFCKrjQVF3UwtCKgfOCLhfc/kDdpFgE PFVWuvSDuVH0aShyRqMolRrr4XIFEwiBs5Ti3DeRJE952vA7oeRZYK42wQouqROY V3cguebTK8BqkhmVK+2sR3RWxYCGqjg2YjaorC9j8GYZErEWA71tvPYR9WwLb8PI b88kORMHaK0OE+3Pq97+2kP0AtF/q/ofpfCc4FzOLnOpYHVMdQUFcKJ07uRj1bhs zGDeZiVNtvuQawso7kjH =JF8/ -----END PGP SIGNATURE----- --=-=-=--