From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: how to implement function copy-subword-to-irc-buffer Date: Tue, 01 Dec 2009 23:34:21 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1259735711 847 80.91.229.12 (2 Dec 2009 06:35:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Dec 2009 06:35:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 02 07:35:04 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NFinn-0008VJ-TN for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Dec 2009 07:35:04 +0100 Original-Received: from localhost ([127.0.0.1]:57719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFinn-0008K1-Bg for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Dec 2009 01:35:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFinG-0008Jh-Ox for help-gnu-emacs@gnu.org; Wed, 02 Dec 2009 01:34:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFinA-0008Ih-68 for help-gnu-emacs@gnu.org; Wed, 02 Dec 2009 01:34:29 -0500 Original-Received: from [199.232.76.173] (port=46540 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFinA-0008Ia-1X for help-gnu-emacs@gnu.org; Wed, 02 Dec 2009 01:34:24 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:51609) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NFin9-0007b0-EU for help-gnu-emacs@gnu.org; Wed, 02 Dec 2009 01:34:23 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1NFin3-0008IE-SR for help-gnu-emacs@gnu.org; Wed, 02 Dec 2009 07:34:17 +0100 Original-Received: from c-71-237-24-138.hsd1.co.comcast.net ([71.237.24.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Dec 2009 07:34:17 +0100 Original-Received: from kevin.d.rodgers by c-71-237-24-138.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Dec 2009 07:34:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 56 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-71-237-24-138.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70300 Archived-At: 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 | through 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