diff options
| author | Thomas Fitzsimmons | 2019-06-07 20:43:38 -0400 |
|---|---|---|
| committer | Thomas Fitzsimmons | 2019-06-07 21:26:21 -0400 |
| commit | 890a0826f3f68f4476f6ec0b56fe96c6bc047142 (patch) | |
| tree | a393fefd6000b0d63467c22e66382735bf0b1b61 | |
| parent | 58cde923414bbc313677116684505b961477c057 (diff) | |
| download | emacs-890a0826f3f68f4476f6ec0b56fe96c6bc047142.tar.gz emacs-890a0826f3f68f4476f6ec0b56fe96c6bc047142.zip | |
Make icalendar-import-buffer not show diary file buffer
* lisp/calendar/diary-lib.el (diary-make-entry): Add
omit-trailing-space parameter. Add do-not-show parameter to
allow not showing diary file buffer.
* lisp/calendar/icalendar.el (icalendar--add-diary-entry): Remove
workaround to omit trailing space in diary entry. Have
diary-make-entry not display the diary file buffer. (Bug#35645)
| -rw-r--r-- | lisp/calendar/diary-lib.el | 45 | ||||
| -rw-r--r-- | lisp/calendar/icalendar.el | 18 |
2 files changed, 30 insertions, 33 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 369a93ca178..a0e90c439bf 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -2062,27 +2062,34 @@ calendar." | |||
| 2062 | ;;; Diary insertion functions. | 2062 | ;;; Diary insertion functions. |
| 2063 | 2063 | ||
| 2064 | ;;;###cal-autoload | 2064 | ;;;###cal-autoload |
| 2065 | (defun diary-make-entry (string &optional nonmarking file) | 2065 | (defun diary-make-entry (string &optional nonmarking file omit-trailing-space |
| 2066 | do-not-show) | ||
| 2066 | "Insert a diary entry STRING which may be NONMARKING in FILE. | 2067 | "Insert a diary entry STRING which may be NONMARKING in FILE. |
| 2067 | If omitted, NONMARKING defaults to nil and FILE defaults to | 2068 | If omitted, NONMARKING defaults to nil and FILE defaults to |
| 2068 | `diary-file'." | 2069 | `diary-file'. If OMIT-TRAILING-SPACE is non-nil, then do not add |
| 2069 | (let ((pop-up-frames (or pop-up-frames (window-dedicated-p)))) | 2070 | a trailing space to the entry. If DO-NOT-SHOW is non-nil, do not |
| 2070 | (find-file-other-window (or file diary-file))) | 2071 | show the diary buffer." |
| 2071 | (when (eq major-mode (default-value 'major-mode)) (diary-mode)) | 2072 | (with-current-buffer |
| 2072 | (widen) | 2073 | (let ((diary-file-name (or file diary-file))) |
| 2073 | (diary-unhide-everything) | 2074 | (if do-not-show |
| 2074 | (goto-char (point-max)) | 2075 | (find-file-noselect diary-file-name) |
| 2075 | (when (let ((case-fold-search t)) | 2076 | (let ((pop-up-frames (or pop-up-frames (window-dedicated-p)))) |
| 2076 | (search-backward "Local Variables:" | 2077 | (find-file-other-window diary-file-name)))) |
| 2077 | (max (- (point-max) 3000) (point-min)) | 2078 | (when (eq major-mode (default-value 'major-mode)) (diary-mode)) |
| 2078 | t)) | 2079 | (widen) |
| 2079 | (beginning-of-line) | 2080 | (diary-unhide-everything) |
| 2080 | (insert "\n") | 2081 | (goto-char (point-max)) |
| 2081 | (forward-line -1)) | 2082 | (when (let ((case-fold-search t)) |
| 2082 | (insert | 2083 | (search-backward "Local Variables:" |
| 2083 | (if (bolp) "" "\n") | 2084 | (max (- (point-max) 3000) (point-min)) |
| 2084 | (if nonmarking diary-nonmarking-symbol "") | 2085 | t)) |
| 2085 | string " ")) | 2086 | (beginning-of-line) |
| 2087 | (insert "\n") | ||
| 2088 | (forward-line -1)) | ||
| 2089 | (insert | ||
| 2090 | (if (bolp) "" "\n") | ||
| 2091 | (if nonmarking diary-nonmarking-symbol "") | ||
| 2092 | string (if omit-trailing-space "" " ")))) | ||
| 2086 | 2093 | ||
| 2087 | ;;;###cal-autoload | 2094 | ;;;###cal-autoload |
| 2088 | (defun diary-insert-entry (arg &optional event) | 2095 | (defun diary-insert-entry (arg &optional event) |
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index a8fd765129e..17316ddbbd0 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -2502,20 +2502,10 @@ the entry." | |||
| 2502 | (when summary | 2502 | (when summary |
| 2503 | (setq non-marking | 2503 | (setq non-marking |
| 2504 | (y-or-n-p (format "Make appointment non-marking? ")))) | 2504 | (y-or-n-p (format "Make appointment non-marking? ")))) |
| 2505 | (save-window-excursion | 2505 | (unless diary-filename |
| 2506 | (unless diary-filename | 2506 | (setq diary-filename |
| 2507 | (setq diary-filename | 2507 | (read-file-name "Add appointment to this diary file: "))) |
| 2508 | (read-file-name "Add appointment to this diary file: "))) | 2508 | (diary-make-entry string non-marking diary-filename t t)) |
| 2509 | ;; Note: diary-make-entry will add a trailing blank char.... :( | ||
| 2510 | (funcall (if (fboundp 'diary-make-entry) | ||
| 2511 | 'diary-make-entry | ||
| 2512 | 'make-diary-entry) | ||
| 2513 | string non-marking diary-filename))) | ||
| 2514 | ;; Würgaround to remove the trailing blank char | ||
| 2515 | (with-current-buffer (find-file diary-filename) | ||
| 2516 | (goto-char (point-max)) | ||
| 2517 | (if (= (char-before) ? ) | ||
| 2518 | (delete-char -1))) | ||
| 2519 | ;; return diary-filename in case it has been changed interactively | 2509 | ;; return diary-filename in case it has been changed interactively |
| 2520 | diary-filename) | 2510 | diary-filename) |
| 2521 | 2511 | ||