summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog90
-rw-r--r--lisp/calc/calc-graph.el14
-rw-r--r--lisp/calendar/calendar.el35
-rw-r--r--lisp/calendar/holidays.el112
-rw-r--r--lisp/ido.el276
-rw-r--r--lisp/image.el9
-rw-r--r--lisp/ls-lisp.el2
-rw-r--r--lisp/printing.el19
-rw-r--r--lisp/progmodes/tcl.el16
-rw-r--r--lisp/subr.el5
-rw-r--r--lisp/textmodes/enriched.el20
11 files changed, 430 insertions, 168 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8263604548b..a77f2206e58 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,93 @@
+2004-09-25 Lars Hansen <larsh@math.ku.dk>
+
+ * ls-lisp.el (ls-lisp-format): Mark file names with poperty
+ dired-filename.
+
+2004-09-25 Kim F. Storm <storm@cua.dk>
+
+ * ido.el (ido-max-directory-size): New defcustom.
+ (ido-decorations): Add "too big" element.
+ (ido-directory-too-big): New dynamic var.
+ (ido-may-cache-directory): Don't cache big directories.
+ (ido-directory-too-big-p): New defun.
+ (ido-set-current-directory): Update ido-directory-too-big.
+ (ido-read-internal): Make empty ido-cur-item if too-big.
+ (ido-buffer-internal): Use ido-read-internal directly instead of
+ ido-read-buffer.
+ (ido-file-internal): Init ido-directory-too-big.
+ (ido-complete): <TAB> If ido-directory-too-big is set, clear it,
+ and redo completion with full list.
+ (ido-toggle-ignore): <C-a> If ido-directory-too-big is set, clear
+ it, and show completions.
+ (ido-all-completions): Let bind ido-directory-too-big to nil.
+ (ido-exhibit): Handle ido-directory-too-big.
+ (ido-read-buffer): Handle fallback to read-buffer. Init
+ ido-directory-too-big.
+ (ido-read-file-name, ido-read-directory-name, ido-completing-read):
+ Init ido-directory-too-big.
+
+2004-09-24 Luc Teirlinck <teirllm@auburn.edu>
+
+ * subr.el (delay-mode-hooks): Doc fix.
+
+2004-09-23 Luc Teirlinck <teirllm@auburn.edu>
+
+ * textmodes/enriched.el
+ (enriched-default-text-properties-local-flag): New variable.
+ (enriched-mode): Make sure that enabling and disabling the mode is
+ a no-op. Doc fix.
+
+2004-09-23 H,Ae(Bkon Malmedal <hmalmedal@yahoo.no> (tiny change)
+
+ * calendar/holidays.el (holiday-advent): Report on a specified day
+ offset from advent, not just advent.
+ (holiday-easter-etc): Report on one specified day offset from
+ easter, not all easter holidays. Various Easter holidays moved to
+ `christian-holidays' variable in calendar.el.
+ * calendar/calendar.el (christian-holidays): Adapt for new
+ behaviour of `holiday-advent' and `holiday-easter-etc' functions.
+
+2004-09-23 Kim F. Storm <storm@cua.dk>
+
+ * image.el (insert-sliced-image): Add doc string.
+
+ * ido.el (ido-choice-list): New dynamic var for `list' context.
+ (ido-context-switch-command): New dynamic var.
+ (ido-define-mode-map): Generalize switch between file/buffer contexts.
+ (ido-read-internal): Handle new `list' context.
+ Handle insert-buffer and insert-file ido-exit values.
+ (ido-buffer-internal): New arg switch-cmd. Use it to setup
+ ido-context-switch-command. Handle insert-file ido-exit value.
+ (ido-read-buffer): Set ido-context-switch-command to 'ignore
+ unless it is already bound by caller.
+ (ido-file-internal): New arg switch-cmd. Use it to setup
+ ido-context-switch-command. Handle insert-buffer ido-exit value.
+ (ido-enter-insert-buffer, ido-enter-insert-file): New commands
+ used for context switching.
+ (ido-all-completions): Handle new `list' context.
+ (ido-make-choice-list): Return choices for `list' context.
+ (ido-find-file-in-dir, ido-display-file, ido-write-file)
+ (ido-display-buffer, ido-kill-buffer): Disable context switching.
+ (ido-insert-buffer, ido-insert-file): Setup context switching.
+ (ido-exhibit): Handle `list' context.
+ (ido-read-file-name): Disable context switching. Handle fallback.
+ (ido-read-directory-name): Disable context switching.
+ (ido-completing-read): New defun like completing-read. Setup and
+ use new `list' context.
+
+2004-09-20 Jesper Harder <harder@ifa.au.dk>
+
+ * progmodes/tcl.el (inferior-tcl): Use pop-to-buffer.
+
+2004-09-21 Luc Teirlinck <teirllm@auburn.edu>
+
+ * subr.el (after-change-major-mode-hook): Doc fix.
+
+2004-09-21 Vinicius Jose Latorre <viniciusjl@ig.com.br>
+
+ * printing.el: Doc fix. Add a new tip about the use of gsprint instead
+ of ghostscript for monochrome PostScript file in Windows.
+
2004-09-21 Kenichi Handa <handa@m17n.org>
* descr-text.el (describe-char): Checking of quail activation
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index df7bbe377ab..70d044c202e 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -210,13 +210,13 @@
"title \"" (symbol-name (nth 1 ydata)) "\" "
"with dots")
(setq pstyle (and (eq (car-safe pstyle) 'vec) (nth (1+ num) pstyle)))
- (setq lstyle (and (eq (car-safe lstyle) 'vec) (nth (1+ num) lstyle)))
- (calc-graph-set-styles
- (or (and (Math-num-integerp lstyle) (math-trunc lstyle))
- 0)
- (or (and (Math-num-integerp pstyle) (math-trunc pstyle))
- (if (eq (car-safe (calc-var-value (nth 2 ydata))) 'vec)
- 0 -1))))))
+ (setq lstyle (and (eq (car-safe lstyle) 'vec) (nth (1+ num) lstyle))))
+ (calc-graph-set-styles
+ (or (and (Math-num-integerp lstyle) (math-trunc lstyle))
+ 0)
+ (or (and (Math-num-integerp pstyle) (math-trunc pstyle))
+ (if (eq (car-safe (calc-var-value (nth 2 ydata))) 'vec)
+ 0 -1)))))
(defun calc-graph-lookup (thing)
(if (and (eq (car-safe thing) 'var)
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 43171255bbe..9d38cde21ce 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -4,6 +4,7 @@
;; 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <gmorris@ast.cam.ac.uk>
;; Keywords: calendar
;; Human-Keywords: calendar, Gregorian calendar, diary, holidays
@@ -1046,13 +1047,43 @@ See the documentation for `calendar-holidays' for details."
(defcustom christian-holidays
'((if all-christian-calendar-holidays
(holiday-fixed 1 6 "Epiphany"))
- (holiday-easter-etc)
+ (holiday-easter-etc 0 "Easter Sunday")
+ (holiday-easter-etc -2 "Good Friday")
+ (holiday-easter-etc -46 "Ash Wednesday")
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -63 "Septuagesima Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -56 "Sexagesima Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -49 "Shrove Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -48 "Shrove Monday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -47 "Shrove Tuesday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -14 "Passion Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -7 "Palm Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc -3 "Maundy Thursday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc 35 "Rogation Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc 39 "Ascension Day"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc 49 "Pentecost (Whitsunday)"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc 50 "Whitmonday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc 56 "Trinity Sunday"))
+ (if all-christian-calendar-holidays
+ (holiday-easter-etc 60 "Corpus Christi"))
(if all-christian-calendar-holidays
(holiday-greek-orthodox-easter))
(if all-christian-calendar-holidays
(holiday-fixed 8 15 "Assumption"))
(if all-christian-calendar-holidays
- (holiday-advent))
+ (holiday-advent 0 "Advent"))
(holiday-fixed 12 25 "Christmas")
(if all-christian-calendar-holidays
(holiday-julian 12 25 "Eastern Orthodox Christmas")))
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 71f73f24b75..a1adc080b2f 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -1,8 +1,10 @@
;;; holidays.el --- holiday functions for the calendar package
-;; Copyright (C) 1989, 90, 92, 93, 94, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2004 Free
+;; Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <gmorris@ast.cam.ac.uk>
;; Keywords: holidays, calendar
;; This file is part of GNU Emacs.
@@ -398,86 +400,46 @@ date. If date is nil, or if the date is not visible, there is no holiday."
(string (if date (eval string))))
(list (list date string)))))))
-(defun holiday-advent ()
- "Date of Advent, if visible in calendar window."
+(defun holiday-advent (n string)
+ "Date of Nth day after advent (named STRING), if visible in calendar window."
(let ((year displayed-year)
(month displayed-month))
(increment-calendar-month month year -1)
(let ((advent (calendar-gregorian-from-absolute
- (calendar-dayname-on-or-before 0
- (calendar-absolute-from-gregorian
- (list 12 3 year))))))
+ (+ n
+ (calendar-dayname-on-or-before
+ 0
+ (calendar-absolute-from-gregorian
+ (list 12 3 year)))))))
(if (calendar-date-is-visible-p advent)
- (list (list advent "Advent"))))))
-
-(defun holiday-easter-etc ()
- "List of dates related to Easter, as visible in calendar window."
- (if (and (> displayed-month 5) (not all-christian-calendar-holidays))
- nil;; Ash Wednesday, Good Friday, and Easter are not visible.
- (let* ((century (1+ (/ displayed-year 100)))
- (shifted-epact ;; Age of moon for April 5...
- (% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule
- (- ;; ...corrected for the Gregorian century rule
- (/ (* 3 century) 4))
- (/ ;; ...corrected for Metonic cycle inaccuracy.
- (+ 5 (* 8 century)) 25)
- (* 30 century));; Keeps value positive.
- 30))
- (adjusted-epact ;; Adjust for 29.5 day month.
- (if (or (= shifted-epact 0)
- (and (= shifted-epact 1) (< 10 (% displayed-year 19))))
- (1+ shifted-epact)
- shifted-epact))
- (paschal-moon ;; Day after the full moon on or after March 21.
- (- (calendar-absolute-from-gregorian (list 4 19 displayed-year))
- adjusted-epact))
- (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
- (mandatory
+ (list (list advent string))))))
+
+(defun holiday-easter-etc (n string)
+ "Date of Nth day after Easter (named STRING), if visible in calendar window."
+ (let* ((century (1+ (/ displayed-year 100)))
+ (shifted-epact ;; Age of moon for April 5...
+ (% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule
+ (- ;; ...corrected for the Gregorian century rule
+ (/ (* 3 century) 4))
+ (/ ;; ...corrected for Metonic cycle inaccuracy.
+ (+ 5 (* 8 century)) 25)
+ (* 30 century));; Keeps value positive.
+ 30))
+ (adjusted-epact ;; Adjust for 29.5 day month.
+ (if (or (= shifted-epact 0)
+ (and (= shifted-epact 1) (< 10 (% displayed-year 19))))
+ (1+ shifted-epact)
+ shifted-epact))
+ (paschal-moon ;; Day after the full moon on or after March 21.
+ (- (calendar-absolute-from-gregorian (list 4 19 displayed-year))
+ adjusted-epact))
+ (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
+ (mandatory
(list
- (list (calendar-gregorian-from-absolute abs-easter)
- "Easter Sunday")
- (list (calendar-gregorian-from-absolute (- abs-easter 2))
- "Good Friday")
- (list (calendar-gregorian-from-absolute (- abs-easter 46))
- "Ash Wednesday")))
- (optional
- (list
- (list (calendar-gregorian-from-absolute (- abs-easter 63))
- "Septuagesima Sunday")
- (list (calendar-gregorian-from-absolute (- abs-easter 56))
- "Sexagesima Sunday")
- (list (calendar-gregorian-from-absolute (- abs-easter 49))
- "Shrove Sunday")
- (list (calendar-gregorian-from-absolute (- abs-easter 48))
- "Shrove Monday")
- (list (calendar-gregorian-from-absolute (- abs-easter 47))
- "Shrove Tuesday")
- (list (calendar-gregorian-from-absolute (- abs-easter 14))
- "Passion Sunday")
- (list (calendar-gregorian-from-absolute (- abs-easter 7))
- "Palm Sunday")
- (list (calendar-gregorian-from-absolute (- abs-easter 3))
- "Maundy Thursday")
- (list (calendar-gregorian-from-absolute (+ abs-easter 35))
- "Rogation Sunday")
- (list (calendar-gregorian-from-absolute (+ abs-easter 39))
- "Ascension Day")
- (list (calendar-gregorian-from-absolute (+ abs-easter 49))
- "Pentecost (Whitsunday)")
- (list (calendar-gregorian-from-absolute (+ abs-easter 50))
- "Whitmonday")
- (list (calendar-gregorian-from-absolute (+ abs-easter 56))
- "Trinity Sunday")
- (list (calendar-gregorian-from-absolute (+ abs-easter 60))
- "Corpus Christi")))
- (output-list
- (filter-visible-calendar-holidays mandatory)))
- (if all-christian-calendar-holidays
- (setq output-list
- (append
- (filter-visible-calendar-holidays optional)
- output-list)))
- output-list)))
+ (list (calendar-gregorian-from-absolute (+ abs-easter n))
+ string)))
+ (output-list (filter-visible-calendar-holidays mandatory)))
+ output-list))
(defun holiday-greek-orthodox-easter ()
"Date of Easter according to the rule of the Council of Nicaea."
diff --git a/lisp/ido.el b/lisp/ido.el
index b82338ef85d..f9066544e1f 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -666,6 +666,14 @@ See also `ido-dir-file-cache' and `ido-save-directory-list-file'."
:type 'integer
:group 'ido)
+(defcustom ido-max-directory-size 30000
+ "*Maximum size (in bytes) for directories to use ido completion.
+If you enter a directory with a size larger than this size, ido will
+not provide the normal completion. To show the completions, use C-a."
+ :type '(choice (const :tag "No limit" nil)
+ (integer :tag "Size in bytes" 30000))
+ :group 'ido)
+
(defcustom ido-rotate-file-list-default nil
"*Non-nil means that `ido' will always rotate file list to get default in front."
:type 'boolean
@@ -699,9 +707,9 @@ Obsolete. Set 3rd element of `ido-decorations' instead."
:type '(choice string (const nil))
:group 'ido)
-(defcustom ido-decorations '( "{" "}" " | " " | ..." "[" "]" " [No match]" " [Matched]" " [Not readable]")
+(defcustom ido-decorations '( "{" "}" " | " " | ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]")
"*List of strings used by ido to display the alternatives in the minibuffer.
-There are 9 elements in this list:
+There are 10 elements in this list:
1st and 2nd elements are used as brackets around the prospect list,
3rd element is the separator between prospects (ignored if ido-separator is set),
4th element is the string inserted at the end of a truncated list of prospects,
@@ -709,7 +717,8 @@ There are 9 elements in this list:
can be completed using TAB,
7th element is the string displayed when there are a no matches, and
8th element is displayed if there is a single match (and faces are not used).
-9th element is displayed when the current directory is non-readable."
+9th element is displayed when the current directory is non-readable.
+10th element is displayed when directory exceeds `ido-max-directory-size'."
:type '(repeat string)
:group 'ido)
@@ -933,7 +942,7 @@ it doesn't interfere with other minibuffer usage.")
;;; Variables with dynamic bindings.
;;; Declared here to keep the byte compiler quiet.
-;; Stores the current ido item type ('file, 'dir or 'buffer).
+;; Stores the current ido item type ('file, 'dir, 'buffer, or 'list).
(defvar ido-cur-item)
;; Stores the current list of items that will be searched through.
@@ -942,6 +951,9 @@ it doesn't interfere with other minibuffer usage.")
;; at the end of the list. Created by `ido-make-item-list'.
(defvar ido-cur-list)
+;; Stores the choice list for ido-completing-read
+(defvar ido-choice-list)
+
;; Stores the list of items which are ignored when building
;; `ido-cur-list'. It is in no specific order.
(defvar ido-ignored-list)
@@ -949,6 +961,9 @@ it doesn't interfere with other minibuffer usage.")
;; Remember if current directory is non-readable (so we cannot do completion).
(defvar ido-directory-nonreadable)
+;; Remember if current directory is 'huge' (so we don't want to do completion).
+(defvar ido-directory-too-big)
+
;; Keep current item list if non-nil.
(defvar ido-keep-item-list)
@@ -992,6 +1007,8 @@ it doesn't interfere with other minibuffer usage.")
;; Stores temporary state of literal find file.
(defvar ido-find-literal)
+;; Set to 'ignore to inhibit switching between find-file/switch-buffer.
+(defvar ido-context-switch-command)
;;; FUNCTIONS
@@ -1077,6 +1094,8 @@ it doesn't interfere with other minibuffer usage.")
(defun ido-may-cache-directory (&optional dir)
(setq dir (or dir ido-current-directory))
(cond
+ ((ido-directory-too-big-p dir)
+ nil)
((and (ido-is-root-directory dir)
(or ido-enable-tramp-completion
(memq system-type '(windows-nt ms-dos))))
@@ -1346,8 +1365,8 @@ This function also adds a hook to the minibuffer."
(define-key map "?" 'ido-completion-help)
(when (memq ido-cur-item '(file dir))
- (define-key map "\C-b" 'ido-enter-switch-buffer)
- (define-key map "\C-d" 'ido-enter-dired)
+ (define-key map "\C-b" (or ido-context-switch-command 'ido-enter-switch-buffer))
+ (define-key map "\C-d" (or (and ido-context-switch-command 'ignore) 'ido-enter-dired))
(define-key map "\C-f" 'ido-fallback-command)
(define-key map [down] 'ido-next-match-dir)
(define-key map [up] 'ido-prev-match-dir)
@@ -1378,8 +1397,8 @@ This function also adds a hook to the minibuffer."
)
(when (eq ido-cur-item 'buffer)
+ (define-key map "\C-f" (or ido-context-switch-command 'ido-enter-find-file))
(define-key map "\C-b" 'ido-fallback-command)
- (define-key map "\C-f" 'ido-enter-find-file)
(define-key map "\C-k" 'ido-kill-buffer-at-head)
)
@@ -1420,6 +1439,16 @@ This function also adds a hook to the minibuffer."
(file-directory-p dir)
(not (file-readable-p dir)))))
+(defun ido-directory-too-big-p (dir)
+ ;; Return t if dir is a directory, but too big to show
+ ;; Do not check for non-readable directories via tramp, as this causes a premature
+ ;; connect on incomplete tramp paths (after entring just method:).
+ (let ((ido-enable-tramp-completion nil))
+ (and (numberp ido-max-directory-size)
+ (ido-final-slash dir)
+ (file-directory-p dir)
+ (> (nth 7 (file-attributes dir)) ido-max-directory-size))))
+
(defun ido-set-current-directory (dir &optional subdir no-merge)
;; Set ido's current directory to DIR or DIR/SUBDIR
(setq dir (ido-final-slash dir t))
@@ -1434,6 +1463,8 @@ This function also adds a hook to the minibuffer."
(if (get-buffer ido-completion-buffer)
(kill-buffer ido-completion-buffer))
(setq ido-directory-nonreadable (ido-nonreadable-directory-p dir))
+ (setq ido-directory-too-big (and (not ido-directory-nonreadable)
+ (ido-directory-too-big-p dir)))
t))
(defun ido-set-current-home (&optional dir)
@@ -1618,13 +1649,20 @@ If INITIAL is non-nil, it specifies the initial input string."
ido-rescan nil))
((eq ido-cur-item 'file)
(setq ido-ignored-list nil
- ido-cur-list (ido-make-file-list ido-default-item)))
+ ido-cur-list (and (not ido-directory-nonreadable)
+ (not ido-directory-too-big)
+ (ido-make-file-list ido-default-item))))
((eq ido-cur-item 'dir)
(setq ido-ignored-list nil
- ido-cur-list (ido-make-dir-list ido-default-item)))
+ ido-cur-list (and (not ido-directory-nonreadable)
+ (not ido-directory-too-big)
+ (ido-make-dir-list ido-default-item))))
((eq ido-cur-item 'buffer)
(setq ido-ignored-list nil
ido-cur-list (ido-make-buffer-list ido-default-item)))
+ ((eq ido-cur-item 'list)
+ (setq ido-ignored-list nil
+ ido-cur-list (ido-make-choice-list ido-default-item)))
(t nil))
(setq ido-rotate-temp nil)
@@ -1709,7 +1747,7 @@ If INITIAL is non-nil, it specifies the initial input string."
((eq ido-exit 'keep)
(setq ido-keep-item-list t))
- ((memq ido-exit '(dired fallback findfile findbuffer))
+ ((memq ido-exit '(dired fallback find-file switch-to-buffer insert-buffer insert-file))
(setq done t))
((eq ido-exit 'updir)
@@ -1789,19 +1827,26 @@ If INITIAL is non-nil, it specifies the initial input string."
(exit-minibuffer))
;;; MAIN FUNCTIONS
-(defun ido-buffer-internal (method &optional fallback prompt default initial)
+(defun ido-buffer-internal (method &optional fallback prompt default initial switch-cmd)
;; Internal function for ido-switch-buffer and friends
(if (not ido-mode)
(call-interactively (or fallback 'switch-to-buffer))
- (let ((buf (ido-read-buffer (or prompt "Buffer: ") default nil initial)))
+ (let* ((ido-context-switch-command switch-cmd)
+ (ido-current-directory nil)
+ (ido-directory-nonreadable nil)
+ (ido-directory-too-big nil)
+ (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default nil initial)))
;; Choose the buffer name: either the text typed in, or the head
;; of the list of matches
(cond
- ((eq ido-exit 'findfile)
+ ((eq ido-exit 'find-file)
(ido-file-internal ido-default-file-method nil nil nil nil ido-text))
+ ((eq ido-exit 'insert-file)
+ (ido-file-internal 'insert 'insert-file nil "Insert file: " nil ido-text 'ido-enter-insert-buffer))
+
((eq ido-exit 'fallback)
(let ((read-buffer-function nil))
(call-interactively (or fallback 'switch-to-buffer))))
@@ -1833,18 +1878,6 @@ If INITIAL is non-nil, it specifies the initial input string."
(set-buffer-major-mode buf))
(ido-visit-buffer buf method t))))))
-;;;###autoload
-(defun ido-read-buffer (prompt &optional default require-match initial)
- "Replacement for the built-in `read-buffer'.
-Return the name of a buffer selected.
-PROMPT is the prompt to give to the user. DEFAULT if given is the default
-buffer to be selected, which will go to the front of the list.
-If REQUIRE-MATCH is non-nil, an existing-buffer must be selected.
-If INITIAL is non-nil, it specifies the initial input string."
- (let ((ido-current-directory nil)
- (ido-directory-nonreadable nil))
- (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match initial)))
-
(defun ido-record-work-directory (&optional dir)
(when (and (numberp ido-max-work-directory-list) (> ido-max-work-directory-list 0))
(if (and (setq dir (or dir ido-current-directory)) (> (length dir) 0))
@@ -1886,12 +1919,15 @@ If INITIAL is non-nil, it specifies the initial input string."
;; Add final slash to result in case it was missing from DEFAULT-DIRECTORY.
(ido-final-slash (expand-file-name (or dir default-directory)) t))
-(defun ido-file-internal (method &optional fallback default prompt item initial)
+(defun ido-file-internal (method &optional fallback default prompt item initial switch-cmd)
;; Internal function for ido-find-file and friends
(unless item
(setq item 'file))
(let* ((ido-current-directory (ido-expand-directory default))
(ido-directory-nonreadable (ido-nonreadable-directory-p ido-current-directory))
+ (ido-directory-too-big (and (not ido-directory-nonreadable)
+ (ido-directory-too-big-p ido-current-directory)))
+ (ido-context-switch-command switch-cmd)
filename)
(cond
@@ -1943,9 +1979,12 @@ If INITIAL is non-nil, it specifies the initial input string."
(read-file-name-function nil))
(call-interactively (or fallback 'find-file))))
- ((eq ido-exit 'findbuffer)
+ ((eq ido-exit 'switch-to-buffer)
(ido-buffer-internal ido-default-buffer-method nil nil nil ido-text))
+ ((eq ido-exit 'insert-buffer)
+ (ido-buffer-internal 'insert 'insert-buffer "Insert buffer: " nil ido-text 'ido-enter-insert-file))
+
((eq ido-exit 'dired)
(dired (concat ido-current-directory (or ido-text ""))))
@@ -2062,6 +2101,12 @@ If INITIAL is non-nil, it specifies the initial input string."
(setq ido-exit 'refresh)
(exit-minibuffer))))
+ (ido-directory-too-big
+ (setq ido-directory-too-big nil)
+ (setq ido-text-init ido-text)
+ (setq ido-exit 'refresh)
+ (exit-minibuffer))
+
((not ido-matches)
(when ido-completion-buffer
(call-interactively (setq this-command ido-cannot-complete-command))))
@@ -2165,7 +2210,9 @@ If no merge has yet taken place, toggle automatic merging option."
(defun ido-toggle-ignore ()
"Toggle ignoring files specified with `ido-ignore-files'."
(interactive)
- (setq ido-process-ignore-lists (not ido-process-ignore-lists))
+ (if ido-directory-too-big
+ (setq ido-directory-too-big nil)
+ (setq ido-process-ignore-lists (not ido-process-ignore-lists)))
(setq ido-text-init ido-text)
(setq ido-exit 'refresh)
(exit-minibuffer))
@@ -2227,13 +2274,13 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
(defun ido-enter-find-file ()
"Drop into find-file from buffer switching."
(interactive)
- (setq ido-exit 'findfile)
+ (setq ido-exit 'find-file)
(exit-minibuffer))
(defun ido-enter-switch-buffer ()
"Drop into ido-switch-buffer from file switching."
(interactive)
- (setq ido-exit 'findbuffer)
+ (setq ido-exit 'switch-to-buffer)
(exit-minibuffer))
(defun ido-enter-dired ()
@@ -2242,6 +2289,18 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
(setq ido-exit 'dired)
(exit-minibuffer))
+(defun ido-enter-insert-buffer ()
+ "Drop into insert buffer from insert file."
+ (interactive)
+ (setq ido-exit 'insert-buffer)
+ (exit-minibuffer))
+
+(defun ido-enter-insert-file ()
+ "Drop into insert file from insert buffer."
+ (interactive)
+ (setq ido-exit 'insert-file)
+ (exit-minibuffer))
+
(defun ido-up-directory (&optional clear)
"Go up one directory level."
@@ -2295,6 +2354,7 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
(not (equal dir ido-current-directory))
(file-directory-p dir)
(or (not must-match)
+ ;; TODO. check for nonreadable and too-big.
(ido-set-matches1
(if (eq ido-cur-item 'file)
(ido-make-file-list1 dir)
@@ -2552,7 +2612,8 @@ for first matching file."
(defun ido-all-completions ()
;; Return unsorted list of all competions.
- (let ((ido-process-ignore-lists nil))
+ (let ((ido-process-ignore-lists nil)
+ (ido-directory-too-big nil))
(cond
((eq ido-cur-item 'file)
(ido-make-file-list1 ido-current-directory))
@@ -2560,6 +2621,8 @@ for first matching file."
(ido-make-dir-list1 ido-current-directory))
((eq ido-cur-item 'buffer)
(ido-make-buffer-list1))
+ ((eq ido-cur-item 'list)
+ ido-choice-list)
(t nil))))
@@ -2669,6 +2732,7 @@ for first matching file."
(or ido-merge-ftp-work-directories
(not (ido-is-ftp-directory dir)))
(file-directory-p dir)
+ ;; TODO. check for nonreadable and too-big.
(setq fl (if (eq ido-cur-item 'file)
(ido-make-file-list1 dir t)
(ido-make-dir-list1 dir t))))
@@ -2722,6 +2786,20 @@ for first matching file."
(run-hooks 'ido-make-buffer-list-hook)
ido-temp-list))
+(defun ido-make-choice-list (default)
+ ;; Return the current list of choices.
+ ;; If DEFAULT is non-nil, and corresponds to an element of choices,
+ ;; it is put to the start of the list.
+ (let ((ido-temp-list ido-choice-list))
+ (if default
+ (progn
+ (setq ido-temp-list
+ (delete default ido-temp-list))
+ (setq ido-temp-list
+ (cons default ido-temp-list))))
+ ; (run-hooks 'ido-make-choice-list-hook)
+ ido-temp-list))
+
(defun ido-to-end (items)
;; Move the elements from ITEMS to the end of `ido-temp-list'
(mapcar
@@ -2735,6 +2813,8 @@ for first matching file."
(defun ido-file-name-all-completions1 (dir)
(cond
((ido-nonreadable-directory-p dir) '())
+ ;; do not check (ido-directory-too-big-p dir) here.
+ ;; Caller must have done that if necessary.
((and ido-enable-tramp-completion
(string-match "\\`/\\([^/:]+:\\([^/:@]+@\\)?\\)\\'" dir))
@@ -3277,7 +3357,7 @@ For details of keybindings, do `\\[describe-function] ido'."
The buffer name is selected interactively by typing a substring.
For details of keybindings, do `\\[describe-function] ido'."
(interactive)
- (ido-buffer-internal 'display 'display-buffer))
+ (ido-buffer-internal 'display 'display-buffer nil nil nil 'ignore))
;;;###autoload
(defun ido-kill-buffer ()
@@ -3285,7 +3365,7 @@ For details of keybindings, do `\\[describe-function] ido'."
The buffer name is selected interactively by typing a substring.
For details of keybindings, do `\\[describe-function] ido'."
(interactive)
- (ido-buffer-internal 'kill 'kill-buffer "Kill buffer: " (buffer-name (current-buffer))))
+ (ido-buffer-internal 'kill 'kill-buffer "Kill buffer: " (buffer-name (current-buffer)) nil 'ignore))
;;;###autoload
(defun ido-insert-buffer ()
@@ -3293,7 +3373,7 @@ For details of keybindings, do `\\[describe-function] ido'."
The buffer name is selected interactively by typing a substring.
For details of keybindings, do `\\[describe-function] ido'."
(interactive)
- (ido-buffer-internal 'insert 'insert-buffer "Insert buffer: "))
+ (ido-buffer-internal 'insert 'insert-buffer "Insert buffer: " nil nil 'ido-enter-insert-file))
;;;###autoload
(defun ido-switch-buffer-other-frame ()
@@ -3311,7 +3391,7 @@ For details of keybindings, do `\\[describe-function] ido'."
(interactive "DDir: ")
(if (not (equal (substring dir -1) "/"))
(setq dir (concat dir "/")))
- (ido-file-internal ido-default-file-method nil dir))
+ (ido-file-internal ido-default-file-method nil dir nil nil nil 'ignore))
;;;###autoload
(defun ido-find-file ()
@@ -3404,7 +3484,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
The file name is selected interactively by typing a substring.
For details of keybindings, do `\\[describe-function] ido-find-file'."
(interactive)
- (ido-file-internal 'display))
+ (ido-file-internal 'display nil nil nil nil nil 'ignore))
;;;###autoload
(defun ido-find-file-other-frame ()
@@ -3426,7 +3506,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(ido-report-no-match nil)
(ido-confirm-unique-completion t)
(ido-auto-merge-work-directories-length -1))
- (ido-file-internal 'write 'write-file nil "Write file: ")))
+ (ido-file-internal 'write 'write-file nil "Write file: " nil nil 'ignore)))
;;;###autoload
(defun ido-insert-file ()
@@ -3434,7 +3514,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
The file name is selected interactively by typing a substring.
For details of keybindings, do `\\[describe-function] ido-find-file'."
(interactive)
- (ido-file-internal 'insert 'insert-file nil "Insert file: "))
+ (ido-file-internal 'insert 'insert-file nil "Insert file: " nil nil 'ido-enter-insert-buffer))
;;;###autoload
(defun ido-dired ()
@@ -3515,7 +3595,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
;; Handle explicit directory changes
(cond
- ((eq ido-cur-item 'buffer)
+ ((memq ido-cur-item '(buffer list))
)
((= (length contents) 0)
@@ -3571,7 +3651,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(expand-file-name "/" ido-current-directory)
"/"))
(setq refresh t))
- ((and ido-directory-nonreadable
+ ((and (or ido-directory-nonreadable ido-directory-too-big)
(file-directory-p (concat ido-current-directory (file-name-directory contents))))
(ido-set-current-directory
(concat ido-current-directory (file-name-directory contents)))
@@ -3633,6 +3713,7 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(when (and (not ido-matches)
(not ido-directory-nonreadable)
+ (not ido-directory-too-big)
;; ido-rescan ?
ido-process-ignore-lists
ido-ignored-list)
@@ -3656,7 +3737,8 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(not (ido-is-root-directory))
(> (length contents) 1)
(not (string-match "[$]" contents))
- (not ido-directory-nonreadable))
+ (not ido-directory-nonreadable)
+ (not ido-directory-too-big))
(ido-trace "merge?")
(if ido-use-merged-list
(ido-undo-merge-work-directory contents nil)
@@ -3721,6 +3803,8 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(cond
(ido-directory-nonreadable
(or (nth 8 ido-decorations) " [Not readable]"))
+ (ido-directory-too-big
+ (or (nth 9 ido-decorations) " [Too big]"))
(ido-report-no-match
(nth 6 ido-decorations)) ;; [No match]
(t "")))
@@ -3827,41 +3911,75 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(put 'dired-do-rename 'ido 'ignore)
;;;###autoload
+(defun ido-read-buffer (prompt &optional default require-match)
+ "Ido replacement for the built-in `read-buffer'.
+Return the name of a buffer selected.
+PROMPT is the prompt to give to the user. DEFAULT if given is the default
+buffer to be selected, which will go to the front of the list.
+If REQUIRE-MATCH is non-nil, an existing-buffer must be selected."
+ (let* ((ido-current-directory nil)
+ (ido-directory-nonreadable nil)
+ (ido-directory-too-big nil)
+ (ido-context-switch-command 'ignore)
+ (buf (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match)))
+ (if (eq ido-exit 'fallback)
+ (let ((read-buffer-function nil))
+ (read-buffer prompt default require-match))
+ buf)))
+
+;;;###autoload
(defun ido-read-file-name (prompt &optional dir default-filename mustmatch initial predicate)
- "Read file name, prompting with PROMPT and completing in directory DIR.
+ "Ido replacement for the built-in `read-file-name'.
+Read file name, prompting with PROMPT and completing in directory DIR.
See `read-file-name' for additional parameters."
- (cond
- ((or (eq predicate 'file-directory-p)
- (eq (get this-command 'ido) 'dir)
- (memq this-command ido-read-file-name-as-directory-commands))
- (ido-read-directory-name prompt dir default-filename mustmatch initial))
- ((and (not (eq (get this-command 'ido) 'ignore))
- (not (memq this-command ido-read-file-name-non-ido))
- (or (null predicate) (eq predicate 'file-exists-p)))
- (let* (filename
- ido-saved-vc-hb
- (vc-handled-backends (and (boundp 'vc-handled-backends) vc-handled-backends))
- (ido-current-directory (ido-expand-directory dir))
- (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
- (ido-work-directory-index -1)
- (ido-work-file-index -1)
- (ido-find-literal nil))
- (setq filename
- (ido-read-internal 'file prompt 'ido-file-history default-filename mustmatch initial))
- (if filename
- (concat ido-current-directory filename))))
- (t
- (let ((read-file-name-function nil))
- (read-file-name prompt dir default-filename mustmatch initial predicate)))))
+ (let (filename)
+ (cond
+ ((or (eq predicate 'file-directory-p)
+ (eq (get this-command 'ido) 'dir)
+ (memq this-command ido-read-file-name-as-directory-commands))
+ (setq filename
+ (ido-read-directory-name prompt dir default-filename mustmatch initial)))
+ ((and (not (eq (get this-command 'ido) 'ignore))
+ (not (memq this-command ido-read-file-name-non-ido))
+ (or (null predicate) (eq predicate 'file-exists-p)))
+ (let* (ido-saved-vc-hb
+ (ido-context-switch-command 'ignore)
+ (vc-handled-backends (and (boundp 'vc-handled-backends) vc-handled-backends))
+ (ido-current-directory (ido-expand-directory dir))
+ (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
+ (ido-directory-too-big (and (not ido-directory-nonreadable)
+ (ido-directory-too-big-p ido-current-directory)))
+ (ido-work-directory-index -1)
+ (ido-work-file-index -1)
+ (ido-find-literal nil))
+ (setq ido-exit nil)
+ (setq filename
+ (ido-read-internal 'file prompt 'ido-file-history default-filename mustmatch initial))
+ (cond
+ ((eq ido-exit 'fallback)
+ (setq filename 'fallback))
+ (filename
+ (setq filename
+ (concat ido-current-directory filename))))))
+ (t
+ (setq filename 'fallback)))
+ (if (eq filename 'fallback)
+ (let ((read-file-name-function nil))
+ (read-file-name prompt dir default-filename mustmatch initial predicate))
+ filename)))
;;;###autoload
(defun ido-read-directory-name (prompt &optional dir default-dirname mustmatch initial)
- "Read directory name, prompting with PROMPT and completing in directory DIR.
-See `read-file-name' for additional parameters."
+ "Ido replacement for the built-in `read-directory-name'.
+Read directory name, prompting with PROMPT and completing in directory DIR.
+See `read-directory-name' for additional parameters."
(let* (filename
+ (ido-context-switch-command 'ignore)
ido-saved-vc-hb
(ido-current-directory (ido-expand-directory dir))
(ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
+ (ido-directory-too-big (and (not ido-directory-nonreadable)
+ (ido-directory-too-big-p ido-current-directory)))
(ido-work-directory-index -1)
(ido-work-file-index -1))
(setq filename
@@ -3871,5 +3989,29 @@ See `read-file-name' for additional parameters."
ido-current-directory
(concat ido-current-directory filename)))))
+;;;###autoload
+(defun ido-completing-read (prompt choices &optional predicate require-match initial-input hist def)
+ "Ido replacement for the built-in `completing-read'.
+Read a string in the minibuffer with ido-style completion.
+PROMPT is a string to prompt with; normally it ends in a colon and a space.
+CHOICES is a list of strings which are the possible completions.
+PREDICATE is currently ignored; it is included to be compatible
+ with `completing-read'.
+If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
+ the input is (or completes to) an element of CHOICES or is null.
+ If the input is null, `ido-completing-read' returns DEF, or an empty
+ string if DEF is nil, regardless of the value of REQUIRE-MATCH.
+If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
+ with point positioned at the end.
+HIST, if non-nil, specifies a history list.
+DEF, if non-nil, is the default value."
+ (let ((ido-current-directory nil)
+ (ido-directory-nonreadable nil)
+ (ido-directory-too-big nil)
+ (ido-context-switch-command 'ignore)
+ (ido-choice-list choices))
+ (ido-read-internal 'list prompt hist def require-match initial-input)))
+
+
;;; arch-tag: b63a3500-1735-41bd-8a01-05373f0864da
;;; ido.el ends here
diff --git a/lisp/image.el b/lisp/image.el
index ad8fcafe8de..13fdf2f6e4c 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -228,6 +228,15 @@ height of the image; integer values are taken as pixel values."
(defun insert-sliced-image (image &optional string area rows cols)
+ "Insert IMAGE into current buffer at point.
+IMAGE is displayed by inserting STRING into the current buffer
+with a `display' property whose value is the image. STRING is
+defaulted if you omit it.
+AREA is where to display the image. AREA nil or omitted means
+display it in the text area, a value of `left-margin' means
+display it in the left marginal area, a value of `right-margin'
+means display it in the right marginal area.
+The image is automatically split into ROW x COLS slices."
(unless string (setq string " "))
(unless (eq (car-safe image) 'image)
(error "Not an image: %s" image))
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 521729b764f..8944d4c20c0 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -534,7 +534,7 @@ SWITCHES, TIME-INDEX and NOW give the full switch list and time data."
" "
(ls-lisp-format-time file-attr time-index now)
" "
- file-name
+ (propertize file-name 'dired-filename t)
(if (stringp file-type) ; is a symbolic link
(concat " -> " file-type))
"\n"
diff --git a/lisp/printing.el b/lisp/printing.el
index 08303e0595d..a406e09b8c0 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -5,13 +5,13 @@
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
-;; Time-stamp: <2004/07/20 21:44:43 vinicius>
+;; Time-stamp: <2004/09/21 22:51:58 vinicius>
;; Keywords: wp, print, PostScript
;; Version: 6.8
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
(defconst pr-version "6.8"
- "printing.el, v 6.8 <2004/07/12 vinicius>
+ "printing.el, v 6.8 <2004/09/21 vinicius>
Please send all bug fixes and enhancements to
Vinicius Jose Latorre <viniciusjl@ig.com.br>
@@ -259,6 +259,17 @@ Please send all bug fixes and enhancements to
;; PostScript printer. So, please, don't include this printer in
;; `pr-txt-printer-alist' (which see).
;;
+;; 5. Use gsprint instead of ghostscript to print monochrome PostScript files
+;; in Windows. The gsprint utility is faster than ghostscript to print
+;; monochrome PostScript.
+;;
+;; The efficiency is similar to print non-monochrome PostScript file.
+;;
+;; Also the gsprint utility comes together with gsview distribution.
+;;
+;; For more information about gsprint see
+;; `http://www.cs.wisc.edu/~ghost/gsview/gsprint.htm'.
+;;
;;
;; Using `printing'
;; ----------------
@@ -922,6 +933,7 @@ Please send all bug fixes and enhancements to
;;
;; gswin32, gsview32
;; `http://www.gnu.org/software/ghostscript/ghostscript.html'
+;; gsprint `http://www.cs.wisc.edu/~ghost/gsview/gsprint.htm'.
;; enscript `http://people.ssh.fi/mtr/genscript/'
;; psnup `http://www.dcs.ed.ac.uk/home/ajcd/psutils/index.html'
;; redmon `http://www.cs.wisc.edu/~ghost/redmon/'
@@ -930,6 +942,9 @@ Please send all bug fixes and enhancements to
;; Acknowledgments
;; ---------------
;;
+;; Thanks to Lennart Borgman <lennart.borgman.073@student.lu.se> for gsprint
+;; suggestion (see tip 5 in section Tips).
+;;
;; Thanks to Drew Adams <drew.adams@oracle.com> for suggestions:
;; - directory processing.
;; - `pr-path-alist' variable.
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index ac370cc1030..6965dea9fc1 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -1,6 +1,6 @@
;;; tcl.el --- Tcl code editing commands for Emacs
-;; Copyright (C) 1994,98,1999,2000,01,02,2003 Free Software Foundation, Inc.
+;; Copyright (C) 1994,98,1999,2000,01,02,2003,2004 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Author: Tom Tromey <tromey@redhat.com>
@@ -1104,15 +1104,13 @@ See documentation for function `inferior-tcl-mode' for more information."
(list (if current-prefix-arg
(read-string "Run Tcl: " tcl-application)
tcl-application)))
- (if (not (comint-check-proc "*inferior-tcl*"))
- (progn
- (set-buffer (apply (function make-comint) "inferior-tcl" cmd nil
- tcl-command-switches))
- (inferior-tcl-mode)))
- (make-local-variable 'tcl-application)
- (setq tcl-application cmd)
+ (unless (comint-check-proc "*inferior-tcl*")
+ (set-buffer (apply (function make-comint) "inferior-tcl" cmd nil
+ tcl-command-switches))
+ (inferior-tcl-mode))
+ (set (make-local-variable 'tcl-application) cmd)
(setq inferior-tcl-buffer "*inferior-tcl*")
- (switch-to-buffer "*inferior-tcl*"))
+ (pop-to-buffer "*inferior-tcl*"))
(defalias 'run-tcl 'inferior-tcl)
diff --git a/lisp/subr.el b/lisp/subr.el
index bed5489a1dd..e5a967310d5 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1938,8 +1938,7 @@ in BODY."
(put 'delay-mode-hooks 'permanent-local t)
(defvar after-change-major-mode-hook nil
- "Mode independent hook run at the end of major mode functions.
-This is run just before the mode dependent hooks.")
+ "Normal hook run at the very end of major mode functions.")
(defun run-mode-hooks (&rest hooks)
"Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS.
@@ -1959,6 +1958,8 @@ Major mode functions should use this."
(defmacro delay-mode-hooks (&rest body)
"Execute BODY, but delay any `run-mode-hooks'.
+These hooks will be executed by the first following call to
+`run-mode-hooks' that occurs outside any `delayed-mode-hooks' form.
Only affects hooks run in the current buffer."
(declare (debug t))
`(progn
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index f25bec2d841..4db493803ef 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -154,6 +154,12 @@ them and their old values to `enriched-old-bindings'."
The value is a list of \(VAR VALUE VAR VALUE...).")
(make-variable-buffer-local 'enriched-old-bindings)
+;; The next variable is buffer local if and only if Enriched mode is
+;; enabled. The buffer local value records whether
+;; `default-text-properties' should remain buffer local when disabling
+;; Enriched mode. For technical reasons, the default value should be t.
+(defvar enriched-default-text-properties-local-flag t)
+
;; Technical internal variable. Bound to t if `enriched-mode' is
;; being rerun by a major mode to allow it to restore buffer-local
;; variables and to correctly update `enriched-old-bindings'.
@@ -169,7 +175,7 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
"Minor mode for editing text/enriched files.
These are files with embedded formatting information in the MIME standard
text/enriched format.
-Turning the mode on runs `enriched-mode-hook'.
+Turning the mode on or off runs `enriched-mode-hook'.
More information about Enriched mode is available in the file
etc/enriched.doc in the Emacs distribution directory.
@@ -183,7 +189,11 @@ Commands:
(setq buffer-file-format (delq 'text/enriched buffer-file-format))
;; restore old variable values
(while enriched-old-bindings
- (set (pop enriched-old-bindings) (pop enriched-old-bindings))))
+ (set (pop enriched-old-bindings) (pop enriched-old-bindings)))
+ (unless enriched-default-text-properties-local-flag
+ (kill-local-variable 'default-text-properties))
+ (kill-local-variable 'enriched-default-text-properties-local-flag)
+ (unless use-hard-newlines (use-hard-newlines 0)))
((and (memq 'text/enriched buffer-file-format)
(not enriched-rerun-flag))
@@ -196,7 +206,11 @@ Commands:
;; These will be restored if we exit Enriched mode.
(setq enriched-old-bindings
(list 'buffer-display-table buffer-display-table
- 'default-text-properties default-text-properties))
+ 'default-text-properties default-text-properties
+ 'use-hard-newlines use-hard-newlines))
+ (make-local-variable 'enriched-default-text-properties-local-flag)
+ (setq enriched-default-text-properties-local-flag
+ (local-variable-p 'default-text-properties))
(make-local-variable 'default-text-properties)
(setq buffer-display-table enriched-display-table)
(use-hard-newlines 1 (if enriched-rerun-flag 'never nil))