Subject: 24.3; flyspell-correct-word-before-point produces an error with "Accept (buffer)"

From: Nicolas Richard <[email-masked]>
Date: Tue, 16 Apr 2013 13:28:15 +0200

Here is a recipe. 
1. First start emacs like this:
   $ emacs -Q --eval '(setq comment-padding 1)' --eval '(setq debug-on-error t)' -f flyspell-mode --eval '(insert "foobar")' -f flyspell-correct-word-before-point
2. Choose "Accept (buffer)" (last option) in the menu
3. ???
4. Backtrace !
   Debugger entered--Lisp error: (wrong-type-argument sequencep 1)
     comment-padright(";" 1)
     ispell-add-per-file-word-list("foobar")
     flyspell-do-correct(buffer ("foobar" 1 ("forban" "football" "forbans" "footballs" "faubers") nil) "foobar" 7 1 7 7)
     flyspell-correct-word-before-point()
     call-interactively(flyspell-correct-word-before-point nil nil)
     command-execute(flyspell-correct-word-before-point)
     command-line-1(("--eval" "(setq comment-padding 1)" "--eval" "(setq debug-on-error t)" "-f" "flyspell-mode" "--eval" "(insert \"foobar\")" "-f" "flyspell-correct-word-before-point"))
     command-line()
     normal-top-level()

That comment-padding can be an integer is explicitly in its docstring
(and is done in auctex), so I suggest the following patch according to
the docstring of comment-normalize-vars: "Lisp callers of any other
`comment-*' function should first call this function explicitly."

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 06c3cc6..53a7e87 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -4336,8 +4336,10 @@ Both should not be used to define a buffer-local dictionary."
                                   (if (fboundp 'comment-padright)
                                       ;; Try and use the proper comment marker,
                                       ;; e.g. ";;" rather than ";".
-                                      (comment-padright comment-start
-                                                        (comment-add nil))
+                                      (progn
+					(comment-normalize-vars)
+					(comment-padright comment-start
+							  (comment-add nil)))
                                     comment-start)
                                   " ")
                               "")

In GNU Emacs 24.3.1 (i686-pc-linux-gnu, Motif Version 2.3.4)
 of 2013-04-09 on geodiff-mac3
Windowing system distributor `The X.Org Foundation', version 11.0.11301000
Configured using:
 `configure '--with-x-toolkit=motif''

Important settings:
  value of $LANG: fr_FR.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  window-number-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  recentf-mode: t
  display-time-mode: t
  ido-hacks-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t <return>

Recent messages:
Loading /home/youngfrog/org/emacs.el (source)...
Loading find-lisp...done
Loading /home/youngfrog/sources/org-mode/contrib/lisp/org-contacts.el (source)...done
Loading /home/youngfrog/.recentf...done
Loading /home/youngfrog/org/emacs.el (source)...done
`flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'.
For information about GNU Emacs and the GNU system, type C-h C-a.
GNU Emacs 24.3.1 (i686-pc-linux-gnu, Motif Version 2.3.4) of 2013-04-09 on geodiff-mac3
Scanning for dabbrevs...done
user-error: No dynamic expansion for `flyspell-corre' found

Load-path shadows:
~/.emacs.d/lisp/asy-mode hides /usr/local/texlive/2012/texmf/asymptote/asy-mode
~/sources/magit/usr/local/share/emacs/site-lisp/magit-blame hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-blame
~/sources/magit/usr/local/share/emacs/site-lisp/magit-key-mode hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-key-mode
~/sources/magit/usr/local/share/emacs/site-lisp/magit-stgit hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-stgit
~/sources/magit/usr/local/share/emacs/site-lisp/magit-wip hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-wip
~/sources/magit/usr/local/share/emacs/site-lisp/magit-topgit hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-topgit
~/sources/magit/usr/local/share/emacs/site-lisp/rebase-mode hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/rebase-mode
~/sources/magit/usr/local/share/emacs/site-lisp/magit hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit
~/sources/magit/usr/local/share/emacs/site-lisp/magit-bisect hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-bisect
~/sources/magit/usr/local/share/emacs/site-lisp/magit-svn hides /home/youngfrog/.emacs.d/elpa/magit-1.2.0/magit-svn
/home/youngfrog/.emacs.d/elpa/json-1.2/json hides /usr/local/share/emacs/24.3/lisp/json
~/sources/org-mode/lisp/org-footnote hides /usr/local/share/emacs/24.3/lisp/org/org-footnote
~/sources/org-mode/lisp/ob-io hides /usr/local/share/emacs/24.3/lisp/org/ob-io
~/sources/org-mode/lisp/ob-sqlite hides /usr/local/share/emacs/24.3/lisp/org/ob-sqlite
~/sources/org-mode/lisp/ob-ditaa hides /usr/local/share/emacs/24.3/lisp/org/ob-ditaa
~/sources/org-mode/lisp/ob-ocaml hides /usr/local/share/emacs/24.3/lisp/org/ob-ocaml
~/sources/org-mode/lisp/org-irc hides /usr/local/share/emacs/24.3/lisp/org/org-irc
~/sources/org-mode/lisp/ob-eval hides /usr/local/share/emacs/24.3/lisp/org/ob-eval
~/sources/org-mode/lisp/ob-scheme hides /usr/local/share/emacs/24.3/lisp/org/ob-scheme
~/sources/org-mode/lisp/org-capture hides /usr/local/share/emacs/24.3/lisp/org/org-capture
~/sources/org-mode/lisp/org-table hides /usr/local/share/emacs/24.3/lisp/org/org-table
~/sources/org-mode/lisp/ob-exp hides /usr/local/share/emacs/24.3/lisp/org/ob-exp
~/sources/org-mode/lisp/org-eshell hides /usr/local/share/emacs/24.3/lisp/org/org-eshell
~/sources/org-mode/lisp/org-inlinetask hides /usr/local/share/emacs/24.3/lisp/org/org-inlinetask
~/sources/org-mode/lisp/ob-sql hides /usr/local/share/emacs/24.3/lisp/org/ob-sql
~/sources/org-mode/lisp/ob-emacs-lisp hides /usr/local/share/emacs/24.3/lisp/org/ob-emacs-lisp
~/sources/org-mode/contrib/lisp/org-vm hides /usr/local/share/emacs/24.3/lisp/org/org-vm
~/sources/org-mode/lisp/org-list hides /usr/local/share/emacs/24.3/lisp/org/org-list
~/sources/org-mode/lisp/org-colview hides /usr/local/share/emacs/24.3/lisp/org/org-colview
~/sources/org-mode/lisp/ob-perl hides /usr/local/share/emacs/24.3/lisp/org/ob-perl
~/sources/org-mode/lisp/org-agenda hides /usr/local/share/emacs/24.3/lisp/org/org-agenda
~/sources/org-mode/lisp/ob-keys hides /usr/local/share/emacs/24.3/lisp/org/ob-keys
~/sources/org-mode/lisp/org-element hides /usr/local/share/emacs/24.3/lisp/org/org-element
~/sources/org-mode/lisp/ob-table hides /usr/local/share/emacs/24.3/lisp/org/ob-table
~/sources/org-mode/lisp/org-compat hides /usr/local/share/emacs/24.3/lisp/org/org-compat
~/sources/org-mode/lisp/org-mobile hides /usr/local/share/emacs/24.3/lisp/org/org-mobile
~/sources/org-mode/lisp/ob-comint hides /usr/local/share/emacs/24.3/lisp/org/ob-comint
~/sources/org-mode/lisp/org-src hides /usr/local/share/emacs/24.3/lisp/org/org-src
~/sources/org-mode/lisp/org-crypt hides /usr/local/share/emacs/24.3/lisp/org/org-crypt
~/sources/org-mode/lisp/org-info hides /usr/local/share/emacs/24.3/lisp/org/org-info
~/sources/org-mode/lisp/ob-maxima hides /usr/local/share/emacs/24.3/lisp/org/ob-maxima
~/sources/org-mode/lisp/org-ctags hides /usr/local/share/emacs/24.3/lisp/org/org-ctags
~/sources/org-mode/lisp/org-habit hides /usr/local/share/emacs/24.3/lisp/org/org-habit
~/sources/org-mode/lisp/ob hides /usr/local/share/emacs/24.3/lisp/org/ob
~/sources/org-mode/lisp/org-datetree hides /usr/local/share/emacs/24.3/lisp/org/org-datetree
~/sources/org-mode/lisp/org-clock hides /usr/local/share/emacs/24.3/lisp/org/org-clock
~/sources/org-mode/lisp/org-bbdb hides /usr/local/share/emacs/24.3/lisp/org/org-bbdb
~/sources/org-mode/lisp/ob-fortran hides /usr/local/share/emacs/24.3/lisp/org/ob-fortran
~/sources/org-mode/lisp/ob-picolisp hides /usr/local/share/emacs/24.3/lisp/org/ob-picolisp
~/sources/org-mode/contrib/lisp/org-wl hides /usr/local/share/emacs/24.3/lisp/org/org-wl
~/sources/org-mode/lisp/org-gnus hides /usr/local/share/emacs/24.3/lisp/org/org-gnus
~/sources/org-mode/lisp/ob-clojure hides /usr/local/share/emacs/24.3/lisp/org/ob-clojure
~/sources/org-mode/contrib/lisp/org-mew hides /usr/local/share/emacs/24.3/lisp/org/org-mew
~/sources/org-mode/lisp/org-attach hides /usr/local/share/emacs/24.3/lisp/org/org-attach
~/sources/org-mode/lisp/ob-tangle hides /usr/local/share/emacs/24.3/lisp/org/ob-tangle
~/sources/org-mode/lisp/org-protocol hides /usr/local/share/emacs/24.3/lisp/org/org-protocol
~/sources/org-mode/lisp/org-indent hides /usr/local/share/emacs/24.3/lisp/org/org-indent
~/sources/org-mode/lisp/org-install hides /usr/local/share/emacs/24.3/lisp/org/org-install
~/sources/org-mode/lisp/ob-org hides /usr/local/share/emacs/24.3/lisp/org/ob-org
~/sources/org-mode/lisp/org-docview hides /usr/local/share/emacs/24.3/lisp/org/org-docview
~/sources/org-mode/lisp/org-rmail hides /usr/local/share/emacs/24.3/lisp/org/org-rmail
~/sources/org-mode/lisp/ob-mscgen hides /usr/local/share/emacs/24.3/lisp/org/ob-mscgen
~/sources/org-mode/lisp/org-plot hides /usr/local/share/emacs/24.3/lisp/org/org-plot
~/sources/org-mode/lisp/ob-haskell hides /usr/local/share/emacs/24.3/lisp/org/ob-haskell
~/sources/org-mode/lisp/org-timer hides /usr/local/share/emacs/24.3/lisp/org/org-timer
~/sources/org-mode/lisp/ob-ledger hides /usr/local/share/emacs/24.3/lisp/org/ob-ledger
~/sources/org-mode/lisp/org-mhe hides /usr/local/share/emacs/24.3/lisp/org/org-mhe
~/sources/org-mode/lisp/org-entities hides /usr/local/share/emacs/24.3/lisp/org/org-entities
~/sources/org-mode/lisp/ob-C hides /usr/local/share/emacs/24.3/lisp/org/ob-C
~/sources/org-mode/lisp/org-mouse hides /usr/local/share/emacs/24.3/lisp/org/org-mouse
~/sources/org-mode/lisp/ob-lisp hides /usr/local/share/emacs/24.3/lisp/org/ob-lisp
~/sources/org-mode/lisp/org-archive hides /usr/local/share/emacs/24.3/lisp/org/org-archive
~/sources/org-mode/lisp/ob-python hides /usr/local/share/emacs/24.3/lisp/org/ob-python
~/sources/org-mode/lisp/ob-ref hides /usr/local/share/emacs/24.3/lisp/org/ob-ref
~/sources/org-mode/lisp/ob-gnuplot hides /usr/local/share/emacs/24.3/lisp/org/ob-gnuplot
~/sources/org-mode/lisp/ob-sass hides /usr/local/share/emacs/24.3/lisp/org/ob-sass
~/sources/org-mode/lisp/ob-sh hides /usr/local/share/emacs/24.3/lisp/org/ob-sh
~/sources/org-mode/lisp/ob-octave hides /usr/local/share/emacs/24.3/lisp/org/ob-octave
~/sources/org-mode/lisp/org-pcomplete hides /usr/local/share/emacs/24.3/lisp/org/org-pcomplete
~/sources/org-mode/contrib/lisp/org-w3m hides /usr/local/share/emacs/24.3/lisp/org/org-w3m
~/sources/org-mode/lisp/org-feed hides /usr/local/share/emacs/24.3/lisp/org/org-feed
~/sources/org-mode/lisp/ob-calc hides /usr/local/share/emacs/24.3/lisp/org/ob-calc
~/sources/org-mode/lisp/ob-shen hides /usr/local/share/emacs/24.3/lisp/org/ob-shen
~/sources/org-mode/lisp/org-mac-message hides /usr/local/share/emacs/24.3/lisp/org/org-mac-message
~/sources/org-mode/lisp/ob-plantuml hides /usr/local/share/emacs/24.3/lisp/org/ob-plantuml
~/sources/org-mode/lisp/org-version hides /usr/local/share/emacs/24.3/lisp/org/org-version
~/sources/org-mode/lisp/ob-R hides /usr/local/share/emacs/24.3/lisp/org/ob-R
~/sources/org-mode/lisp/ob-asymptote hides /usr/local/share/emacs/24.3/lisp/org/ob-asymptote
~/sources/org-mode/lisp/ob-latex hides /usr/local/share/emacs/24.3/lisp/org/ob-latex
~/sources/org-mode/lisp/ob-dot hides /usr/local/share/emacs/24.3/lisp/org/ob-dot
~/sources/org-mode/lisp/ob-matlab hides /usr/local/share/emacs/24.3/lisp/org/ob-matlab
~/sources/org-mode/lisp/ob-ruby hides /usr/local/share/emacs/24.3/lisp/org/ob-ruby
~/sources/org-mode/lisp/org-id hides /usr/local/share/emacs/24.3/lisp/org/org-id
~/sources/org-mode/lisp/ob-java hides /usr/local/share/emacs/24.3/lisp/org/ob-java
~/sources/org-mode/lisp/org-faces hides /usr/local/share/emacs/24.3/lisp/org/org-faces
~/sources/org-mode/lisp/ob-css hides /usr/local/share/emacs/24.3/lisp/org/ob-css
~/sources/org-mode/lisp/org-bibtex hides /usr/local/share/emacs/24.3/lisp/org/org-bibtex
~/sources/org-mode/lisp/ob-screen hides /usr/local/share/emacs/24.3/lisp/org/ob-screen
~/sources/org-mode/lisp/org hides /usr/local/share/emacs/24.3/lisp/org/org
~/sources/org-mode/lisp/ob-scala hides /usr/local/share/emacs/24.3/lisp/org/ob-scala
~/sources/org-mode/lisp/ob-lob hides /usr/local/share/emacs/24.3/lisp/org/ob-lob
~/sources/org-mode/lisp/org-macs hides /usr/local/share/emacs/24.3/lisp/org/org-macs
~/sources/org-mode/lisp/ob-awk hides /usr/local/share/emacs/24.3/lisp/org/ob-awk
~/sources/org-mode/lisp/ob-lilypond hides /usr/local/share/emacs/24.3/lisp/org/ob-lilypond
~/sources/org-mode/lisp/ob-js hides /usr/local/share/emacs/24.3/lisp/org/ob-js
~/sources/org-mode/lisp/org-loaddefs hides /usr/local/share/emacs/24.3/lisp/org/org-loaddefs

Features:
(shadow sort mail-extr dabbrev emacsbug sendmail paredit window-number
twittering-mode epa derived epg tls url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util xml pcase ob-sh
shell windmove latexenc paren doc-view jka-compr image-mode uniquify
recentf tree-widget org-contacts org-capture org-agenda gnus-art mm-uu
mml2015 epg-config mm-view mml-smime smime dig mailcap gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int
gnus-range message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win gnus gnus-ems nnheader mail-utils wid-edit find-lisp
dired org-inlinetask org warnings org-macro org-footnote org-pcomplete
pcomplete org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs
format-spec find-func cal-menu calendar cal-loaddefs cl-macs gv time
ffap url-parse auth-source eieio byte-opt bytecomp byte-compile cconv
gnus-util mm-util mail-prsvr password-cache url-vars edmacro kmacro cl
50magit two-mode-mode tex-site auto-loads org-loaddefs ido-hacks advice
help-fns cl-lib advice-preload easy-mmode ido ampc-autoloads
auto-dim-other-buffers-autoloads boxquote-autoloads circe-autoloads
crosshairs-autoloads col-highlight-autoloads csv-mode-autoloads
debbugs-autoloads dictionary-autoloads dropbox-autoloads
dtrt-indent-autoloads elpy-autoloads auto-complete-autoloads
fic-ext-mode-autoloads fuzzy-autoloads google-translate-autoloads
hackernews-autoloads haskell-mode-autoloads
highlight-indentation-autoloads hl-line+-autoloads js2-mode-autoloads
json-autoloads lcs-autoloads log4j-mode-autoloads lui-autoloads
lusty-explorer-autoloads magit-autoloads mo-git-blame-autoloads
multiple-cursors-autoloads nlinum-autoloads oauth-autoloads
paredit-autoloads pastebin-autoloads pcsv-autoloads popup-autoloads
pretty-mode-autoloads pymacs-autoloads python-mode-autoloads
pyvirtualenv-autoloads rainbow-mode-autoloads rebox2-autoloads
s-autoloads slime-autoloads smartparens-autoloads dash-autoloads
smex-autoloads tracking-autoloads typing-autoloads undo-tree-autoloads
vline-autoloads w3-autoloads info easymenu window-number-autoloads
workspaces-autoloads wtf-autoloads yasnippet-autoloads
zen-and-art-theme-autoloads package server time-date tooltip 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 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 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 dynamic-setting
system-font-setting font-render-setting motif x-toolkit x multi-tty
emacs)