all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#20486: 24.4; ispell.el new LocalWords together with existing
@ 2015-05-02  6:46 Kevin Ryde
  2020-08-21 12:18 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2015-05-02  6:46 UTC (permalink / raw)
  To: 20486

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

When ispell.el "A" adds a new LocalWords line it always puts it at the
end of the file.  It'd be good to put it with existing such lines if
there are some.

This helps if LocalWords are deliberately not at the very end of file,
eg. before a special footer.  foo.el below shows this in an elisp file

    M-x find-file  foo.el
    M-x eval-buffer
    =>
    alas new LocalWords line after the ";;; foo.el ends here" footer

I hoped LocalWords with the existing ones would avoid upsetting the
footer bit.

I get some joy from the diff below.  The existing (open-line) and
(newline) are unchanged for the case no existing LocalWords so add at
end of file.  I'm fairly confident of my (insert "\n") when adding after
an existing LocalWords line, since since don't want `newline' to
auto-fill or otherwise mangle that line.  (But I'm ready to be persuaded
if there's some left indent or similar to apply which I don't know.)

2015-05-02  Kevin Ryde  <user42_kevin@yahoo.com.au>

	* textmodes/ispell.el (ispell-add-per-file-word-list): Add new
	LocalWords line just after existing such lines.  Good to keep words
	together or if deliberately placed somewhere special.


[-- Attachment #2: foo.el --]
[-- Type: application/emacs-lisp, Size: 380 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: ispell.el.diff --]
[-- Type: text/x-diff, Size: 1015 bytes --]

--- ispell.el.orig	2015-05-02 11:24:32.000000000 +1000
+++ ispell.el	2015-05-02 14:34:42.573950776 +1000
@@ -4320,7 +4320,7 @@
     (let (line-okay search done found)
       (while (not done)
         (let ((case-fold-search nil))
-          (setq search (search-forward ispell-words-keyword nil 'move)
+          (setq search (search-forward ispell-words-keyword nil t)
 	      found (or found search)
 	      line-okay (< (+ (length word) 1 ; 1 for space after word..
 			      (progn (end-of-line) (current-column)))
@@ -4331,8 +4331,10 @@
 	      (setq done t)
 	      (if (null search)
 		  (progn
-		    (open-line 1)
-		    (unless found (newline))
+		    (if found (insert "\n")  ;; after an existing LocalWords
+                      (goto-char (point-max)) ;; no LocalWords, go to end of file
+                      (open-line 1)
+                      (newline))
 		    (insert (if comment-start
                                 (concat
                                   (if (fboundp 'comment-padright)

[-- Attachment #4: Type: text/plain, Size: 1092 bytes --]



In GNU Emacs 24.4.1 (i586-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2015-03-08 on binet, modified by Debian
Configured using:
 `configure --build i586-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=lucid --with-toolkit-scroll-bars
 --without-gconf --without-gsettings 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro'

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

* bug#20486: 24.4; ispell.el new LocalWords together with existing
  2015-05-02  6:46 bug#20486: 24.4; ispell.el new LocalWords together with existing Kevin Ryde
@ 2020-08-21 12:18 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-21 12:18 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 20486

Kevin Ryde <user42_kevin@yahoo.com.au> writes:

> 	* textmodes/ispell.el (ispell-add-per-file-word-list): Add new
> 	LocalWords line just after existing such lines.  Good to keep words
> 	together or if deliberately placed somewhere special.

Looks good to me.  I tested with the test file, and without any
localwords, and it seems to work for me, so I've applied your patch to
Emacs 28.

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





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

end of thread, other threads:[~2020-08-21 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02  6:46 bug#20486: 24.4; ispell.el new LocalWords together with existing Kevin Ryde
2020-08-21 12:18 ` 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.