aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2020-01-18 02:59:56 +0100
committerStefan Kangas2020-01-18 02:59:56 +0100
commitbce3d89a6042da8830199d912c3b26aefaf7288c (patch)
tree52ad2649b5ff84a22426c4f6f90829c9e8574d11
parent8d2fecdf6c372b8ff064454558ae5843d0607f06 (diff)
downloademacs-bce3d89a6042da8830199d912c3b26aefaf7288c.tar.gz
emacs-bce3d89a6042da8830199d912c3b26aefaf7288c.zip
Remove XEmacs compat code from allout.el
* lisp/allout.el (allout-overlay-preparations) (allout-overlay-interior-modification-handler) (allout-before-change-handler, allout-beginning-of-line) (allout-solicit-alternate-bullet, allout-annotate-hidden) (allout-hide-by-annotation, allout-yank-processing) (allout-flag-region, allout-toggle-subtree-encryption) (allout-mark-marker, allout-substring-no-properties) (allout-select-safe-coding-system) (allout-previous-single-char-property-change) (allout-next-single-char-property-change) (top-level): Remove XEmacs compat code.
-rw-r--r--lisp/allout.el263
1 files changed, 26 insertions, 237 deletions
diff --git a/lisp/allout.el b/lisp/allout.el
index 56f74870657..408a2a9a0cc 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1675,10 +1675,8 @@ valid values."
1675 ;; least in emacs 21, 22.1, and xemacs 21.4. 1675 ;; least in emacs 21, 22.1, and xemacs 21.4.
1676 (put 'allout-exposure-category 'isearch-open-invisible 1676 (put 'allout-exposure-category 'isearch-open-invisible
1677 'allout-isearch-end-handler) 1677 'allout-isearch-end-handler)
1678 (if (featurep 'xemacs) 1678 (put 'allout-exposure-category 'insert-in-front-hooks
1679 (put 'allout-exposure-category 'start-open t) 1679 '(allout-overlay-insert-in-front-handler))
1680 (put 'allout-exposure-category 'insert-in-front-hooks
1681 '(allout-overlay-insert-in-front-handler)))
1682 (put 'allout-exposure-category 'modification-hooks 1680 (put 'allout-exposure-category 'modification-hooks
1683 '(allout-overlay-interior-modification-handler))) 1681 '(allout-overlay-interior-modification-handler)))
1684;;;_ > define-minor-mode allout-mode 1682;;;_ > define-minor-mode allout-mode
@@ -2115,9 +2113,7 @@ internal functions use this feature cohesively bunch changes."
2115 (allout-show-to-offshoot))) 2113 (allout-show-to-offshoot)))
2116 (when (not first) 2114 (when (not first)
2117 (setq first (point)))) 2115 (setq first (point))))
2118 (goto-char (if (featurep 'xemacs) 2116 (goto-char (next-char-property-change (1+ (point)) end)))
2119 (next-property-change (1+ (point)) nil end)
2120 (next-char-property-change (1+ (point)) end))))
2121 (when first 2117 (when first
2122 (goto-char first) 2118 (goto-char first)
2123 (condition-case nil 2119 (condition-case nil
@@ -2141,18 +2137,7 @@ See `allout-overlay-interior-modification-handler' for details."
2141 (when (and (allout-mode-p) undo-in-progress) 2137 (when (and (allout-mode-p) undo-in-progress)
2142 (setq allout-just-did-undo t) 2138 (setq allout-just-did-undo t)
2143 (if (allout-hidden-p) 2139 (if (allout-hidden-p)
2144 (allout-show-children))) 2140 (allout-show-children))))
2145
2146 ;; allout-overlay-interior-modification-handler on an overlay handles
2147 ;; this in other emacs, via `allout-exposure-category's 'modification-hooks.
2148 (when (and (featurep 'xemacs) (allout-mode-p))
2149 ;; process all of the pending overlays:
2150 (save-excursion
2151 (goto-char beg)
2152 (let ((overlay (allout-get-invisibility-overlay)))
2153 (if overlay
2154 (allout-overlay-interior-modification-handler
2155 overlay nil beg end nil))))))
2156;;;_ > allout-isearch-end-handler (&optional overlay) 2141;;;_ > allout-isearch-end-handler (&optional overlay)
2157(defun allout-isearch-end-handler (&optional _overlay) 2142(defun allout-isearch-end-handler (&optional _overlay)
2158 "Reconcile allout outline exposure on arriving in hidden text after isearch. 2143 "Reconcile allout outline exposure on arriving in hidden text after isearch.
@@ -2453,7 +2438,7 @@ Outermost is first."
2453 (progn 2438 (progn
2454 (if (and (not (bolp)) 2439 (if (and (not (bolp))
2455 (allout-hidden-p (1- (point)))) 2440 (allout-hidden-p (1- (point))))
2456 (goto-char (allout-previous-single-char-property-change 2441 (goto-char (previous-single-char-property-change
2457 (1- (point)) 'invisible))) 2442 (1- (point)) 'invisible)))
2458 (move-beginning-of-line 1)) 2443 (move-beginning-of-line 1))
2459 (allout-depth) 2444 (allout-depth)
@@ -3443,7 +3428,7 @@ Offer one suitable for current depth DEPTH as default."
3443 (format-message 3428 (format-message
3444 "Select bullet: %s (`%s' default): " 3429 "Select bullet: %s (`%s' default): "
3445 sans-escapes 3430 sans-escapes
3446 (allout-substring-no-properties default-bullet)) 3431 (substring-no-properties default-bullet))
3447 sans-escapes 3432 sans-escapes
3448 t))) 3433 t)))
3449 (message "") 3434 (message "")
@@ -4458,9 +4443,9 @@ Topic exposure is marked with text-properties, to be used by
4458 (if (not (allout-hidden-p)) 4443 (if (not (allout-hidden-p))
4459 (setq next 4444 (setq next
4460 (max (1+ (point)) 4445 (max (1+ (point))
4461 (allout-next-single-char-property-change (point) 4446 (next-single-char-property-change (point)
4462 'invisible 4447 'invisible
4463 nil end)))) 4448 nil end))))
4464 (if (or (not next) (eq prev next)) 4449 (if (or (not next) (eq prev next))
4465 ;; still not at start of hidden area -- must not be any left. 4450 ;; still not at start of hidden area -- must not be any left.
4466 (setq done t) 4451 (setq done t)
@@ -4499,7 +4484,7 @@ Topic exposure is marked with text-properties, to be used by
4499 (while (not done) 4484 (while (not done)
4500 ;; at or advance to start of next annotation: 4485 ;; at or advance to start of next annotation:
4501 (if (not (get-text-property (point) 'allout-was-hidden)) 4486 (if (not (get-text-property (point) 'allout-was-hidden))
4502 (setq next (allout-next-single-char-property-change 4487 (setq next (next-single-char-property-change
4503 (point) 'allout-was-hidden nil end))) 4488 (point) 'allout-was-hidden nil end)))
4504 (if (or (not next) (eq prev next)) 4489 (if (or (not next) (eq prev next))
4505 ;; no more or not advancing -- must not be any left. 4490 ;; no more or not advancing -- must not be any left.
@@ -4510,7 +4495,7 @@ Topic exposure is marked with text-properties, to be used by
4510 ;; still not at start of annotation. 4495 ;; still not at start of annotation.
4511 (setq done t) 4496 (setq done t)
4512 ;; advance to just after end of this annotation: 4497 ;; advance to just after end of this annotation:
4513 (setq next (allout-next-single-char-property-change 4498 (setq next (next-single-char-property-change
4514 (point) 'allout-was-hidden nil end)) 4499 (point) 'allout-was-hidden nil end))
4515 (let ((o (make-overlay prev next nil 'front-advance))) 4500 (let ((o (make-overlay prev next nil 'front-advance)))
4516 (overlay-put o 'category 'allout-exposure-category) 4501 (overlay-put o 'category 'allout-exposure-category)
@@ -4543,12 +4528,12 @@ however, are left exactly like normal, non-allout-specific yanks."
4543 (interactive "*P") 4528 (interactive "*P")
4544 ; Get to beginning, leaving 4529 ; Get to beginning, leaving
4545 ; region around subject: 4530 ; region around subject:
4546 (if (< (allout-mark-marker t) (point)) 4531 (if (< (mark-marker) (point))
4547 (exchange-point-and-mark)) 4532 (exchange-point-and-mark))
4548 (save-match-data 4533 (save-match-data
4549 (let* ((subj-beg (point)) 4534 (let* ((subj-beg (point))
4550 (into-bol (bolp)) 4535 (into-bol (bolp))
4551 (subj-end (allout-mark-marker t)) 4536 (subj-end (mark-marker))
4552 ;; 'resituate' if yanking an entire topic into topic header: 4537 ;; 'resituate' if yanking an entire topic into topic header:
4553 (resituate (and (let ((allout-inhibit-aberrance-doublecheck t)) 4538 (resituate (and (let ((allout-inhibit-aberrance-doublecheck t))
4554 (allout-e-o-prefix-p)) 4539 (allout-e-o-prefix-p))
@@ -4642,8 +4627,8 @@ however, are left exactly like normal, non-allout-specific yanks."
4642 t))) 4627 t)))
4643 (message "")))) 4628 (message ""))))
4644 (if (or into-bol resituate) 4629 (if (or into-bol resituate)
4645 (allout-hide-by-annotation (point) (allout-mark-marker t)) 4630 (allout-hide-by-annotation (point) (mark-marker))
4646 (allout-deannotate-hidden (allout-mark-marker t) (point))) 4631 (allout-deannotate-hidden (mark-marker) (point)))
4647 (if (not resituate) 4632 (if (not resituate)
4648 (exchange-point-and-mark)) 4633 (exchange-point-and-mark))
4649 (run-hook-with-args 'allout-structure-added-functions subj-beg subj-end)))) 4634 (run-hook-with-args 'allout-structure-added-functions subj-beg subj-end))))
@@ -4752,14 +4737,7 @@ this function."
4752 (when flag 4737 (when flag
4753 (let ((o (make-overlay from to nil 'front-advance))) 4738 (let ((o (make-overlay from to nil 'front-advance)))
4754 (overlay-put o 'category 'allout-exposure-category) 4739 (overlay-put o 'category 'allout-exposure-category)
4755 (overlay-put o 'evaporate t) 4740 (overlay-put o 'evaporate t))
4756 (when (featurep 'xemacs)
4757 (let ((props (symbol-plist 'allout-exposure-category)))
4758 (while props
4759 (condition-case nil
4760 ;; as of 2008-02-27, xemacs lacks modification-hooks
4761 (overlay-put o (pop props) (pop props))
4762 (error nil))))))
4763 (setq allout-this-command-hid-text t)) 4741 (setq allout-this-command-hid-text t))
4764 (run-hook-with-args 'allout-exposure-change-functions from to flag)) 4742 (run-hook-with-args 'allout-exposure-change-functions from to flag))
4765;;;_ > allout-flag-current-subtree (flag) 4743;;;_ > allout-flag-current-subtree (flag)
@@ -5946,7 +5924,7 @@ See `allout-toggle-current-subtree-encryption' for more details."
5946 ;; they're encrypted, so the coding system is set to accommodate 5924 ;; they're encrypted, so the coding system is set to accommodate
5947 ;; them. 5925 ;; them.
5948 (setq buffer-file-coding-system 5926 (setq buffer-file-coding-system
5949 (allout-select-safe-coding-system subtree-beg subtree-end)) 5927 (select-safe-coding-system subtree-beg subtree-end))
5950 ;; if the coding system for the text being encrypted is different 5928 ;; if the coding system for the text being encrypted is different
5951 ;; than that prevailing, then there a real risk that the coding 5929 ;; than that prevailing, then there a real risk that the coding
5952 ;; system can't be noticed by emacs when the file is visited. to 5930 ;; system can't be noticed by emacs when the file is visited. to
@@ -6542,204 +6520,15 @@ If BEG is bigger than END we return 0."
6542 (mapcar (lambda (char) (if (= char ?%) "%%" (char-to-string char))) 6520 (mapcar (lambda (char) (if (= char ?%) "%%" (char-to-string char)))
6543 string))) 6521 string)))
6544(define-obsolete-function-alias 'allout-flatten #'flatten-tree "27.1") 6522(define-obsolete-function-alias 'allout-flatten #'flatten-tree "27.1")
6545;;;_ : Compatibility: 6523(define-obsolete-function-alias 'allout-mark-marker #'mark-marker "28.1")
6546;;;_ : xemacs undo-in-progress provision: 6524(define-obsolete-function-alias 'allout-substring-no-properties
6547(unless (boundp 'undo-in-progress) 6525 #'substring-no-properties "28.1")
6548 (defvar undo-in-progress nil 6526(define-obsolete-function-alias 'allout-select-safe-coding-system
6549 "Placeholder defvar for XEmacs compatibility from allout.el.") 6527 #'select-safe-coding-system "28.1")
6550 (defadvice undo-more (around allout activate) 6528(define-obsolete-function-alias 'allout-previous-single-char-property-change
6551 ;; This defadvice used only in emacs that lack undo-in-progress, eg xemacs. 6529 #'previous-single-char-property-change "28.1")
6552 (let ((undo-in-progress t)) ad-do-it))) 6530(define-obsolete-function-alias 'allout-next-single-char-property-change
6553 6531 #'next-single-char-property-change "28.1")
6554;;;_ > allout-mark-marker to accommodate divergent emacsen:
6555(defun allout-mark-marker (&optional force buffer)
6556 "Accommodate the different signature for `mark-marker' across Emacsen.
6557
6558XEmacs takes two optional args, while Emacs does not,
6559so pass them along when appropriate."
6560 (if (featurep 'xemacs)
6561 (apply 'mark-marker force buffer)
6562 (mark-marker)))
6563;;;_ > subst-char-in-string if necessary
6564(if (not (fboundp 'subst-char-in-string))
6565 (defun subst-char-in-string (fromchar tochar string &optional inplace)
6566 "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
6567Unless optional argument INPLACE is non-nil, return a new string."
6568 (let ((i (length string))
6569 (newstr (if inplace string (copy-sequence string))))
6570 (while (> i 0)
6571 (setq i (1- i))
6572 (if (eq (aref newstr i) fromchar)
6573 (aset newstr i tochar)))
6574 newstr)))
6575;;;_ > wholenump if necessary
6576(if (not (fboundp 'wholenump))
6577 (defalias 'wholenump 'natnump))
6578;;;_ > remove-overlays if necessary
6579(if (not (fboundp 'remove-overlays))
6580 (defun remove-overlays (&optional beg end name val)
6581 "Clear BEG and END of overlays whose property NAME has value VAL.
6582Overlays might be moved and/or split.
6583BEG and END default respectively to the beginning and end of buffer."
6584 (unless beg (setq beg (point-min)))
6585 (unless end (setq end (point-max)))
6586 (if (< end beg)
6587 (setq beg (prog1 end (setq end beg))))
6588 (save-excursion
6589 (dolist (o (overlays-in beg end))
6590 (when (eq (overlay-get o name) val)
6591 ;; Either push this overlay outside beg...end
6592 ;; or split it to exclude beg...end
6593 ;; or delete it entirely (if it is contained in beg...end).
6594 (if (< (overlay-start o) beg)
6595 (if (> (overlay-end o) end)
6596 (progn
6597 (move-overlay (copy-overlay o)
6598 (overlay-start o) beg)
6599 (move-overlay o end (overlay-end o)))
6600 (move-overlay o (overlay-start o) beg))
6601 (if (> (overlay-end o) end)
6602 (move-overlay o end (overlay-end o))
6603 (delete-overlay o)))))))
6604 )
6605;;;_ > copy-overlay if necessary -- xemacs ~ 21.4
6606(if (not (fboundp 'copy-overlay))
6607 (defun copy-overlay (o)
6608 "Return a copy of overlay O."
6609 (let ((o1 (make-overlay (overlay-start o) (overlay-end o)
6610 ;; FIXME: there's no easy way to find the
6611 ;; insertion-type of the two markers.
6612 (overlay-buffer o)))
6613 (props (overlay-properties o)))
6614 (while props
6615 (overlay-put o1 (pop props) (pop props)))
6616 o1)))
6617;;;_ > add-to-invisibility-spec if necessary -- xemacs ~ 21.4
6618(if (not (fboundp 'add-to-invisibility-spec))
6619 (defun add-to-invisibility-spec (element)
6620 "Add ELEMENT to `buffer-invisibility-spec'.
6621See documentation for `buffer-invisibility-spec' for the kind of elements
6622that can be added."
6623 (if (eq buffer-invisibility-spec t)
6624 (setq buffer-invisibility-spec (list t)))
6625 (setq buffer-invisibility-spec
6626 (cons element buffer-invisibility-spec))))
6627;;;_ > remove-from-invisibility-spec if necessary -- xemacs ~ 21.4
6628(if (not (fboundp 'remove-from-invisibility-spec))
6629 (defun remove-from-invisibility-spec (element)
6630 "Remove ELEMENT from `buffer-invisibility-spec'."
6631 (if (consp buffer-invisibility-spec)
6632 (setq buffer-invisibility-spec (delete element
6633 buffer-invisibility-spec)))))
6634;;;_ > move-beginning-of-line if necessary -- older emacs, xemacs
6635(if (not (fboundp 'move-beginning-of-line))
6636 (defun move-beginning-of-line (arg)
6637 "Move point to beginning of current line as displayed.
6638\(This disregards invisible newlines such as those
6639which are part of the text that an image rests on.)
6640
6641With argument ARG not nil or 1, move forward ARG - 1 lines first.
6642If point reaches the beginning or end of buffer, it stops there.
6643To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
6644 (interactive "p")
6645 (or arg (setq arg 1))
6646 (if (/= arg 1)
6647 (condition-case nil (line-move (1- arg)) (error nil)))
6648
6649 ;; Move to beginning-of-line, ignoring fields and invisible text.
6650 (skip-chars-backward "^\n")
6651 (while (and (not (bobp))
6652 (let ((prop
6653 (get-char-property (1- (point)) 'invisible)))
6654 (if (eq buffer-invisibility-spec t)
6655 prop
6656 (or (memq prop buffer-invisibility-spec)
6657 (assq prop buffer-invisibility-spec)))))
6658 (goto-char (if (featurep 'xemacs)
6659 (previous-property-change (point))
6660 (previous-char-property-change (point))))
6661 (skip-chars-backward "^\n"))
6662 (vertical-motion 0))
6663)
6664;;;_ > move-end-of-line if necessary -- Emacs < 22.1, xemacs
6665(if (not (fboundp 'move-end-of-line))
6666 (defun move-end-of-line (arg)
6667 "Move point to end of current line as displayed.
6668\(This disregards invisible newlines such as those
6669which are part of the text that an image rests on.)
6670
6671With argument ARG not nil or 1, move forward ARG - 1 lines first.
6672If point reaches the beginning or end of buffer, it stops there.
6673To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
6674 (interactive "p")
6675 (or arg (setq arg 1))
6676 (let (done)
6677 (while (not done)
6678 (let ((newpos
6679 (save-excursion
6680 (let ((goal-column 0))
6681 (and (condition-case nil
6682 (or (line-move arg) t)
6683 (error nil))
6684 (not (bobp))
6685 (progn
6686 (while
6687 (and
6688 (not (bobp))
6689 (let ((prop
6690 (get-char-property (1- (point))
6691 'invisible)))
6692 (if (eq buffer-invisibility-spec t)
6693 prop
6694 (or (memq prop
6695 buffer-invisibility-spec)
6696 (assq prop
6697 buffer-invisibility-spec)))))
6698 (goto-char
6699 (previous-char-property-change (point))))
6700 (backward-char 1)))
6701 (point)))))
6702 (goto-char newpos)
6703 (if (and (> (point) newpos)
6704 (eq (preceding-char) ?\n))
6705 (backward-char 1)
6706 (if (and (> (point) newpos) (not (eobp))
6707 (not (eq (following-char) ?\n)))
6708 ;; If we skipped something intangible
6709 ;; and now we're not really at eol,
6710 ;; keep going.
6711 (setq arg 1)
6712 (setq done t)))))))
6713 )
6714;;;_ > allout-next-single-char-property-change -- alias unless lacking
6715(defalias 'allout-next-single-char-property-change
6716 (if (fboundp 'next-single-char-property-change)
6717 'next-single-char-property-change
6718 'next-single-property-change)
6719 ;; No docstring because xemacs defalias doesn't support it.
6720 )
6721;;;_ > allout-previous-single-char-property-change -- alias unless lacking
6722(defalias 'allout-previous-single-char-property-change
6723 (if (fboundp 'previous-single-char-property-change)
6724 'previous-single-char-property-change
6725 'previous-single-property-change)
6726 ;; No docstring because xemacs defalias doesn't support it.
6727 )
6728;;;_ > allout-select-safe-coding-system
6729(defalias 'allout-select-safe-coding-system
6730 (if (fboundp 'select-safe-coding-system)
6731 'select-safe-coding-system
6732 'detect-coding-region)
6733 )
6734;;;_ > allout-substring-no-properties
6735;; define as alias first, so byte compiler is happy.
6736(defalias 'allout-substring-no-properties 'substring-no-properties)
6737;; then supplant with definition if underlying alias absent.
6738(if (not (fboundp 'substring-no-properties))
6739 (defun allout-substring-no-properties (string &optional start end)
6740 (substring string (or start 0) end))
6741 )
6742
6743;;;_ #10 Unfinished 6532;;;_ #10 Unfinished
6744;;;_ > allout-bullet-isearch (&optional bullet) 6533;;;_ > allout-bullet-isearch (&optional bullet)
6745(defun allout-bullet-isearch (&optional bullet) 6534(defun allout-bullet-isearch (&optional bullet)