From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/27290 Path: news.gmane.org!not-for-mail From: "Johan Sandblom" Newsgroups: gmane.comp.tex.context Subject: Re: emacs lisp for context in AucTeX Date: Thu, 20 Apr 2006 17:45:31 +0200 Message-ID: <97a06f070604200845u472a57cgcff7b59a724fe08d@mail.gmail.com> References: <97a06f070604200523h37a656ceh990b2565db50a85f@mail.gmail.com> Reply-To: johan.sandblom@ki.se, mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1145547958 994 80.91.229.2 (20 Apr 2006 15:45:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Apr 2006 15:45:58 +0000 (UTC) Cc: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 20 17:45:55 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1FWbLi-0007rN-0K for gctc-ntg-context-518@m.gmane.org; Thu, 20 Apr 2006 17:45:42 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8177B1279F; Thu, 20 Apr 2006 17:45:41 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15935-01; Thu, 20 Apr 2006 17:45:37 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 56DE81276F; Thu, 20 Apr 2006 17:45:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id BEE121276F for ; Thu, 20 Apr 2006 17:45:35 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 09802-09 for ; Thu, 20 Apr 2006 17:45:34 +0200 (CEST) Original-Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.230]) by ronja.ntg.nl (Postfix) with SMTP id CFEB61276B for ; Thu, 20 Apr 2006 17:45:33 +0200 (CEST) Original-Received: by wproxy.gmail.com with SMTP id i5so449224wra for ; Thu, 20 Apr 2006 08:45:31 -0700 (PDT) Original-Received: by 10.65.43.9 with SMTP id v9mr399628qbj; Thu, 20 Apr 2006 08:45:31 -0700 (PDT) Original-Received: by 10.64.232.7 with HTTP; Thu, 20 Apr 2006 08:45:31 -0700 (PDT) Original-To: "Sanjoy Mahajan" In-Reply-To: Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:27290 Archived-At: Strange that I did not run into these issues, I use GNU emacs as well, version 22.0.50.1, so presumably a difference in the versions. C-c C-f is not bound to TeX-font for me, which is odd. Sorry about the cell/cells issue, I renamed the function just before sending it. Of course it is ok to put it on the wiki (and thank you for doing that), the code can be used and altered entirely according to anyone's taste. Johan 2006/4/20, Sanjoy Mahajan : > Great. Mojca suggested that I wikify my Emacs lisp. It's now at > . Following that method ('a > method is a trick I use twice.' --Polya), I've put your elisp there too > -- hope that's okay. I removed the > > (local-set-key "$" 'start-context-math) > > so that your code can stand alone (in case people want one or the > other). > > I had to change a few things at the end (some maybe because I'm using > GNU Emacs rather than XEmacs, not sure). Below is the diff and I've > attached the resulting version. Most of the trouble was in the > keybindings: > > (local-set-key "\C-c\C-fc" 'context-insert-FLOW-cells) > > doesn't work because C-c C-f is already defined as TeX-font, so it can't > be a prefix as well. So I chose "\C-cnF". Also the function name > needed an "s" at the end. These two: > > (local-set-key "\C-cnn" 'context-insert-nattab) > (local-set-key "\C-cnr" 'context-insert-nattab-row) > > have a related problem, in that "\C-cn" is not a prefix yet, so "\C-cnn" > and "\C-cnr" are not valid sequences. So I changed the first use of > "\C-cn" as a prefix to use define-key(), which seems to make a > prefix-map automatically as I eventually learnt by inspecting tex.el. > So: > > (define-key (current-local-map) "\C-cnF" 'context-insert-FLOW-cells) > Then the following local-set-key's work. As I say, this is on Emacs > 21.4, and the tricks may be different on XEmacs. > > -Sanjoy > > --- a/tables.el 2006-04-20 10:46:16.000000000 -0400 > +++ b/tables.el 2006-04-20 10:43:41.000000000 -0400 > @@ -1,5 +1,5 @@ > (defun context-insert-nattab (rows columns) > - ;; Johan Sandblom 060128 > + ;; Johan Sandblom 2006-01-28 > "Insert a TABLE skeleton" > (interactive "nNumber of rows: \nnNumber of columns: \n") > (newline) > @@ -44,8 +44,8 @@ > (newline) > (backward-char 5)) > > -(defun context-insert-FLOW-cell (n) > - ;; Johan Sandblom 060128 > +(defun context-insert-FLOW-cells (n) > + ;; Johan Sandblom 2006-01-28 > "Insert a FLOWchart cell" > (interactive "nNumber of cells: \n") > (newline) > @@ -62,8 +62,7 @@ > > (add-hook 'ConTeXt-mode-hook > '(lambda () > - (local-set-key "\C-c\C-fc" 'context-insert-FLOW-cells) > + (define-key (current-local-map) "\C-cnF" 'context-insert-FLOW-cells) > (local-set-key "\C-cnr" 'context-insert-nattab-row) > (local-set-key "\C-cnc" 'context-insert-nattab-column) > - (local-set-key "\C-cnn" 'context-insert-nattab) > - (local-set-key "$" 'start-context-math))) > + (local-set-key "\C-cnn" 'context-insert-nattab))) > > > > -- Johan Sandblom N8, MRC, Karolinska sjh t +46851776108 17176 Stockholm m +46735521477 Sweden "What is wanted is not the will to believe, but the will to find out, which is the exact opposite" - Bertrand Russell