From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: how to implement function copy-subword-to-irc-buffer Date: Thu, 03 Dec 2009 19:45:26 -0600 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1259894458 13290 80.91.229.12 (4 Dec 2009 02:40:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Dec 2009 02:40:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 04 03:40:51 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 1NGO6D-0003Pl-B7 for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Dec 2009 03:40:49 +0100 Original-Received: from localhost ([127.0.0.1]:35456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGO6D-0002bg-0N for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Dec 2009 21:40:49 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.sysmatrix.net!news.sysmatrix.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Thu, 03 Dec 2009 19:45:03 -0600 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) Original-Newsgroups: gnu.emacs.help In-Reply-To: X-No-Archive: yes Original-Lines: 92 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 12.73.132.41 Original-X-Trace: sv3-fDvbZtSzhsSVaWcWoNFt4PrXBtwAclrF9rLgbzPHFJGSpr/UAIdD6FiKWQJfXLYgqLXZmlEniZWkgqs!pFO0hAYB8pGQluJnGzvJ8zJtN6l2GUwaC/uVURpQz3hIHJKlj63kczAbyMKpABYCw0ptg7nP8Gca!9CaTI/CnH/CwKWVXuVtvH9gmPShkQA== Original-X-Complaints-To: abuse@sysmatrix.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Original-Xref: news.stanford.edu gnu.emacs.help:175293 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 X-Gmane-Expiry: 2009-12-18 Xref: news.gmane.org gmane.emacs.help:70367 Archived-At: Kevin Rodgers wrote: > 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: I was glossing over that too. Just to get started I was planning on using the function with only one open server and channel. In fact, I probably will never need it to go to more than one irc buffer. It's just to move foreign language dictionary entries quickly into a particular channel during a live session. > > (let* ((subword (if (looking-at "\\>") > (thing-at-point 'word) ;; already the \> regex was new to me. If I C-s to the word "the" RET, ;; then point is already past the word > (buffer-substring (or (car (bounds-of-thing-at-point 'word)) > (point)) > (point)))) I can't get my mind around this either; why the (or ... ? Don't I always want car of the cons returned by bounds-of-thing-at-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))) I couldn't wrap this in a defun and get it to work because I am in ver. 22.3 Can I copy rcirc.el from /emacs23/lisp/net over to ver 22.3? If not, is it safe to just overwrite all the ver 22.3 files, directories, etc. with the equivalent ver. 23 ones. I tried to use my old .emacs with 23.1 but it wouldn't work because of (ucs-tables) in my .emacs. Anyway, thanks a lot for the code. I may have to postpone any more study of it until I dare to move everything to ver. 23. > >> 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. > | > `---- > It may be overridden but from what I know now it probably won't be. For instance if I type (at random) C-h k and then C-M S-h I find that the shifted combo has been translated to C-M h but C-h S-k (C-h K)isn't translated to C-h k. If I avoid C-M combos and known prefixes (C-x, C-h, and ESC) then most combos will be undefined (M-s, C-s, shifted versions of these, and Alt combos if there are keyboards with both Alt and Meta). Emacs didn't use to discriminate between shifted and unshifted combos but now it seems to in many contexts. I thought there might be a way to get the complement to the set of defined key bindings. Maybe there is no easy way to do that.