On Mon, Mar 13, 2006 at 03:14:33PM -0000, Phillip Lord wrote: > Firstly, my diary cylic file tells me about selective display, > and suggests I remove it with "s" in Calendar. But this actually > takes me to the diary file, rather than diary.cyclic-tasks.
You may try this piece of code to keep diary files editable:
;; Diary support code in Emacs is ancient and uses obscure features
;; like `selective-display'. Using `fancy-diary-display' in the
;; `diary-display-hook' helps to avoid `selective-display' for the
;; diary file buffer in the usual case of calling the `diary' command
;; interactively. However, some Lisp code calls `list-diary-entries'
;; or `diary' after binding `diary-display-hook' to some other thing,
;; and then forgets to return the buffer to a sane state. One example
;; of such behavior is `appt-check'.
;;
;; This function attempts to fix the damage done by `appt-check'; it
;; should be added to `diary-hook' (which `appt-check' does not
;; touch). It will not fix the problem in all cases (e.g., some code
;; calling `list-diary-entries' might rebind `diary-hook' around it -
;; but in this case it is likely that it does some cleanup itself).
;;
(defun vsu/unscrew-diary-buffer ()
"Undo `selective-display' hackery performed by `list-diary-entries'."
(save-excursion
(set-buffer (find-buffer-visiting (substitute-in-file-name diary-file)))
(when selective-display
(let ((diary-modified (buffer-modified-p)))
(subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
(setq selective-display nil)
(kill-local-variable 'mode-line-format)
(set-buffer-modified-p diary-modified))))
;; Clear the "Preparing diary..." message
(message nil))
(add-hook 'diary-hook 'vsu/unscrew-diary-buffer)
;; `fancy-diary-display' does not just look nicer - it also undoes the
;; modifications which `list-diary-entries' does to the diary file
;; buffer (like setting `selective-display' and changing some
;; end-of-line characters to ^M). It is also required for
;; `planner-diary'.
;;
(add-hook 'diary-display-hook 'fancy-diary-display)
pgpHpFyuDCdnD.pgp
Description: PGP signature
_______________________________________________ emacs-wiki-discuss mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss
