all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25218: flyspell.el tidy-up: remove XEmacs support and fix a spelling mistake
@ 2016-12-17 19:14 Reuben Thomas
  2016-12-17 19:26 ` Eli Zaretskii
  2016-12-19 18:45 ` Agustin Martin
  0 siblings, 2 replies; 4+ messages in thread
From: Reuben Thomas @ 2016-12-17 19:14 UTC (permalink / raw)
  To: 25218


[-- Attachment #1.1: Type: text/plain, Size: 320 bytes --]

The attached patches remove XEmacs support from flyspell.el (flyspell.el
has been an integral part of GNU Emacs for some time, so our version does
not need to support XEmacs), and renames an internal defun whose name was
incorrectly spelt: flyspell-ajust-cursor-point (ajust → adjust).

-- 
http://rrt.sc3d.org

[-- Attachment #1.2: Type: text/html, Size: 496 bytes --]

[-- Attachment #2: 0004-Remove-XEmacs-support-from-flyspell.el.patch --]
[-- Type: text/x-patch, Size: 7431 bytes --]

From 2fb5ab3e64b14d3c88cd3c4ebdf848f2dcbce3eb Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Sat, 17 Dec 2016 19:06:34 +0000
Subject: [PATCH 4/5] Remove XEmacs support from flyspell.el

lisp/textmodes/flyspell.el (flyspell-prog-mode, flyspell-mode-on):
(flyspell-word, flyspell-delete-region-overlays):
(flyspell-correct-word-before-point): Remove XEmacs support.
(flyspell-xemacs-popup): Remove XEmacs-specific defun.
---
 lisp/textmodes/flyspell.el | 111 ++-------------------------------------------
 1 file changed, 5 insertions(+), 106 deletions(-)

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 29aa231..c63508d 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -447,12 +447,7 @@ flyspell-prog-mode
 ;;*    The minor mode declaration.                                      */
 ;;*---------------------------------------------------------------------*/
 (defvar flyspell-mouse-map
-  (let ((map (make-sparse-keymap)))
-    (if (featurep 'xemacs)
-	(define-key map [button2] #'flyspell-correct-word)
-      (define-key map [down-mouse-2] #'flyspell-correct-word)
-      (define-key map [mouse-2] 'undefined))
-    map)
+  (make-sparse-keymap)
   "Keymap for Flyspell to put on erroneous words.")
 
 (defvar flyspell-mode-map
@@ -652,9 +647,7 @@ flyspell-mode-on
   ;; the welcome message
   (if (and flyspell-issue-message-flag
 	   flyspell-issue-welcome-flag
-	   (if (featurep 'xemacs)
-	       (interactive-p) ;; XEmacs does not have (called-interactively-p)
-	     (called-interactively-p 'interactive)))
+	   (called-interactively-p 'interactive))
       (let ((binding (where-is-internal 'flyspell-auto-correct-word
 					nil 'non-ascii)))
 	(message "%s"
@@ -1179,9 +1172,7 @@ flyspell-word
                   (ispell-send-string (concat "^" word "\n"))
                   ;; we mark the ispell process so it can be killed
                   ;; when emacs is exited without query
-		  (if (featurep 'xemacs)
-		      (process-kill-without-query ispell-process)
-		    (set-process-query-on-exit-flag ispell-process nil))
+		  (set-process-query-on-exit-flag ispell-process nil)
                   ;; Wait until ispell has processed word.
                   (while (progn
                            (accept-process-output ispell-process)
@@ -1716,15 +1707,7 @@ flyspell-overlay-p
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-delete-region-overlays (beg end)
   "Delete overlays used by flyspell in a given region."
-  (if (featurep 'emacs)
-      (remove-overlays beg end 'flyspell-overlay t)
-    ;; XEmacs does not have `remove-overlays'
-    (let ((l (overlays-in beg end)))
-      (while (consp l)
-	(progn
-	  (if (flyspell-overlay-p (car l))
-	      (delete-overlay (car l)))
-	  (setq l (cdr l)))))))
+  (remove-overlays beg end 'flyspell-overlay t))
 
 (defun flyspell-delete-all-overlays ()
   "Delete all the overlays used by flyspell."
@@ -2156,10 +2139,7 @@ flyspell-correct-word-before-point
 	   ((null poss)
 	    ;; ispell error
 	    (error "Ispell: error in Ispell process"))
-	   ((featurep 'xemacs)
-	    (flyspell-xemacs-popup
-	     poss word cursor-location start end opoint))
-	   (t
+           (t
 	    ;; The word is incorrect, we have to propose a replacement.
 	    (flyspell-do-correct (flyspell-emacs-popup event poss word)
 				 poss word cursor-location start end opoint)))
@@ -2170,17 +2150,12 @@ flyspell-correct-word-before-point
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-do-correct (replace poss word cursor-location start end save)
   "The popup menu callback."
-  ;; Originally, the XEmacs code didn't do the (goto-char save) here and did
-  ;; it instead right after calling the function.
   (cond ((eq replace 'ignore)
          (goto-char save)
 	 nil)
 	((eq replace 'save)
          (goto-char save)
 	 (ispell-send-string (concat "*" word "\n"))
-         ;; This was added only to the XEmacs side in revision 1.18 of
-         ;; flyspell.  I assume its absence on the Emacs side was an
-         ;; oversight.  --Stef
 	 (ispell-send-string "#\n")
 	 (flyspell-unhighlight-at cursor-location)
 	 (setq ispell-pdict-modified-p '(t)))
@@ -2197,8 +2172,6 @@ flyspell-do-correct
 	 (if (eq replace 'buffer)
 	     (ispell-add-per-file-word-list word)))
 	(replace
-         ;; This was added only to the Emacs side.  I assume its absence on
-         ;; the XEmacs side was an oversight.  --Stef
          (flyspell-unhighlight-at cursor-location)
 	 (let ((old-max (point-max))
 	       (new-word (if (atom replace)
@@ -2212,8 +2185,6 @@ flyspell-do-correct
              (funcall flyspell-insert-function new-word)
              (if flyspell-abbrev-p
                  (flyspell-define-abbrev word new-word)))
-           ;; In the original Emacs code, this was only called in the body
-           ;; of the if.  I arbitrarily kept the XEmacs behavior instead.
            (flyspell-ajust-cursor-point save cursor-location old-max)))
         (t
          (goto-char save)
@@ -2276,78 +2247,6 @@ flyspell-emacs-popup
 			     menu)))))
 
 ;;*---------------------------------------------------------------------*/
-;;*    flyspell-xemacs-popup ...                                        */
-;;*---------------------------------------------------------------------*/
-(defun flyspell-xemacs-popup (poss word cursor-location start end save)
-  "The XEmacs popup menu."
-  (let* ((corrects   (flyspell-sort (car (cdr (cdr poss))) word))
-	 (cor-menu   (if (consp corrects)
-			 (mapcar (lambda (correct)
-				   (vector correct
-					   (list 'flyspell-do-correct
-						 correct
-						 (list 'quote poss)
-						 word
-						 cursor-location
-						 start
-						 end
-						 save)
-					   t))
-				 corrects)
-		       '()))
-	 (affix      (car (cdr (cdr (cdr poss)))))
-	 show-affix-info
-	 (menu       (let ((save (if (and (consp affix) show-affix-info)
-				     (vector
-				      (concat "Save affix: " (car affix))
-				      (list 'flyspell-do-correct
-					    ''save
-					    (list 'quote poss)
-					    word
-					    cursor-location
-					    start
-					    end
-					    save)
-				      t)
-				   (vector
-				    "Save word"
-				    (list 'flyspell-do-correct
-					  ''save
-					  (list 'quote poss)
-					  word
-					  cursor-location
-					  start
-					  end
-					  save)
-				    t)))
-			   (session (vector "Accept (session)"
-					    (list 'flyspell-do-correct
-						  ''session
-						  (list 'quote poss)
-						  word
-						  cursor-location
-						  start
-						  end
-						  save)
-					    t))
-			   (buffer  (vector "Accept (buffer)"
-					    (list 'flyspell-do-correct
-						  ''buffer
-						  (list 'quote poss)
-						  word
-						  cursor-location
-						  start
-						  end
-						  save)
-					    t)))
-		       (if (consp cor-menu)
-			   (append cor-menu (list "-" save session buffer))
-			 (list save session buffer)))))
-    (popup-menu (cons (format "%s [%s]" word (or ispell-local-dictionary
-						 ispell-dictionary))
-		      menu))))
-
-;;*---------------------------------------------------------------------*/
 ;;*    Some example functions for real autocorrecting                   */
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-maybe-correct-transposition (beg end poss)
-- 
2.7.4


[-- Attachment #3: 0005-Fix-spelling-mistake-in-private-defun-name.patch --]
[-- Type: text/x-patch, Size: 2628 bytes --]

From 77226bebb4f8ba5fc1a0c6b70e3fd5e94aca1e72 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Sat, 17 Dec 2016 19:09:41 +0000
Subject: [PATCH 5/5] Fix spelling mistake in private defun name

lisp/textmodes/flyspell.el (flyspell-ajust-cursor-point): Rename to
`flyspell-adjust-cursor-point'.
---
 lisp/textmodes/flyspell.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index c63508d..bfe839a 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1949,7 +1949,7 @@ flyspell-auto-correct-word
               (funcall flyspell-insert-function word)
               (flyspell-word)
               (flyspell-display-next-corrections flyspell-auto-correct-ring))
-            (flyspell-ajust-cursor-point pos (point) old-max)
+            (flyspell-adjust-cursor-point pos (point) old-max)
             (setq flyspell-auto-correct-pos (point)))
         ;; Fetch the word to be checked.
         (let ((word (flyspell-get-word)))
@@ -2016,7 +2016,7 @@ flyspell-auto-correct-word
                                     (flyspell-word)
                                     (flyspell-display-next-corrections
                                      (cons new-word flyspell-auto-correct-ring))
-                                    (flyspell-ajust-cursor-point pos
+                                    (flyspell-adjust-cursor-point pos
                                                                  (point)
                                                                  old-max))))))))))
                 (setq flyspell-auto-correct-pos (point))
@@ -2185,15 +2185,15 @@ flyspell-do-correct
              (funcall flyspell-insert-function new-word)
              (if flyspell-abbrev-p
                  (flyspell-define-abbrev word new-word)))
-           (flyspell-ajust-cursor-point save cursor-location old-max)))
+           (flyspell-adjust-cursor-point save cursor-location old-max)))
         (t
          (goto-char save)
          nil)))
 
 ;;*---------------------------------------------------------------------*/
-;;*    flyspell-ajust-cursor-point ...                                  */
+;;*    flyspell-adjust-cursor-point ...                                  */
 ;;*---------------------------------------------------------------------*/
-(defun flyspell-ajust-cursor-point (save cursor-location old-max)
+(defun flyspell-adjust-cursor-point (save cursor-location old-max)
   (if (>= save cursor-location)
       (let ((new-pos (+ save (- (point-max) old-max))))
 	(goto-char (cond
-- 
2.7.4


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

end of thread, other threads:[~2016-12-19 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-17 19:14 bug#25218: flyspell.el tidy-up: remove XEmacs support and fix a spelling mistake Reuben Thomas
2016-12-17 19:26 ` Eli Zaretskii
2016-12-17 21:09   ` Reuben Thomas
2016-12-19 18:45 ` Agustin Martin

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.