emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auctex 52e1426 02/43: Remove XEmacs compatibility code


From: Tassilo Horn
Subject: [elpa] externals/auctex 52e1426 02/43: Remove XEmacs compatibility code in latex.el
Date: Tue, 20 Mar 2018 11:34:05 -0400 (EDT)

branch: externals/auctex
commit 52e142662de8f4643a3682138c8612ae58169be8
Author: Mosè Giordano <address@hidden>
Commit: Mosè Giordano <address@hidden>

    Remove XEmacs compatibility code in latex.el
    
    * latex.el (LaTeX-largest-level-set):
    (LaTeX-after-insert-env-hook):
    (LaTeX-indent-line):
    (LaTeX-fill-region-as-paragraph):
    (LaTeX-fill-newline):
    (LaTeX-common-initialization): Remove code for compatibility with XEmacs.
    (LaTeX-fill-delete-newlines): Remove function, no more needed.
    (LaTeX-fill-region-as-para-do): Replace `LaTeX-fill-delete-newlines' with
    `fill-delete-newlines'.
---
 latex.el | 168 ++++++++-------------------------------------------------------
 1 file changed, 21 insertions(+), 147 deletions(-)

diff --git a/latex.el b/latex.el
index fa2ae34..37c77b4 100644
--- a/latex.el
+++ b/latex.el
@@ -296,9 +296,7 @@ Additionally the function will invalidate the section 
submenu in
 order to let the menu filter regenerate it."
   (setq LaTeX-largest-level (LaTeX-section-level section))
   (let ((offset (LaTeX-outline-offset)))
-    (when (and (> offset 0)
-              ;; XEmacs does not know `outline-heading-alist'.
-              (boundp 'outline-heading-alist))
+    (when (> offset 0)
       (let (lst)
        (dolist (tup outline-heading-alist)
          (setq lst (cons (cons (car tup)
@@ -645,9 +643,7 @@ With prefix-argument, reopen environment afterwards."
                         marker))
        (move-marker marker nil)))))
 
-(if (featurep 'xemacs)
-    (define-obsolete-variable-alias 'LaTeX-after-insert-env-hooks 
'LaTeX-after-insert-env-hook)
-  (define-obsolete-variable-alias 'LaTeX-after-insert-env-hooks 
'LaTeX-after-insert-env-hook "11.89"))
+(define-obsolete-variable-alias 'LaTeX-after-insert-env-hooks 
'LaTeX-after-insert-env-hook "11.89")
 
 (defvar LaTeX-after-insert-env-hook nil
   "List of functions to be run at the end of `LaTeX-insert-environment'.
@@ -3223,23 +3219,7 @@ Lines starting with an item is given an extra 
indentation of
                 (looking-at
                  (concat "\\([ \t]*" TeX-comment-start-regexp "+\\)+"))
                 (concat (match-string 0) (TeX-comment-padding-string)))))
-        (overlays (when (featurep 'xemacs)
-                    ;; Isn't that fun?  In Emacs an `(overlays-at
-                    ;; (line-beginning-position))' would do the
-                    ;; trick.  How boring.
-                    (extent-list
-                     nil (line-beginning-position) (line-beginning-position)
-                     'all-extents-closed-open 'overlay)))
         ol-specs)
