From 7170f25d3d7fdf968e64d5df98a3379093d24425 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 19 Aug 2023 12:21:57 +0200 Subject: [PATCH] Remove XEmacs compat code from reftex * lisp/textmodes/reftex-toc.el (reftex-toc, reftex-toc-dframe-p) (reftex-toc-revert, reftex-toc-toggle-dedicated-frame): Delete XEmacs compat code. * lisp/textmodes/reftex.el (reftex-window-height): Make into obsolete function alias of 'window-height'. Update all callers. (reftex-create-customize-menu): Assume recent version of cus-edit.el. --- lisp/textmodes/reftex-ref.el | 2 +- lisp/textmodes/reftex-toc.el | 25 +++++++----------------- lisp/textmodes/reftex.el | 38 +++++++++++++++--------------------- 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index da0779c8e8d..d0a44eca17c 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -784,7 +784,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn (defvar font-lock-mode) (defun reftex-show-entry (beg-hlt end-hlt) ;; Show entry if point is hidden - (let* ((n (/ (reftex-window-height) 2)) + (let* ((n (/ (window-height) 2)) (beg (save-excursion (re-search-backward "[\n\r]" nil 1 n) (point))) (end (save-excursion diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 3b3f892a688..858d805332a 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -1,6 +1,6 @@ ;;; reftex-toc.el --- RefTeX's table of contents mode -*- lexical-binding: t; -*- -;; Copyright (C) 1997-2000, 2003-2023 Free Software Foundation, Inc. +;; Copyright (C) 1997-2023 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Maintainer: auctex-devel@gnu.org @@ -215,9 +215,7 @@ When called with a raw \\[universal-argument] prefix, rescan the document first. (here-I-am (if reftex--rebuilding-toc (get 'reftex-toc :reftex-data) (car (reftex-where-am-I)))) - (unsplittable (if (fboundp 'frame-property) - (frame-property (selected-frame) 'unsplittable) - (frame-parameter nil 'unsplittable))) + (unsplittable (frame-parameter nil 'unsplittable)) offset toc-window) (if (setq toc-window (get-buffer-window @@ -385,11 +383,8 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help ;; Check if FRAME is the dedicated TOC frame. ;; If yes, and ERROR is non-nil, throw an error. (setq frame (or frame (selected-frame))) - (let ((res (equal - (if (fboundp 'frame-property) - (frame-property frame 'name) - (frame-parameter frame 'name)) - "RefTeX TOC Frame"))) + (let ((res (equal (frame-parameter frame 'name) + "RefTeX TOC Frame"))) (if (and res error) (error (substitute-command-keys "This frame is view-only. Use \\[reftex-toc] \ @@ -586,10 +581,7 @@ With prefix arg 1, restrict index to the section at point." (defun reftex-toc-revert (&rest _) "Regenerate the TOC from the internal lists." (interactive) - (let ((unsplittable - (if (fboundp 'frame-property) - (frame-property (selected-frame) 'unsplittable) - (frame-parameter nil 'unsplittable))) + (let ((unsplittable (frame-parameter nil 'unsplittable)) (reftex--rebuilding-toc t)) (if unsplittable (switch-to-buffer @@ -1036,12 +1028,9 @@ always show the current section in connection with the option `reftex-auto-recenter-toc'." (interactive) (catch 'exit - (let* ((frames (frame-list)) frame - (get-frame-prop-func (if (fboundp 'frame-property) - 'frame-property - 'frame-parameter))) + (let* ((frames (frame-list)) frame) (while (setq frame (pop frames)) - (if (equal (funcall get-frame-prop-func frame 'name) + (if (equal (frame-parameter frame 'name) "RefTeX TOC Frame") (progn (delete-frame frame) diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 916e0d89a1d..50bec6ef172 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1,6 +1,6 @@ ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX -*- lexical-binding: t; -*- -;; Copyright (C) 1997-2000, 2003-2023 Free Software Foundation, Inc. +;; Copyright (C) 1997-2023 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Maintainer: auctex-devel@gnu.org @@ -1664,11 +1664,6 @@ When DIE is non-nil, throw an error if file not found." (pop alist)) (nreverse out))) -(defun reftex-window-height () - (if (fboundp 'window-displayed-height) - (window-displayed-height) - (window-height))) - (defun reftex-enlarge-to-fit (buf2 &optional keep-current) ;; Enlarge other window displaying buffer to show whole buffer if possible. ;; If KEEP-CURRENT in non-nil, current buffer must remain visible. @@ -1680,7 +1675,7 @@ When DIE is non-nil, throw an error if file not found." (unless (and (pos-visible-in-window-p (point-min)) (pos-visible-in-window-p (point-max))) (enlarge-window (1+ (- (count-lines (point-min) (point-max)) - (reftex-window-height)))))) + (window-height)))))) (cond ((window-live-p win1) (select-window win1)) (keep-current @@ -1705,7 +1700,7 @@ When DIE is non-nil, throw an error if file not found." (unless (and (pos-visible-in-window-p (point-min)) (pos-visible-in-window-p (point-max))) (enlarge-window (1+ (- (count-lines (point-min) (point-max)) - (reftex-window-height))))) + (window-height))))) (setq truncate-lines t)) (if (and (pos-visible-in-window-p (point-min)) (pos-visible-in-window-p (point-max))) @@ -2274,20 +2269,17 @@ IGNORE-WORDS List of words which should be removed from the string." (defun reftex-create-customize-menu () "Create a full customization menu for RefTeX, insert it into the menu." (interactive) - (if (fboundp 'customize-menu-create) - (progn - (easy-menu-change - '("Ref") "Customize" - `(["Browse RefTeX group" reftex-customize t] - "--" - ,(customize-menu-create 'reftex) - ["Set" Custom-set t] - ["Save" Custom-save t] - ["Reset to Current" Custom-reset-current t] - ["Reset to Saved" Custom-reset-saved t] - ["Reset to Standard Settings" Custom-reset-standard t])) - (message "\"Ref\"-menu now contains full customization menu")) - (error "Cannot expand menu (outdated version of cus-edit.el)"))) + (easy-menu-change + '("Ref") "Customize" + `(["Browse RefTeX group" reftex-customize t] + "--" + ,(customize-menu-create 'reftex) + ["Set" Custom-set t] + ["Save" Custom-save t] + ["Reset to Current" Custom-reset-current t] + ["Reset to Saved" Custom-reset-saved t] + ["Reset to Standard Settings" Custom-reset-standard t])) + (message "\"Ref\"-menu now contains full customization menu")) ;;; Misc @@ -2348,6 +2340,8 @@ Your bug report will be posted to the AUCTeX bug reporting list. (setq reftex-tables-dirty t) ; in case this file is evaluated by hand +(define-obsolete-function-alias 'reftex-window-height #'window-height "30.1") + (provide 'reftex) ;;; reftex.el ends here -- 2.39.2