From 5760307aa255d1dc28a7e5861c63efb020dadb25 Mon Sep 17 00:00:00 2001 From: morioka Date: Tue, 20 Oct 1998 16:33:53 +0000 Subject: [PATCH] Separate invisible features from poe to invisible. --- EMU-ELS | 24 ++++++++++------ emu.el | 1 + inv-18.el | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ inv-19.el | 63 ++++++++++++++++++++++++++++++++++++++++++ inv-xemacs.el | 70 +++++++++++++++++++++++++++++++++++++++++++++++ invisible.el | 45 ++++++++++++++++++++++++++++++ poe-19.el | 34 ----------------------- poe-xemacs.el | 40 --------------------------- 8 files changed, 279 insertions(+), 83 deletions(-) create mode 100644 inv-18.el create mode 100644 inv-19.el create mode 100644 inv-xemacs.el create mode 100644 invisible.el diff --git a/EMU-ELS b/EMU-ELS index 3ffe0d1..3611d43 100644 --- a/EMU-ELS +++ b/EMU-ELS @@ -14,15 +14,20 @@ (let ((poe-modules '(poe)) (poem-modules '(poem)) (mcs-modules '(mcharset)) + (invisible-modules '(invisible)) pccl-modules) - (setq poe-modules (cons (cond ((featurep 'xemacs) - 'poe-xemacs) - ((>= emacs-major-version 19) - 'poe-19) - (t - 'poe-18)) - poe-modules)) - + (cond ((featurep 'xemacs) + (setq poe-modules (cons 'poe-xemacs poe-modules) + invisible-modules (cons 'inv-xemacs invisible-modules)) + ) + ((>= emacs-major-version 19) + (setq poe-modules (cons 'poe-19 poe-modules) + invisible-modules (cons 'inv-19 invisible-modules)) + ) + (t + (setq poe-modules (cons 'poe-18 poe-modules) + invisible-modules (cons 'inv-18 invisible-modules)) + )) (cond ((featurep 'mule) (cond ((featurep 'xemacs) (setq poem-modules (cons 'poem-xm (cons 'poem-20 @@ -64,7 +69,8 @@ )) (setq emu-modules (append poe-modules poem-modules - mcs-modules pccl-modules + mcs-modules invisible-modules + pccl-modules emu-modules)) (setq emu-modules (cons 'broken emu-modules)) ) diff --git a/emu.el b/emu.el index 030900c..9d26d33 100644 --- a/emu.el +++ b/emu.el @@ -81,6 +81,7 @@ (require 'poem) (require 'mcharset) +(require 'invisible) (defsubst char-list-to-string (char-list) "Convert list of character CHAR-LIST to string." diff --git a/inv-18.el b/inv-18.el new file mode 100644 index 0000000..21e54ca --- /dev/null +++ b/inv-18.el @@ -0,0 +1,85 @@ +;;; inv-18.el --- invisible feature implementation for Emacs 18 + +;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. + +;; Author: MORIOKA Tomohiko +;; Keywords: invisible, text-property, region, Emacs 18 + +;; This file is part of APEL (A Portable Emacs Library). + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Code: + +(defmacro enable-invisible () + (` + (progn + (make-local-variable 'original-selective-display) + (setq original-selective-display selective-display) + (setq selective-display t) + ))) + +(defmacro end-of-invisible () + (` (setq selective-display + (if (boundp 'original-selective-display) + original-selective-display)) + )) + +(defun invisible-region (start end) + (let ((buffer-read-only nil) ;Okay even if write protected. + (modp (buffer-modified-p))) + (if (save-excursion + (goto-char (1- end)) + (eq (following-char) ?\n) + ) + (setq end (1- end)) + ) + (unwind-protect + (subst-char-in-region start end ?\n ?\^M t) + (set-buffer-modified-p modp) + ))) + +(defun visible-region (start end) + (let ((buffer-read-only nil) ;Okay even if write protected. + (modp (buffer-modified-p))) + (unwind-protect + (subst-char-in-region start end ?\^M ?\n t) + (set-buffer-modified-p modp) + ))) + +(defun invisible-p (pos) + (save-excursion + (goto-char pos) + (eq (following-char) ?\^M) + )) + +(defun next-visible-point (pos) + (save-excursion + (goto-char pos) + (end-of-line) + (if (eq (following-char) ?\n) + (forward-char) + ) + (point) + )) + + +;;; @ end +;;; + +(provide 'inv-18) + +;;; inv-18.el ends here diff --git a/inv-19.el b/inv-19.el new file mode 100644 index 0000000..3f99a03 --- /dev/null +++ b/inv-19.el @@ -0,0 +1,63 @@ +;;; inv-19.el --- invisible feature implementation for Emacs 19 or later + +;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. + +;; Author: MORIOKA Tomohiko +;; Keywords: invisible, text-property, region, Emacs 19 + +;; This file is part of APEL (A Portable Emacs Library). + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Code: + +(defmacro enable-invisible ()) + +(defmacro end-of-invisible ()) + +(defun invisible-region (start end) + (if (save-excursion + (goto-char (1- end)) + (eq (following-char) ?\n) + ) + (setq end (1- end)) + ) + (put-text-property start end 'invisible t) + ) + +(defun visible-region (start end) + (put-text-property start end 'invisible nil) + ) + +(defun invisible-p (pos) + (get-text-property pos 'invisible) + ) + +(defun next-visible-point (pos) + (save-excursion + (goto-char (next-single-property-change pos 'invisible)) + (if (eq (following-char) ?\n) + (forward-char) + ) + (point))) + + +;;; @ end +;;; + +(provide 'inv-19) + +;;; inv-19.el ends here diff --git a/inv-xemacs.el b/inv-xemacs.el new file mode 100644 index 0000000..c6c056b --- /dev/null +++ b/inv-xemacs.el @@ -0,0 +1,70 @@ +;;; inv-xemacs.el --- invisible feature implementation for XEmacs + +;; Copyright (C) 1995 Free Software Foundation, Inc. +;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko + +;; Author: MORIOKA Tomohiko +;; Keywords: invisible, text-property, region, XEmacs + +;; This file is part of APEL (A Portable Emacs Library). + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with XEmacs; see the file COPYING. If not, write to the Free +;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +;; 02111-1307, USA. + +;;; Code: + +(defmacro enable-invisible ()) + +(defmacro end-of-invisible ()) + +(defun invisible-region (start end) + (if (save-excursion + (goto-char start) + (eq (following-char) ?\n)) + (setq start (1+ start)) + ) + (put-text-property start end 'invisible t) + ) + +(defun visible-region (start end) + (put-text-property start end 'invisible nil) + ) + +(defun invisible-p (pos) + (if (save-excursion + (goto-char pos) + (eq (following-char) ?\n)) + (setq pos (1+ pos)) + ) + (get-text-property pos 'invisible) + ) + +(defun next-visible-point (pos) + (save-excursion + (if (save-excursion + (goto-char pos) + (eq (following-char) ?\n)) + (setq pos (1+ pos)) + ) + (or (next-single-property-change pos 'invisible) + (point-max)))) + + +;;; @ end +;;; + +(provide 'inv-xemacs) + +;;; inv-xemacs.el ends here diff --git a/invisible.el b/invisible.el new file mode 100644 index 0000000..265ee92 --- /dev/null +++ b/invisible.el @@ -0,0 +1,45 @@ +;;; invisible.el --- hide region + +;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. + +;; Author: MORIOKA Tomohiko +;; Keywords: invisible, text-property, region + +;; This file is part of APEL (A Portable Emacs Library). + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2, or (at +;; your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Code: + +(require 'poe) + +(cond ((featurep 'xemacs) + (require 'inv-xemacs) + ) + ((>= emacs-major-version 19) + (require 'inv-19) + ) + (t + (require 'inv-18) + )) + + +;;; @ end +;;; + +(provide 'invisible) + +;;; invisible.el ends here diff --git a/poe-19.el b/poe-19.el index fbbe7ed..0d9367a 100644 --- a/poe-19.el +++ b/poe-19.el @@ -32,40 +32,6 @@ ) -;;; @ visible/invisible -;;; - -(defmacro enable-invisible ()) - -(defmacro end-of-invisible ()) - -(defun invisible-region (start end) - (if (save-excursion - (goto-char (1- end)) - (eq (following-char) ?\n) - ) - (setq end (1- end)) - ) - (put-text-property start end 'invisible t) - ) - -(defun visible-region (start end) - (put-text-property start end 'invisible nil) - ) - -(defun invisible-p (pos) - (get-text-property pos 'invisible) - ) - -(defun next-visible-point (pos) - (save-excursion - (goto-char (next-single-property-change pos 'invisible)) - (if (eq (following-char) ?\n) - (forward-char) - ) - (point))) - - ;;; @ end ;;; diff --git a/poe-xemacs.el b/poe-xemacs.el index 119f639..326aa47 100644 --- a/poe-xemacs.el +++ b/poe-xemacs.el @@ -53,46 +53,6 @@ )) -;;; @ visible/invisible -;;; - -(defmacro enable-invisible ()) - -(defmacro end-of-invisible ()) - -(defun invisible-region (start end) - (if (save-excursion - (goto-char start) - (eq (following-char) ?\n)) - (setq start (1+ start)) - ) - (put-text-property start end 'invisible t) - ) - -(defun visible-region (start end) - (put-text-property start end 'invisible nil) - ) - -(defun invisible-p (pos) - (if (save-excursion - (goto-char pos) - (eq (following-char) ?\n)) - (setq pos (1+ pos)) - ) - (get-text-property pos 'invisible) - ) - -(defun next-visible-point (pos) - (save-excursion - (if (save-excursion - (goto-char pos) - (eq (following-char) ?\n)) - (setq pos (1+ pos)) - ) - (or (next-single-property-change pos 'invisible) - (point-max)))) - - ;;; @ dired ;;; -- 1.7.10.4