Gnus development mailing list
 help / color / mirror / Atom feed
From: Julien Danjou <julien@danjou.info>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: ding@gnus.org
Subject: Re: quoting code blocks in Gnus without Org functions
Date: Wed, 06 Apr 2011 16:45:58 +0200	[thread overview]
Message-ID: <sa38vvn5tg9.fsf@cigue.easter-eggs.fr> (raw)
In-Reply-To: <87sjtvpiju.fsf@lifelogs.com> (Ted Zlatanov's message of "Wed, 06 Apr 2011 09:21:09 -0500")

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

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

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2011-04-06 14:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05  4:02 draft group weirdness Eric Abrahamsen
2011-04-05 10:48 ` Richard Riley
2011-04-06  0:24 ` Lars Magne Ingebrigtsen
2011-04-06  1:43   ` Eric Abrahamsen
2011-04-06 13:28     ` quoting code blocks in Gnus without Org functions (was: draft group weirdness) Ted Zlatanov
2011-04-06 14:14       ` quoting code blocks in Gnus without Org functions Julien Danjou
2011-04-06 14:21         ` Ted Zlatanov
2011-04-06 14:45           ` Julien Danjou [this message]
2011-04-06 16:24             ` Ted Zlatanov
2011-04-07  7:38               ` Julien Danjou
2011-04-07 19:57                 ` Ted Zlatanov
2011-04-07 21:20                   ` Ted Zlatanov
2011-04-08  5:52                     ` Ted Zlatanov
2011-04-08  9:34                       ` Balázs Tóth
2011-04-08  9:40                   ` Julien Danjou
2011-04-11 18:47                     ` Ted Zlatanov
2011-04-10 15:50     ` draft group weirdness Eric Abrahamsen
2011-04-11 18:39       ` Ted Zlatanov
2011-04-10 15:54     ` Eric Abrahamsen
2011-04-12 16:21       ` Lars Magne Ingebrigtsen
2011-04-12 23:02         ` Eric Abrahamsen
2011-04-12 16:19     ` Lars Magne Ingebrigtsen
2011-05-18 11:39     ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sa38vvn5tg9.fsf@cigue.easter-eggs.fr \
    --to=julien@danjou.info \
    --cc=ding@gnus.org \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).