Function: activities--bookmark-buffer
activities--bookmark-buffer is a byte-compiled function defined in
activities.el.
Signature
(activities--bookmark-buffer STRUCT)
Documentation
Return buffer for activities-buffer STRUCT.
Source Code
;; Defined in ~/.emacs.d/elpa/activities-0.7.2/activities.el
(defun activities--bookmark-buffer (struct)
"Return buffer for `activities-buffer' STRUCT."
;; NOTE: Be aware of the following note from burly.el:
;; NOTE: Due to changes in help-mode.el which serialize natively
;; compiled subrs in the bookmark props, which cannot be read
;; back (which actually break the entire bookmark system when
;; such a props is saved in the bookmarks file), we have to
;; workaround a failure to read here. See bug#56643.
;; Unfortunately, when a bookmarked file no longer exists,
;; `bookmark-handle-bookmark' handles the error itself and returns
;; nil, preventing us from handling the error. Since
;; `bookmark-jump' works by side effect, we have to test whether the
;; buffer was changed in order to know whether it worked. We call
;; it from a temp buffer in case the jumped-to buffer would be the
;; same as the current buffer.
;; FIXME: Use `bookmark-jump`'s DISPLAY-FUNC argument!
(with-temp-buffer
(pcase-let* (((cl-struct activities-buffer bookmark) struct)
(temp-buffer (current-buffer))
(error)
(jumped-to-buffer
(save-window-excursion
(condition-case err
(progn
(bookmark-jump bookmark)
(when-let ((local-variable-map
(bookmark-prop-get bookmark 'activities-buffer-local-variables)))
(cl-loop for (variable . value) in local-variable-map
do (setf (buffer-local-value variable (current-buffer)) value))))
(error (setf error (format "Error while opening bookmark: ERROR:%S RECORD:%S" err struct))))
(current-buffer))))
(if (not (eq temp-buffer jumped-to-buffer))
;; Bookmark appears to have been jumped to: return that buffer.
jumped-to-buffer
;; Bookmark appears to have not changed the buffer: return a new one showing an error.
(activities--error-buffer
(format "%s:%s" (car bookmark) (bookmark-prop-get bookmark 'filename))
(list "Activities was unable to get a buffer for bookmark:\n\n"
(prin1-to-string bookmark) "\n\n"
"Error: " (prin1-to-string error) "\n\n"
"It's likely that the bookmark's file no longer exists, in which case you may need to relocate it and redefine this activity.\n\n"
"If this is not the case, please report this error to the `activities' maintainer.\n\n"
"In the meantime, you may ignore this error and use the other buffers in the activity.\n\n"))))))