Commit 6dd2d9b9 authored by Glenn Morris's avatar Glenn Morris
Browse files

(diary-set-header, diary-live-p)

(diary-check-diary-file, diary-list-entries)
(diary-include-other-diary-files, diary-simple-display)
(diary-fancy-display, diary-print-entries)
(diary-mark-included-diary-files, diary-make-entry):
Don't call substitute-in-file-name on diary-file.
parent bbe21085
......@@ -355,9 +355,7 @@ template following the rules above."
(defun diary-set-header (symbol value)
"Set SYMBOL's value to VALUE, and redraw the diary header if necessary."
(let ((oldvalue (symbol-value symbol))
(dbuff (and diary-file
(substitute-in-file-name diary-file)))))
(dbuff (and diary-file (find-buffer-visiting diary-file))))
(custom-set-default symbol value)
(and dbuff
(not (equal value oldvalue))
......@@ -410,8 +408,7 @@ Only used if `diary-header-line-flag' is non-nil."
(defun diary-live-p ()
"Return non-nil if the diary is being displayed."
(or (get-buffer diary-fancy-buffer)
(and diary-file
(find-buffer-visiting (substitute-in-file-name diary-file)))))
(and diary-file (find-buffer-visiting diary-file))))
(defun diary-set-maybe-redraw (symbol value)
......@@ -463,12 +460,11 @@ of days of diary entries displayed."
(defun diary-check-diary-file ()
"Check that the file specified by `diary-file' exists and is readable.
If so, return the expanded file name, otherwise signal an error."
(let ((d-file (substitute-in-file-name diary-file)))
(if (and d-file (file-exists-p d-file))
(if (file-readable-p d-file)
(error "Diary file `%s' is not readable" diary-file))
(error "Diary file `%s' does not exist" diary-file))))
(if (and diary-file (file-exists-p diary-file))
(if (file-readable-p diary-file)
(error "Diary file `%s' is not readable" diary-file))
(error "Diary file `%s' does not exist" diary-file)))
(defun diary (&optional arg)
......@@ -659,7 +655,7 @@ any entries were found."
;; regexp moves us past the end of date, onto the next line.
;; Trailing whitespace after date not allowed (see diary-file).
(if (and (bolp) (not (looking-at "[ \t]")))
;; Diary entry that consists only of date.
;; Diary entry that consists only of date.
(backward-char 1)
;; Found a nonempty diary entry--make it
;; visible and add it to the list.
......@@ -746,13 +742,12 @@ LIST-ONLY is non-nil, in which case it just returns the list."
(when (> number 0)
(let* ((original-date date) ; save for possible use in the hooks
(date-string (calendar-date-string date))
(d-file (substitute-in-file-name diary-file))
(diary-buffer (find-buffer-visiting d-file))
(diary-buffer (find-buffer-visiting diary-file))
diary-entries-list file-glob-attrs)
(message "Preparing diary...")
(if (not diary-buffer)
(set-buffer (find-file-noselect d-file t))
(set-buffer (find-file-noselect diary-file t))
(set-buffer diary-buffer)
(or (verify-visited-file-modtime diary-buffer)
(revert-buffer t t)))
......@@ -827,12 +822,10 @@ the variable `diary-include-string'."
(while (re-search-forward
(format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string))
nil t)
(let ((diary-file (substitute-in-file-name
(match-string-no-properties 1)))
(diary-list-include-blanks nil)
(let ((diary-file (match-string-no-properties 1))
(diary-list-entries-hook 'diary-include-other-diary-files)
(diary-display-function 'ignore)
(diary-hook nil))
diary-hook diary-list-include-blanks)
(if (file-exists-p diary-file)
(if (file-readable-p diary-file)
......@@ -895,7 +888,7 @@ in the mode line. This is an option for `diary-display-function'."
;; to display the diary.
(let* ((pop-up-frames (or pop-up-frames
(window-dedicated-p (selected-window))))
(dbuff (find-buffer-visiting (substitute-in-file-name diary-file)))
(dbuff (find-buffer-visiting diary-file))
(empty (diary-display-no-entries)))
;; This may be too wide, but when simple diary is used there is
;; nowhere else for the holidays to go. Also, it is documented in
......@@ -951,8 +944,7 @@ holiday), unless `diary-list-include-blanks' is non-nil.
This is an option for `diary-display-function'."
;; Turn off selective-display in the diary file's buffer.
(find-buffer-visiting (substitute-in-file-name diary-file))
(with-current-buffer (find-buffer-visiting diary-file)
(unless (car (diary-display-no-entries)) ; no entries
;; Prepare the fancy diary buffer.
......@@ -1052,8 +1044,7 @@ the actual printing."
(if diary-buffer
(with-current-buffer diary-buffer
(run-hooks 'diary-print-entries-hook))
(or (setq diary-buffer
(find-buffer-visiting (substitute-in-file-name diary-file)))
(or (setq diary-buffer (find-buffer-visiting diary-file))
(error "You don't have a diary buffer!"))
;; Name affects printing?
(setq temp-buffer (get-buffer-create " *Printable Diary Entries*"))
......@@ -1393,8 +1384,7 @@ the variable `diary-include-string'."
(while (re-search-forward
(format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string))
nil t)
(let* ((diary-file (substitute-in-file-name
(match-string-no-properties 1)))
(let* ((diary-file (match-string-no-properties 1))
(diary-mark-entries-hook 'diary-mark-included-diary-files)
(dbuff (find-buffer-visiting diary-file)))
(if (file-exists-p diary-file)
......@@ -1982,7 +1972,7 @@ If omitted, NONMARKING defaults to nil and FILE defaults to
(let ((pop-up-frames (or pop-up-frames
(window-dedicated-p (selected-window)))))
(find-file-other-window (substitute-in-file-name (or file diary-file))))
(find-file-other-window (or file diary-file)))
(when (eq major-mode (default-value 'major-mode)) (diary-mode))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment