all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30737: [patch] global-abbrev-mode
@ 2018-03-06 23:27 Alex Branham
  2018-03-07 17:09 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Branham @ 2018-03-06 23:27 UTC (permalink / raw)
  To: 30737

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

It's currently not very clear how we're supposed to turn on abbrev-mode
everywhere. This patch introduces global-abbrev-mode to solve that
particular problem. I've been using this line in my init.el for a few
months without issue.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-abbrev.el-global-abbrev-mode-new-global-minor-m.patch --]
[-- Type: text/x-patch, Size: 656 bytes --]

From 4e4ab48f279c0b30708be1f0acdcd6fba85e82c2 Mon Sep 17 00:00:00 2001
From: Alex Branham <branham@utexas.edu>
Date: Tue, 6 Mar 2018 17:24:04 -0600
Subject: [PATCH] * lisp/abbrev.el (global-abbrev-mode): new global minor mode

---
 lisp/abbrev.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 197276cc9c..2719250189 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -67,6 +67,8 @@ abbrev-mode
 
 (put 'abbrev-mode 'safe-local-variable 'booleanp)
 
+(define-globalized-minor-mode global-abbrev-mode abbrev-mode abbrev-mode)
+
 \f
 (defvar edit-abbrevs-mode-map
   (let ((map (make-sparse-keymap)))
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#30737: [patch] global-abbrev-mode
  2018-03-06 23:27 bug#30737: [patch] global-abbrev-mode Alex Branham
@ 2018-03-07 17:09 ` Eli Zaretskii
  2018-03-07 17:18   ` Alex Branham
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2018-03-07 17:09 UTC (permalink / raw)
  To: Alex Branham; +Cc: 30737

> From: Alex Branham <alex.branham@gmail.com>
> Date: Tue, 06 Mar 2018 17:27:05 -0600
> 
> It's currently not very clear how we're supposed to turn on abbrev-mode
> everywhere. This patch introduces global-abbrev-mode to solve that
> particular problem. I've been using this line in my init.el for a few
> months without issue.

Does it make sense to have it turned on in every single buffer?  What
major modes do you routinely use?

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#30737: [patch] global-abbrev-mode
  2018-03-07 17:09 ` Eli Zaretskii
@ 2018-03-07 17:18   ` Alex Branham
  2018-03-07 18:03     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Branham @ 2018-03-07 17:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30737


On Wed 07 Mar 2018 at 11:09, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Alex Branham <alex.branham@gmail.com>
>> Date: Tue, 06 Mar 2018 17:27:05 -0600
>>
>> It's currently not very clear how we're supposed to turn on abbrev-mode
>> everywhere. This patch introduces global-abbrev-mode to solve that
>> particular problem. I've been using this line in my init.el for a few
>> months without issue.
>
> Does it make sense to have it turned on in every single buffer?  What
> major modes do you routinely use?

I use a mix of text modes (auctex, org, etc) and programming modes
(python, ess, etc). I find it useful to have the global abbrev table
collect common spelling mistakes or typos like teh and automatically
correct them to "the".

This was inspired by a blog post[1]. The author there recommends turning
on abbrev-mode everywhere with setq-default, but the doc string
explicitly says not to do that: "Use the command ‘abbrev-mode’ to change
this variable."


Footnotes:
[1]  http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#30737: [patch] global-abbrev-mode
  2018-03-07 17:18   ` Alex Branham
@ 2018-03-07 18:03     ` Eli Zaretskii
  2018-03-07 19:08       ` Alex Branham
  2019-06-24 20:00       ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2018-03-07 18:03 UTC (permalink / raw)
  To: Alex Branham; +Cc: 30737

> From: Alex Branham <alex.branham@gmail.com>
> Cc: 30737@debbugs.gnu.org
> Date: Wed, 07 Mar 2018 11:18:29 -0600
> 
> > Does it make sense to have it turned on in every single buffer?  What
> > major modes do you routinely use?
> 
> I use a mix of text modes (auctex, org, etc) and programming modes
> (python, ess, etc). I find it useful to have the global abbrev table
> collect common spelling mistakes or typos like teh and automatically
> correct them to "the".

But what if you have a variable in a program called "teh"?  Or, as a
more practical use case, consider this: in a few places in Emacs we
have a variable named "defalt", because using "default" gets in the
way for some reason.  Having this turned on globally will silently
"correct" these variable names, and could cause you real trouble.

This is what I fear.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#30737: [patch] global-abbrev-mode
  2018-03-07 18:03     ` Eli Zaretskii
@ 2018-03-07 19:08       ` Alex Branham
  2019-06-24 20:00       ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Branham @ 2018-03-07 19:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30737

On Wed 07 Mar 2018 at 12:03, Eli Zaretskii <eliz@gnu.org> wrote:

> But what if you have a variable in a program called "teh"?  Or, as a
> more practical use case, consider this: in a few places in Emacs we
> have a variable named "defalt", because using "default" gets in the
> way for some reason.  Having this turned on globally will silently
> "correct" these variable names, and could cause you real trouble.

That's a fair worry. Ideally, what I'd like is to be able to use these
frequent misspells in much the same was I can use flyspell such that it
turns on in text modes and in comments in prog-modes. I'm not sure how
to implement that, though.

Maybe we could modify flyspell to do these quick auto-replacements using
its own abbrev table? Or something similar to an abbrev table, since
those are per-major mode...

Alex





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#30737: [patch] global-abbrev-mode
  2018-03-07 18:03     ` Eli Zaretskii
  2018-03-07 19:08       ` Alex Branham
@ 2019-06-24 20:00       ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 20:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alex Branham, 30531, 30737

Eli Zaretskii <eliz@gnu.org> writes:

> But what if you have a variable in a program called "teh"?  Or, as a
> more practical use case, consider this: in a few places in Emacs we
> have a variable named "defalt", because using "default" gets in the
> way for some reason.  Having this turned on globally will silently
> "correct" these variable names, and could cause you real trouble.
>
> This is what I fear.

Yeah, I don't think a global abbrev mode would be generally useful, so
I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-24 20:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 23:27 bug#30737: [patch] global-abbrev-mode Alex Branham
2018-03-07 17:09 ` Eli Zaretskii
2018-03-07 17:18   ` Alex Branham
2018-03-07 18:03     ` Eli Zaretskii
2018-03-07 19:08       ` Alex Branham
2019-06-24 20:00       ` Lars Ingebrigtsen

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.