all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@googlemail.com>
To: Ilya Zakharevich <ilya@math.berkeley.edu>
Cc: emacs-devel@gnu.org
Subject: Re: abbrev table in cperl-mode
Date: Fri, 16 Apr 2010 21:11:15 +0100	[thread overview]
Message-ID: <k2r20a0c1021004161311m9222fccalb84988e183fa424d@mail.gmail.com> (raw)
In-Reply-To: <20100416191207.GA9408@powdermilk.math.berkeley.edu>

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

On 16 April 2010 20:12, Ilya Zakharevich <ilya@math.berkeley.edu> wrote:
> On Fri, Apr 16, 2010 at 12:27:05PM +0100, Leo wrote:
>> Hello Ilya,
>>
>> Is it intended for the abbrevs defined in cperl-mode to be saved to the
>> abbrev file i.e. these:
>>
>> ......
>> (let ((prev-a-c abbrevs-changed))
>>     (define-abbrev-table 'cperl-mode-abbrev-table '(
>>               ("if" "if" cperl-electric-keyword 0)
>>               ("elsif" "elsif" cperl-electric-keyword 0)
>>               ("while" "while" cperl-electric-keyword 0)
>>               ("until" "until" cperl-electric-keyword 0)
>>               ("unless" "unless" cperl-electric-keyword 0)
>>               ("else" "else" cperl-electric-else 0)
>>               ("continue" "continue" cperl-electric-else 0)
>>               ("for" "for" cperl-electric-keyword 0)
>>               ("foreach" "foreach" cperl-electric-keyword 0)
>>               ("formy" "formy" cperl-electric-keyword 0)
>>               ("foreachmy" "foreachmy" cperl-electric-keyword 0)
>>               ("do" "do" cperl-electric-keyword 0)
>>               ("=pod" "=pod" cperl-electric-pod 0)
>>               ("=over" "=over" cperl-electric-pod 0)
>>               ("=head1" "=head1" cperl-electric-pod 0)
>>               ("=head2" "=head2" cperl-electric-pod 0)
>>               ("pod" "pod" cperl-electric-pod 0)
>>               ("over" "over" cperl-electric-pod 0)
>>               ("head1" "head1" cperl-electric-pod 0)
>>               ("head2" "head2" cperl-electric-pod 0)))
>>       (setq abbrevs-changed prev-a-c))
>> ......
>>
>> It seems a bit better to define them as system abbrevs.
>
> I trust your word for this.  ;-)  What you see is the "I implemented
> it the way I could - given my very limited understanding of
> abbreviation tables" approach.

Generally I think program should define system abbrevs to
differentiate from abbrevs defined by the user. And each time
define-abbrev-* runs, the abbrev definitions are overwritten anyway.

The attached patch does this. BTW, defining system abbrevs doesn't
change abbrev-changed so I leave the (let ...) out.

> Try to educate me more,
> Ilya

Leo

[-- Attachment #2: 0001-Fix-cperl-mode-abbrevs.patch --]
[-- Type: application/octet-stream, Size: 2869 bytes --]

From 45bee4e80314563243b71a710beaae7a2d8ece26 Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
Date: Fri, 16 Apr 2010 21:09:01 +0100
Subject: [PATCH] Fix cperl-mode abbrevs

---
 lisp/progmodes/cperl-mode.el |   44 ++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 2f751f2..10d5bf3 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1714,29 +1714,27 @@ or as help on variables `cperl-tips', `cperl-problems',
 			  [(control c) (control h) f])))
   (setq major-mode cperl-use-major-mode)
   (setq mode-name "CPerl")
-  (let ((prev-a-c abbrevs-changed))
-    (define-abbrev-table 'cperl-mode-abbrev-table '(
-		("if" "if" cperl-electric-keyword 0)
-		("elsif" "elsif" cperl-electric-keyword 0)
-		("while" "while" cperl-electric-keyword 0)
-		("until" "until" cperl-electric-keyword 0)
-		("unless" "unless" cperl-electric-keyword 0)
-		("else" "else" cperl-electric-else 0)
-		("continue" "continue" cperl-electric-else 0)
-		("for" "for" cperl-electric-keyword 0)
-		("foreach" "foreach" cperl-electric-keyword 0)
-		("formy" "formy" cperl-electric-keyword 0)
-		("foreachmy" "foreachmy" cperl-electric-keyword 0)
-		("do" "do" cperl-electric-keyword 0)
-		("=pod" "=pod" cperl-electric-pod 0)
-		("=over" "=over" cperl-electric-pod 0)
-		("=head1" "=head1" cperl-electric-pod 0)
-		("=head2" "=head2" cperl-electric-pod 0)
-		("pod" "pod" cperl-electric-pod 0)
-		("over" "over" cperl-electric-pod 0)
-		("head1" "head1" cperl-electric-pod 0)
-		("head2" "head2" cperl-electric-pod 0)))
-	(setq abbrevs-changed prev-a-c))
+  (define-abbrev-table 'cperl-mode-abbrev-table
+    '(("if" "if" cperl-electric-keyword 0 t)
+      ("elsif" "elsif" cperl-electric-keyword 0 t)
+      ("while" "while" cperl-electric-keyword 0 t)
+      ("until" "until" cperl-electric-keyword 0 t)
+      ("unless" "unless" cperl-electric-keyword 0 t)
+      ("else" "else" cperl-electric-else 0 t)
+      ("continue" "continue" cperl-electric-else 0 t)
+      ("for" "for" cperl-electric-keyword 0 t)
+      ("foreach" "foreach" cperl-electric-keyword 0 t)
+      ("formy" "formy" cperl-electric-keyword 0 t)
+      ("foreachmy" "foreachmy" cperl-electric-keyword 0 t)
+      ("do" "do" cperl-electric-keyword 0 t)
+      ("=pod" "=pod" cperl-electric-pod 0 t)
+      ("=over" "=over" cperl-electric-pod 0 t)
+      ("=head1" "=head1" cperl-electric-pod 0 t)
+      ("=head2" "=head2" cperl-electric-pod 0 t)
+      ("pod" "pod" cperl-electric-pod 0 t)
+      ("over" "over" cperl-electric-pod 0 t)
+      ("head1" "head1" cperl-electric-pod 0 t)
+      ("head2" "head2" cperl-electric-pod 0 t)))
   (setq local-abbrev-table cperl-mode-abbrev-table)
   (if (cperl-val 'cperl-electric-keywords)
       (abbrev-mode 1))
-- 
1.7.0.4


  reply	other threads:[~2010-04-16 20:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 11:27 abbrev table in cperl-mode Leo
2010-04-16 19:12 ` Ilya Zakharevich
2010-04-16 20:11   ` Leo [this message]
2010-04-17  4:48     ` Ilya Zakharevich
2010-04-17 11:21       ` Leo
2010-04-17 14:42       ` Stefan Monnier

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=k2r20a0c1021004161311m9222fccalb84988e183fa424d@mail.gmail.com \
    --to=sdl.web@googlemail.com \
    --cc=emacs-devel@gnu.org \
    --cc=ilya@math.berkeley.edu \
    /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.