unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction
@ 2014-09-22 20:59 Tom Tromey
  2015-12-08  4:37 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2014-09-22 20:59 UTC (permalink / raw)
  To: 18533


I ran emacs -Q.
Then in *scratch*, M-x flyspell-prog-mode
Then typed `(igno<M-TAB>'

I expected this to complete to `(ignore', because point it not in a
comment or string.
However, flyspell instead changes this to `(Gino'.

In GNU Emacs 24.4.50.9 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9)
 of 2014-09-21 on bapiya
Repository revision: 117912 eggert@cs.ucla.edu-20140921224924-sd071p5m85o5v0n5
Windowing system distributor `Fedora Project', version 11.0.11404000
Configured using:
 `configure --prefix=/home/tromey/Emacs/install'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  flyspell-mode: t
  eldoc-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  desktop-save-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  savehist-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill

Recent input:
n SPC q n C-l M-g M-g M-g M-g C-u C-p C-u C-n C-u C-n 
C-p SPC 2 <return> SPC n q C-u C-n n n SPC SPC q M-g 
p SPC SPC <return> <return> <return> <return> <return> 
<return> <return> <return> <return> <return> M S-SPC 
= C-a C-s SPC . SPC C-a SPC C-u <return> q s y C-l 
q y C-c b C-c b C-z n C-x b E M <tab> <return> M-< 
C-o C-o b u g ! <return> SPC SPC s o m e SPC s t a 
r t u p SPC b u g s SPC s t i l l ? <return> b u g 
SPC w i t h SPC e l i s p - v - s SPC <backspace> <backspace> 
<backspace> s - f l y s p e l l C-x C-s SPC C-z n C-x 
b p r o j <tab> <return> C-p C-a <return> C-/ <tab> 
C-n C-n C-n C-n <tab> <tab> C-z n <return> c o m p 
i l e SPC - v s - SPC l o n g SPC l i n e s C-x C-s 
<switch-frame> C-c C-g M-x w e b j <tab> <return> e 
m <tab> C-g C-h f f l y s p e l l - p r o g <tab> <return> 
C-x o C-n C-u C-f C-f <return> C-x 1 C-u C-n C-p C-l 
M-f M-f M-b C-s C-w C-w C-w C-w C-w C-s C-s C-s C-r 
C-r C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
C-r C-r C-s C-s C-s C-l C-a C-u C-n C-p C-s f l C-s 
C-r C-r C-w C-w C-w C-w C-r C-n M-< C-v C-s C-a M-x 
r e p o r t - e m <tab> <return>

Recent messages:
Delete excess backup versions of /home/tromey/EMACS? (y or n) y
Wrote /home/tromey/EMACS
Undo!
Saving file /home/tromey/EMACS...
Wrote /home/tromey/EMACS
C-c C-g is undefined
Quit
Type C-x 1 to delete the help window.
uncompressing flyspell.el.gz...done
Mark saved where search started [2 times]

Load-path shadows:
/home/tromey/.emacs.d/elpa/css-mode-1.0/css-mode hides /home/tromey/Emacs/install/share/emacs/24.4.50/lisp/textmodes/css-mode
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/24.4.50/lisp/play/bubbles

Features:
(shadow emacsbug eieio-opt speedbar sb-image ezimage dframe webjump
misearch multi-isearch mailalias bbdb-sc supercite regi mail-hist nnir
shr-color color shr flow-fill mm-archive gnus-html browse-url xml
url-cache mm-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse url-vars bbdb-gui
bbdb-hooks mule-util sort smiley gnus-cite gnus-bcklg help-mode qp
gnus-async gnus-ml disp-table gnus-topic nndraft nnmh nnfolder utf-7
bbdb-gnus bbdb-snarf mail-extr bbdb-com warnings cl gv gnutls
network-stream starttls gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg nntp gnus-cache gnus-registry registry eieio-base
gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime dig mailcap
gnus-sum gnus-group gnus-undo smtpmail sendmail gnus-start gnus-cloud
nnimap nnmail mail-source tls utf7 netrc nnoo parse-time gnus-spec
gnus-int gnus-range gnus-win gnus gnus-ems nnheader message rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader smerge-mode
diff-mode autoconf autoconf-mode tcl goto-addr add-log make-mode js
bug-reference vc-arch vc-mtn sgml-mode vc-hg python json org-element
org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view
jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs vc-sccs vc-svn vc-cvs vc-rcs dired vc-git vc-bzr
cc-mode cc-fonts cc-guess cc-menus cc-cmds flyspell ispell eldoc
diminish projectile edmacro kmacro pkg-info find-func lisp-mnt epl grep
compile dash s appt diary-lib diary-loaddefs cal-menu calendar
cal-loaddefs which-func imenu minimap autorevert filenotify desktop
frameset cus-start cus-load status erc-services erc-list erc-menu
erc-join erc-ring erc-networks erc-pcomplete pcomplete erc-track
erc-match erc-button wid-edit cl-loaddefs cl-lib erc-fill erc-stamp
erc-netsplit erc-goodies erc erc-backend erc-compat format-spec
auth-source eieio byte-opt bytecomp byte-compile cconv eieio-core
gnus-util mm-util mail-prsvr password-cache thingatpt pp advice help-fns
vc-dir ewoc vc vc-dispatcher cc-styles cc-align cc-engine cc-vars
cc-defs bbdb timezone ange-ftp comint ansi-color ring server savehist
dwarf-mode-autoloads gdb-shell-autoloads jabber-autoloads
lisppaste-autoloads pydoc-info-autoloads info-look info easymenu
weblogger-autoloads package bbdb-autoloads time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 824342 93810)
 (symbols 48 103803 1)
 (miscs 40 41455 1409)
 (strings 32 319152 53034)
 (string-bytes 1 6841097)
 (vectors 16 95060)
 (vector-slots 8 2134901 69630)
 (floats 8 543 1030)
 (intervals 56 22343 535)
 (buffers 976 248)
 (heap 1024 95642 21310))

Tom





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

* bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction
  2014-09-22 20:59 bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction Tom Tromey
@ 2015-12-08  4:37 ` Tom Tromey
  2015-12-27 17:35   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2015-12-08  4:37 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 18533

Tom> I ran emacs -Q.
Tom> Then in *scratch*, M-x flyspell-prog-mode
Tom> Then typed `(igno<M-TAB>'

Tom> I expected this to complete to `(ignore', because point it not in a
Tom> comment or string.
Tom> However, flyspell instead changes this to `(Gino'.

FWIW I solved this to my own satisfaction by setting
flyspell-use-meta-tab to nil.  This isn't maybe quite as nice as having
the key binding automatically be aware of flyspell-prog-mode, but it's
good enough for me.

Tom





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

* bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction
  2015-12-08  4:37 ` Tom Tromey
@ 2015-12-27 17:35   ` Eli Zaretskii
  2015-12-28 20:32     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2015-12-27 17:35 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 18533

[Resending, as my original message didn't make it to the bug tracker.]

> From: Tom Tromey <tom@tromey.com>
> Date: Mon, 07 Dec 2015 23:37:42 -0500
> Cc: 18533@debbugs.gnu.org
> 
> Tom> I ran emacs -Q.
> Tom> Then in *scratch*, M-x flyspell-prog-mode
> Tom> Then typed `(igno<M-TAB>'
> 
> Tom> I expected this to complete to `(ignore', because point it not in a
> Tom> comment or string.
> Tom> However, flyspell instead changes this to `(Gino'.
> 
> FWIW I solved this to my own satisfaction by setting
> flyspell-use-meta-tab to nil.  This isn't maybe quite as nice as having
> the key binding automatically be aware of flyspell-prog-mode, but it's
> good enough for me.

Thanks, and sorry for letting this issue fall through the cracks for
so long.

Looking at the code, it sounds like the behavior you expected was
never intended to happen.  However, I found that a relatively simple
change can do what you want.  Does the patch below look reasonable?

--- lisp/textmodes/flyspell.el~4	2015-11-11 07:57:35.000000000 +0200
+++ lisp/textmodes/flyspell.el	2015-12-08 19:01:54.033105000 +0200
@@ -399,6 +399,9 @@
   (interactive)
   (setq flyspell-generic-check-word-predicate
         #'flyspell-generic-progmode-verify)
+  (setq-local flyspell--prev-meta-tab-binding
+              (or (local-key-binding "\M-\t" t)
+                  (global-key-binding "\M-\t" t)))
   (flyspell-mode 1)
   (run-hooks 'flyspell-prog-mode-hook))
 
@@ -1904,6 +1907,15 @@
   "Correct the current word.
 This command proposes various successive corrections for the current word."
   (interactive)
+  ;; If we are not in the construct where flyspell should be active,
+  ;; invoke the original binding of M-TAB, if that was recorded.
+  (if (and (local-variable-p 'flyspell--prev-meta-tab-binding)
+           (commandp flyspell--prev-meta-tab-binding t)
+           (fboundp flyspell-generic-check-word-predicate)
+           (not (funcall flyspell-generic-check-word-predicate))
+           (equal (where-is-internal 'flyspell-auto-correct-word nil t)
+                  [?\M-\t]))
+      (call-interactively flyspell--prev-meta-tab-binding)
   (let ((pos     (point))
 	(old-max (point-max)))
     ;; Use the correct dictionary.
@@ -2002,7 +2014,7 @@
 							       (point)
 							       old-max))))))))))
 	      (setq flyspell-auto-correct-pos (point))