-    ;; XEmacs' `indent-to' function (at least in version 21.4.15) has
-    ;; a bug which leads to the insertion of whitespace in front of an
-    ;; invisible overlay.  So during indentation we temporarily remove
-    ;; the 'invisible property.
-    (dolist (ol overlays)
-      (when (extent-property ol 'invisible)
-        (pushnew (list ol (extent-property ol 'invisible))
-                 ol-specs :test #'equal)
-       (set-extent-property ol 'invisible nil)))
     (save-excursion
       (cond ((and fill-prefix
                  (TeX-in-line-comment)
@@ -3584,16 +3564,7 @@ not be subject to filling."
   :group 'LaTeX
   :type '(repeat string))
 
-(defvar LaTeX-nospace-between-char-regexp
-  (if (featurep 'xemacs)
-    (if (and (boundp 'word-across-newline) word-across-newline)
-       word-across-newline
-      ;; NOTE: Ensure not to have a value of nil for such a rare case that
-      ;; somebody removes the mule test in `LaTeX-fill-delete-newlines' so that
-      ;; it could match only "\n" and this could lead to problem.  XEmacs does
-      ;; not have a category `\c|' and `\ct' means `Chinese Taiwan' in XEmacs.
-      "\\(\\cj\\|\\cc\\|\\ct\\)")
-    "\\c|")
+(defvar LaTeX-nospace-between-char-regexp "\\c|"
   "Regexp matching a character where no interword space is necessary.
 Words formed by such characters can be broken across newlines.")
 
@@ -3783,7 +3754,7 @@ space does not end a sentence, so don't break a line 
there."
        ;; FROM, and point, are now before the text to fill,
        ;; but after any fill prefix on the first line.
 
-       (LaTeX-fill-delete-newlines from to justify nosqueeze squeeze-after)
+       (fill-delete-newlines from to justify nosqueeze squeeze-after)
 
        ;; This is the actual FILLING LOOP.
        (goto-char from)
@@ -3875,100 +3846,9 @@ space does not end a sentence, so don't break a line 
there."
       ;; Return the fill-prefix we used
       fill-prefix)))
 
-;; Following lines are copied from `fill.el' (CVS Emacs, March 2005).
-;;   The `fill-space' property carries the string with which a newline should 
be
-;;   replaced when unbreaking a line (in fill-delete-newlines).  It is added to
-;;   newline characters by fill-newline when the default behavior of
-;;   fill-delete-newlines is not what we want.
-(unless (featurep 'xemacs)
-  ;; COMPATIBILITY for Emacs < 22.1
-  (add-to-list 'text-property-default-nonsticky '(fill-space . t)))
-
-(defun LaTeX-fill-delete-newlines (from to justify nosqueeze squeeze-after)
-  ;; COMPATIBILITY for Emacs < 22.1 and XEmacs
-  (if (fboundp 'fill-delete-newlines)
-      (fill-delete-newlines from to justify nosqueeze squeeze-after)
-    (if (featurep 'xemacs)
-       (when (featurep 'mule)
-         (goto-char from)
-         (let ((unwished-newline (concat LaTeX-nospace-between-char-regexp "\n"
-                                         LaTeX-nospace-between-char-regexp)))
-           (while (re-search-forward unwished-newline to t)
-             (skip-chars-backward "^\n")
-             (delete-char -1))))
-      ;; This else-sentence was copied from the function `fill-delete-newlines'
-      ;; in `fill.el' (CVS Emacs, 2005-02-17) and adapted accordingly.
-      (while (search-forward "\n" to t)
-       (if (get-text-property (match-beginning 0) 'fill-space)
-           (replace-match (get-text-property (match-beginning 0) 'fill-space))
-         (let ((prev (char-before (match-beginning 0)))
-               (next (following-char)))
-           (when (or (aref (char-category-set next) ?|)
-                     (aref (char-category-set prev) ?|))
-             (delete-char -1))))))
-
-    ;; Make sure sentences ending at end of line get an extra space.
-    (if (or (not (boundp 'sentence-end-double-space))
-           sentence-end-double-space)
-       (progn
-         (goto-char from)
-         (while (re-search-forward "[.?!][]})\"']*$" to t)
-           (insert ? ))))
-    ;; Then change all newlines to spaces.
-    (let ((point-max (progn
-                      (goto-char to)
-                      (skip-chars-backward "\n")
-                      (point))))
-      (subst-char-in-region from point-max ?\n ?\ ))
-    (goto-char from)
-    (skip-chars-forward " \t")
-    ;; Remove extra spaces between words.
-    (unless (and nosqueeze (not (eq justify 'full)))
-      (canonically-space-region (or squeeze-after (point)) to)
-      ;; Remove trailing whitespace.
-      (goto-char (line-end-position))
-      (delete-char (- (skip-chars-backward " \t"))))))
-
 (defun LaTeX-fill-move-to-break-point (linebeg)
   "Move to the position where the line should be broken."
-  ;; COMPATIBILITY for Emacs < 22.1 and XEmacs
-  (if (fboundp 'fill-move-to-break-point)
-      (fill-move-to-break-point linebeg)
-    (if (featurep 'mule)
-       (if (TeX-looking-at-backward
-            (concat LaTeX-nospace-between-char-regexp ".?") 2)
-           ;; Cancel `forward-char' which is called just before
-           ;; `LaTeX-fill-move-to-break-point' if the char before point matches
-           ;; `LaTeX-nospace-between-char-regexp'.
-           (backward-char 1)
-         (when (re-search-backward
-                (concat " \\|\n\\|" LaTeX-nospace-between-char-regexp)
-                linebeg 'move)
-           (forward-char 1)))
-      (skip-chars-backward "^ \n"))
-    ;; Prevent infinite loops: If we cannot find a place to break
-    ;; while searching backward, search forward again.
-    (when (save-excursion
-           (skip-chars-backward " \t%")
-           (bolp))
-      (skip-chars-forward "^ \n" (point-max)))
-    ;; This code was copied from the function `fill-move-to-break-point'
-    ;; in `fill.el' (CVS Emacs, 2005-02-22) and adapted accordingly.
-    (when (and (< linebeg (point))
-              ;; If we are going to break the line after or
-              ;; before a non-ascii character, we may have to
-              ;; run a special function for the charset of the
-              ;; character to find the correct break point.
-              (boundp 'enable-multibyte-characters)
-              enable-multibyte-characters
-              (fboundp 'charset-after) ; Non-MULE XEmacsen don't have this.
-              (not (and (eq (charset-after (1- (point))) 'ascii)
-                        (eq (charset-after (point)) 'ascii))))
-      ;; Make sure we take SOMETHING after the fill prefix if any.
-      (if (fboundp 'fill-find-break-point)
-         (fill-find-break-point linebeg)
-       (when (fboundp 'kinsoku-process) ;XEmacs
-         (kinsoku-process)))))
+  (fill-move-to-break-point linebeg)
   ;; Prevent line break between 2-byte char and 1-byte char.
   (when (and (featurep 'mule)
             enable-multibyte-characters
@@ -4156,25 +4036,21 @@ space does not end a sentence, so don't break a line 
there."
   "Replace whitespace here with one newline and indent the line."
   (skip-chars-backward " \t")
   (newline 1)
-  ;; COMPATIBILITY for XEmacs
-  (unless (featurep 'xemacs)
-    ;; Give newline the properties of the space(s) it replaces
-    (set-text-properties (1- (point)) (point)
-                        (text-properties-at (point)))
-    (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?")
-        (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|)
-            (match-end 2))
-        ;; When refilling later on, this newline would normally not
-        ;; be replaced by a space, so we need to mark it specially to
-        ;; re-install the space when we unfill.
-        (put-text-property (1- (point)) (point) 'fill-space (match-string 1)))
-    ;; COMPATIBILITY for Emacs <= 21.3
-    (when (boundp 'fill-nobreak-invisible)
-      ;; If we don't want breaks in invisible text, don't insert
-      ;; an invisible newline.
-      (if fill-nobreak-invisible
-         (remove-text-properties (1- (point)) (point)
-                                 '(invisible t)))))
+  ;; Give newline the properties of the space(s) it replaces
+  (set-text-properties (1- (point)) (point)
+                      (text-properties-at (point)))
+  (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?")
+       (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|)
+          (match-end 2))
+       ;; When refilling later on, this newline would normally not
+       ;; be replaced by a space, so we need to mark it specially to
+       ;; re-install the space when we unfill.
+       (put-text-property (1- (point)) (point) 'fill-space (match-string 1)))
+  ;; If we don't want breaks in invisible text, don't insert
+  ;; an invisible newline.
+  (if fill-nobreak-invisible
+      (remove-text-properties (1- (point)) (point)
+                             '(invisible t)))
   ;; Insert the fill prefix.
   (and fill-prefix (not (equal fill-prefix ""))
        ;; Markers that were after the whitespace are now at point: insert
@@ -6000,9 +5876,7 @@ of `LaTeX-mode-hook'."
   (setq TeX-command-default "LaTeX")
   (setq TeX-sentinel-default-function 'TeX-LaTeX-sentinel)
   (add-hook 'tool-bar-mode-on-hook 'LaTeX-maybe-install-toolbar nil t)
-  (when (if (featurep 'xemacs)
-           (featurep 'toolbar)
-         (and (boundp 'tool-bar-mode) tool-bar-mode))
+  (when (and (boundp 'tool-bar-mode) tool-bar-mode)
     (LaTeX-maybe-install-toolbar))
   ;; Set the value of `LaTeX-using-Biber' based on the local value of
   ;; `LaTeX-biblatex-use-Biber'.  This should be run within



reply via email to

[Prev in Thread] Current Thread [Next in Thread]