From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-devel@gnu.org
Subject: Re: (local) abbrev injective and other problems, capitalization
Date: Thu, 05 Jul 2018 12:15:47 +0200 [thread overview]
Message-ID: <874lhe3s4s.fsf@mat.ucm.es> (raw)
In-Reply-To: jwvsh4z17jq.fsf-monnier+gmane.emacs.devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 2325 bytes --]
>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> So it seems that :case-fixed is the solution. But how do I use is for
>> inverse-add-mode-abbrev and friends?
> You'll need to tweak the code and/or write your own, I'm afraid.
Ok. I am not really using inverse-add-mode-abbrev but I use the abbrev
via flyspell. Flyspell allows you to insert a correction either in the
local (which is my case) or in the global abbrev table.
I have even written a small package my own, which I might put some day
in MELPA, which generalise this mechanism to various languages. Most
likely this is not very elegant but for each language there exists a
minor mode with its associated local abbrev table (right now the package
contains 5 language but it could be generalised). The point which is a
bit delicate is, that if you switch one minor mode on, you have to make
sure that the others are off.
So here is a short example
(define-abbrev-table 'francais-minor-mode-abbrev-table '( ;Version:1.2
("tx" "text" nil 0)
))
(defvar francais-minor-mode-syntax-table nil
"Syntax table used while in francais mode.")
(define-minor-mode francais-minor-mode
nil nil nil nil
(setq local-abbrev-table
(if francais-minor-mode
francais-minor-mode-abbrev-table)))
And some function which are not relevant here.
In any case, the code most relevant here is the following
(defun flyspell-define-abbrev (name expansion)
(let ((table (flyspell-abbrev-table)))
(when table
(define-abbrev table (downcase name) expansion ))))
So first the phrase to be abbrev-expanded is downcased and then defined.
My first naive approach was this
(define-abbrev table (downcase name) expansion nil :case-fixed nil))))(defun flyspell-define-abbrev (name expansion)
(let ((table (flyspell-abbrev-table)))
(when table
(define-abbrev table (downcase name) expansion nil :case-fixed nil))))
But it did not work.
I then tried
(abbrev-table-put text-mode-abbrev-table :case-fixed t)
Or
(abbrev-table-put francais-minor-mode-syntax-table :case-fixed t)
But it did not help. The problem described persisted. Any help would be
appreciate because right now I don't know where to start even.
Uwe
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
next prev parent reply other threads:[~2018-07-05 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 7:25 (local) abbrev injective and other problems, capitalization Uwe Brauer
2018-07-03 22:01 ` Stefan Monnier
2018-07-04 6:27 ` Uwe Brauer
2018-07-04 13:01 ` Stefan Monnier
2018-07-05 10:15 ` Uwe Brauer [this message]
2018-07-10 4:06 ` 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=874lhe3s4s.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--cc=emacs-devel@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.