all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to implement function copy-subword-to-irc-buffer
Date: Tue, 01 Dec 2009 23:34:21 -0700	[thread overview]
Message-ID: <hf51oj$lq$1@ger.gmane.org> (raw)
In-Reply-To: <Y9ednXLWW4GvnonWnZ2dnUVZ_oqdnZ2d@sysmatrix.net>

B. T. Raven wrote:
> I think I need (thing-at-point 'word), (buffer-list), set point and
> mark, copy-region-as-kill-no-mark, and other usual suspects to implement
> this but really want to automatically copy the substring of the word
> before point or the whole word if point is in whitespace after the word.
> This (sub)string should go to the point in the irc buffer (one whose
> buffer-name starts with #) and then make that irc buffer current.

Looking at rcirc.el, it does not look like that is a reliable method to select
"the" IRC buffer.  It actually supports multiple IRC buffers, maintained in
rcirc-buffer-alist (which is local to the server buffer, of which there may
also be more than 1).

Glossing over that for the moment, how about:

(let* ((subword (if (looking-at "\\>")
		    (thing-at-point 'word)
		  (buffer-substring (or (car (bounds-of-thing-at-point 'word))
					(point))
				    (point))))
        (buffer-list (buffer-list))
        (irc-buffer (catch 'irc-buffer
		     (while buffer-list
		       (when (and (string-match "^#"
						(buffer-name (car buffer-list)))
				  (buffer-local-value 'rcirc-server-buffer
						      (car buffer-list)))
			 (throw 'irc-buffer (car buffer-list)))
		       (setq buffer-list (cdr buffer-list))))))
   (when irc-buffer
     (funcall rcirc-switch-to-buffer-function irc-buffer)
     (insert subword)))

> Is this doable? I want to assign this function to some keychord but am
> not sure what would be suitable (in keeping with traditional key
> assignment philosophy). I have standard binding for almost every thing
> but single character cursor movement. Is there a way of getting a list
> of all key combos (and/or ranges of key combos) that are not currently
> bound?

 From the Keymaps node of the Emacs manual:

,----
|    As a user, you can redefine any key; but it is usually best to stick
| to key sequences that consist of `C-c' followed by a letter (upper or
| lower case).  These keys are "reserved for users," so they won't
| conflict with any properly designed Emacs extension.  The function keys
| <F5> through <F9> are also reserved for users.  If you redefine some
| other key, your definition may be overridden by certain extensions or
| major modes which redefine the same key.
|
`----

-- 
Kevin Rodgers
Denver, Colorado, USA





  reply	other threads:[~2009-12-02  6:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 17:39 how to implement function copy-subword-to-irc-buffer B. T. Raven
2009-12-02  6:34 ` Kevin Rodgers [this message]
     [not found] ` <mailman.12001.1259735672.2239.help-gnu-emacs@gnu.org>
2009-12-04  1:45   ` B. T. Raven
2009-12-04  5:02     ` Kevin Rodgers
     [not found]     ` <mailman.12154.1259902948.2239.help-gnu-emacs@gnu.org>
2009-12-04 21:12       ` B. T. Raven
2009-12-05  8:49         ` Kevin Rodgers
     [not found]         ` <mailman.12262.1260003007.2239.help-gnu-emacs@gnu.org>
2009-12-05 18:58           ` B. T. Raven
2009-12-05 21:25             ` Stefan Monnier
2009-12-05 21:43               ` B. T. Raven
2009-12-07 15:48                 ` Stefan Monnier
2009-12-05 21:46           ` B. T. Raven
2009-12-08  5:31             ` Kevin Rodgers

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='hf51oj$lq$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.