* abbrev_defs & capitalised words
@ 2019-05-24 7:41 Sharon Kimble
2019-05-24 7:55 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Sharon Kimble @ 2019-05-24 7:41 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
I'm having a big problem with new words that are added to abbrev_defs if the word I want it to be is capitalised. How can I get emacs to save it capitalised please, as its only doing it in lower-case.
Example - Sunday shows in abbrev_defs as, (or would if it was actually saved, which it isn't!)
--8<---------------cut here---------------start------------->8---
"sunday" 0 "sunday"
--8<---------------cut here---------------end--------------->8---
Thanks
Sharon.
--
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 9.9, fluxbox 1.3.7, emacs 26.2, org 9.2.3
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: abbrev_defs & capitalised words
2019-05-24 7:41 abbrev_defs & capitalised words Sharon Kimble
@ 2019-05-24 7:55 ` Eli Zaretskii
2019-05-24 11:56 ` Sharon Kimble
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2019-05-24 7:55 UTC (permalink / raw)
To: help-gnu-emacs
> From: Sharon Kimble <boudiccas@skimble.plus.com>
> Date: Fri, 24 May 2019 08:41:32 +0100
>
> I'm having a big problem with new words that are added to abbrev_defs if the word I want it to be is capitalised. How can I get emacs to save it capitalised please, as its only doing it in lower-case.
Did you read the doc string of 'define-abbrev'?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: abbrev_defs & capitalised words
2019-05-24 7:55 ` Eli Zaretskii
@ 2019-05-24 11:56 ` Sharon Kimble
2019-05-24 12:20 ` tomas
2019-05-24 12:31 ` Eli Zaretskii
0 siblings, 2 replies; 7+ messages in thread
From: Sharon Kimble @ 2019-05-24 11:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Sharon Kimble <boudiccas@skimble.plus.com>
>> Date: Fri, 24 May 2019 08:41:32 +0100
>>
>> I'm having a big problem with new words that are added to abbrev_defs if the word I want it to be is capitalised. How can I get emacs to save it capitalised please, as its only doing it in lower-case.
>
> Did you read the doc string of 'define-abbrev'?
I'm not sure what you mean, so I googled it, which led to [1], [2], and finally [3]. And I'm still not sure what you mean! But this might be what you mean, from my abbrev_defs -
--8<---------------cut here---------------start------------->8---
define-abbrev-table 'global-abbrev-table
--8<---------------cut here---------------end--------------->8---
What I'm hoping for is something that I can put in my config which will save capitalised entries into my abbrev_defs.
Thanks
Sharon.
[:1] http://www.jedsoft.org/jed/doc/jedfuns-5.html
[:2] https://stackoverflow.com/questions/19032166/how-to-abbreviate-path-in-emacs
[:3] The emacs manual (Seventeenth Edition, Updated for Emacs Version 27.0.50.) and Section 26 - Abbrevs
--
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 9.9, fluxbox 1.3.7, emacs 26.2, org 9.2.3
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: abbrev_defs & capitalised words
2019-05-24 11:56 ` Sharon Kimble
@ 2019-05-24 12:20 ` tomas
2019-05-24 17:15 ` Sharon Kimble
2019-05-24 12:31 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: tomas @ 2019-05-24 12:20 UTC (permalink / raw)
To: Sharon Kimble; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
On Fri, May 24, 2019 at 12:56:02PM +0100, Sharon Kimble wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: Sharon Kimble <boudiccas@skimble.plus.com>
> >> Date: Fri, 24 May 2019 08:41:32 +0100
> >>
> >> I'm having a big problem with new words that are added to abbrev_defs if the word I want it to be is capitalised. How can I get emacs to save it capitalised please, as its only doing it in lower-case.
> >
> > Did you read the doc string of 'define-abbrev'?
>
> I'm not sure what you mean, so I googled it, which led to [1], [2], and finally [3]. And I'm still not sure what you mean! But this might be what you mean, from my abbrev_defs -
Just start an Emacs and type C-h f (that is "describe function"). The
minubuffer asks you for a function name, you type in 'define-abbrev'
(without the quotes), then ENTER.
Alternatively, via the menu: Help -> Describe... -> Describe Function...
This will lead you to the function's documentation string.
Cheers
-- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: abbrev_defs & capitalised words
2019-05-24 11:56 ` Sharon Kimble
2019-05-24 12:20 ` tomas
@ 2019-05-24 12:31 ` Eli Zaretskii
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2019-05-24 12:31 UTC (permalink / raw)
To: help-gnu-emacs
> From: Sharon Kimble <boudiccas@skimble.plus.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Fri, 24 May 2019 12:56:02 +0100
>
> > Did you read the doc string of 'define-abbrev'?
>
> I'm not sure what you mean, so I googled it, which led to [1], [2], and finally [3]. And I'm still not sure what you mean!
I meant what Emacs shows when you type "C-h f define-abbrev RET". It
says this:
(define-abbrev TABLE NAME EXPANSION &optional HOOK &rest PROPS)
Define an abbrev in TABLE named NAME, to expand to EXPANSION and call HOOK.
NAME must be a string, and should be lower-case.
EXPANSION should usually be a string.
[...]
PROPS is a property list. The following properties are special:
- ‘:count’: the value for the abbrev’s usage-count, which is incremented each
time the abbrev is used (the default is zero).
- ‘:system’: if non-nil, says that this is a "system" abbreviation
which should not be saved in the user’s abbreviation file.
Unless ‘:system’ is ‘force’, a system abbreviation will not
overwrite a non-system abbreviation of the same name.
- ‘:case-fixed’: non-nil means that abbreviations are looked up without
case-folding, and the expansion is not capitalized/upcased.
- ‘:enable-function’: a function of no argument which returns non-nil if the
abbrev should be used for a particular call of ‘expand-abbrev’.
Note the ‘:case-fixed’ part: isn't that what you want? If so, you
could modify your abbrev_defs file to make select abbrevs have fixed
letter-case.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: abbrev_defs & capitalised words
2019-05-24 12:20 ` tomas
@ 2019-05-24 17:15 ` Sharon Kimble
2019-05-24 19:35 ` Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: Sharon Kimble @ 2019-05-24 17:15 UTC (permalink / raw)
To: tomas; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 5024 bytes --]
<tomas@tuxteam.de> writes:
> On Fri, May 24, 2019 at 12:56:02PM +0100, Sharon Kimble wrote:
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> From: Sharon Kimble <boudiccas@skimble.plus.com>
>> >> Date: Fri, 24 May 2019 08:41:32 +0100
>> >>
>> >> I'm having a big problem with new words that are added to abbrev_defs if the word I want it to be is capitalised. How can I get emacs to save it capitalised please, as its only doing it in lower-case.
>> >
>> > Did you read the doc string of 'define-abbrev'?
>>
>> I'm not sure what you mean, so I googled it, which led to [1], [2], and finally [3]. And I'm still not sure what you mean! But this might be what you mean, from my abbrev_defs -
>
> Just start an Emacs and type C-h f (that is "describe function"). The
> minubuffer asks you for a function name, you type in 'define-abbrev'
> (without the quotes), then ENTER.
>
> Alternatively, via the menu: Help -> Describe... -> Describe Function...
>
> This will lead you to the function's documentation string.
>
> Cheers
> -- t
Thanks Eli and Tomas.
I've looked at the *Help* for define-abbrevs, but not being a programmer I don't really understand it. So here is my complete spell-checking from my config, if anyone can help me tweak it to allow capitalisation to take place?
--8<---------------cut here---------------start------------->8---
** Spell-check
#+BEGIN_SRC emacs-lisp
(setq ispell-personal-dictionary "~/.emacs.d/ac-dict/my-ispell-dict")
#+END_SRC
[2019-04-18 Thu 13:15]
#+BEGIN_SRC emacs-lisp
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
#+END_SRC
[2019-04-18 Thu 06:09]
https://joelkuiper.eu/spellcheck_emacs
#+BEGIN_SRC emacs-lisp
(defun ispell-word-then-abbrev (p)
"Call `ispell-word'. Then create an abbrev for the correction made.
With prefix P, create local abbrev. Otherwise it will be global."
(interactive "P")
(let ((before (downcase (or (thing-at-point 'word) "")))
after)
(call-interactively 'ispell-word)
(setq after (downcase (or (thing-at-point 'word) "")))
(unless (string= after before)
(define-abbrev
(if p local-abbrev-table global-abbrev-table) before after))
(message "\"%s\" now expands to \"%s\" %sally."
before after (if p "loc" "glob"))))
(define-key ctl-x-map (kbd "C-i") 'ispell-word-then-abbrev)
(setq save-abbrevs t)
(setq-default abbrev-mode t)
#+END_SRC
[2019-04-18 Thu 06:10]
https://emacs.stackexchange.com/questions/2167/what-options-are-there-for-doing-spell-checking-in-emacs?rq=1
#+BEGIN_SRC emacs-lisp
(defun flyspell-buffer-after-pdict-save (&rest _)
(flyspell-buffer))
(advice-add 'ispell-pdict-save :after #'flyspell-buffer-after-pdict-save)
#+END_SRC
[2019-04-18 Thu 06:13]
https://www.emacswiki.org/emacs/FlySpell#toc6
#+BEGIN_SRC emacs-lisp
(defun flyspell-emacs-popup-textual (event poss word)
"A textual flyspell popup menu."
(require 'popup)
(let* ((corrects (if flyspell-sort-corrections
(sort (car (cdr (cdr poss))) 'string<)
(car (cdr (cdr poss)))))
(cor-menu (if (consp corrects)
(mapcar (lambda (correct)
(list correct correct))
corrects)
'()))
(affix (car (cdr (cdr (cdr poss)))))
show-affix-info
(base-menu (let ((save (if (and (consp affix) show-affix-info)
(list
(list (concat "Save affix: " (car affix))
'save)
'("Accept (session)" session)
'("Accept (buffer)" buffer))
'(("Save word" save)
("Accept (session)" session)
("Accept (buffer)" buffer)))))
(if (consp cor-menu)
(append cor-menu (cons "" save))
save)))
(menu (mapcar
(lambda (arg) (if (consp arg) (car arg) arg))
base-menu)))
(cadr (assoc (popup-menu* menu :scroll-bar t) base-menu))))
#+END_SRC
[2019-04-18 Thu 06:15]
https://www.emacswiki.org/emacs/FlySpell
https://github.com/clemera/flyspell-correct
#+BEGIN_SRC emacs-lisp
(require 'flyspell-correct-popup)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)
#+END_SRC
[2019-04-18 Thu 12:46]
--8<---------------cut here---------------end--------------->8---
Thanks
Sharon.
--
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 9.9, fluxbox 1.3.7, emacs 26.2, org 9.2.3
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: abbrev_defs & capitalised words
2019-05-24 17:15 ` Sharon Kimble
@ 2019-05-24 19:35 ` Stefan Monnier
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2019-05-24 19:35 UTC (permalink / raw)
To: help-gnu-emacs
> (add-hook hook (lambda () (flyspell-mode 1))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AKA #'flyspell-mode
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-05-24 19:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-24 7:41 abbrev_defs & capitalised words Sharon Kimble
2019-05-24 7:55 ` Eli Zaretskii
2019-05-24 11:56 ` Sharon Kimble
2019-05-24 12:20 ` tomas
2019-05-24 17:15 ` Sharon Kimble
2019-05-24 19:35 ` Stefan Monnier
2019-05-24 12:31 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).