-	      (ispell-pdict-save t)))))))
+                (ispell-pdict-save t))))))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-auto-correct-previous-pos ...                           */







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

* bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction
  2015-12-27 17:35   ` Eli Zaretskii
@ 2015-12-28 20:32     ` Tom Tromey
  2015-12-31 15:45       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2015-12-28 20:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 18533, Tom Tromey

Eli> Looking at the code, it sounds like the behavior you expected was
Eli> never intended to happen.  However, I found that a relatively simple
Eli> change can do what you want.  Does the patch below look reasonable?

Yes, thank you.

Tom





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

* bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction
  2015-12-28 20:32     ` Tom Tromey
@ 2015-12-31 15:45       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-12-31 15:45 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 18533-done

> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>,  18533@debbugs.gnu.org
> Date: Mon, 28 Dec 2015 13:32:09 -0700
> 
> Eli> Looking at the code, it sounds like the behavior you expected was
> Eli> never intended to happen.  However, I found that a relatively simple
> Eli> change can do what you want.  Does the patch below look reasonable?
> 
> Yes, thank you.

Thanks, I pushed this to the emacs-25 branch.





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

end of thread, other threads:[~2015-12-31 15:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22 20:59 bug#18533: 24.4.50; flyspell-prog-mode and lisp interaction Tom Tromey
2015-12-08  4:37 ` Tom Tromey
2015-12-27 17:35   ` Eli Zaretskii
2015-12-28 20:32     ` Tom Tromey
2015-12-31 15:45       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).