help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: abbrev_defs & capitalised words


From: Sharon Kimble
Subject: Re: abbrev_defs & capitalised words
Date: Fri, 24 May 2019 18:15:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

<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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]