Changeset - 4c5c4890f3c4
[Not reviewed]
0 1 0
Sergey Pashinin - 11 years ago 2014-08-08 19:17:34
sergey@pashinin.com
Fix for "notmuch" special buffer
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/workgroups-specialbufs.el
Show inline comments
 
@@ -301,193 +301,195 @@ You can get these commands using `wg-get-org-agenda-view-commands'."
 
          (switch-to-buffer (process-buffer (slime-process)))
 
          (current-buffer))))))
 

	
 
;; `comint-mode'  (general mode for all shells)
 
;;
 
;; It may have different shells. So we need to determine which shell is
 
;; now in `comint-mode' and how to restore it.
 
;;
 
;; Just executing `comint-exec' may be not enough because we can miss
 
;; some hooks or any other stuff that is executed when you run a
 
;; specific shell.
 
(defun wg-serialize-comint-buffer (buffer)
 
  "Serialize comint BUFFER."
 
  (with-current-buffer buffer
 
    (if (fboundp 'comint-mode)
 
        (when (eq major-mode 'comint-mode)
 
          ;; `slime-inferior-lisp-args' var is used when in `slime'
 
          (when (and (boundp 'slime-inferior-lisp-args)
 
                     slime-inferior-lisp-args)
 
            (list 'wg-deserialize-slime-buffer
 
                  (list default-directory slime-inferior-lisp-args)
 
                ))))))
 

	
 
;; inf-mongo
 
;; https://github.com/tobiassvn/inf-mongo
 
;; `mongo-command' - command used to start inferior mongo
 
(wg-support 'inf-mongo-mode 'inf-mongo
 
            `((serialize . ,(lambda (buffer)
 
                              (if (boundp 'inf-mongo-command) inf-mongo-command)))
 
              (deserialize . ,(lambda (buffer vars)
 
                                (save-window-excursion
 
                                  (when (fboundp 'inf-mongo)
 
                                    (inf-mongo vars)))
 
                                (when (get-buffer "*mongo*")
 
                                  (switch-to-buffer "*mongo*")
 
                                  (goto-char (point-max)))))))
 

	
 
(defun wg-temporarily-rename-buffer-if-exists (buffer)
 
  "Rename BUFFER if it exists."
 
  (when (get-buffer buffer)
 
    (with-current-buffer buffer
 
      (rename-buffer "*wg--temp-buffer*" t))))
 

	
 
;; SML shell
 
;; Functions to serialize deserialize inferior sml buffer
 
;; `inf-sml-program' is the program run as inferior sml, is the
 
;; `inf-sml-args' are the extra parameters passed, `inf-sml-host'
 
;; is the host on which sml was running when serialized
 
(wg-support 'inferior-sml-mode 'sml-mode
 
            `((serialize . ,(lambda (buffer)
 
                              (list (if (boundp 'sml-program-name) sml-program-name)
 
                                    (if (boundp 'sml-default-arg) sml-default-arg)
 
                                    (if (boundp 'sml-host-name) sml-host-name))))
 
              (deserialize . ,(lambda (buffer vars)
 
                                (wg-dbind (program args host) vars
 
                                  (save-window-excursion
 
                                    ;; If a inf-sml buffer already exists rename it temporarily
 
                                    ;; otherwise `run-sml' will simply switch to the existing
 
                                    ;; buffer, however we want to create a separate buffer with
 
                                    ;; the serialized name
 
                                    (let* ((inf-sml-buffer-name (concat "*"
 
                                                                        (file-name-nondirectory program)
 
                                                                        "*"))
 
                                           (existing-sml-buf (wg-temporarily-rename-buffer-if-exists
 
                                                              inf-sml-buffer-name)))
 
                                      (with-current-buffer (run-sml program args host)
 
                                        ;; Rename the buffer
 
                                        (rename-buffer (wg-buf-name buffer) t)
 

	
 
                                        ;; Now we can re-rename the previously renamed buffer
 
                                        (when existing-sml-buf
 
                                          (with-current-buffer existing-sml-buf
 
                                            (rename-buffer inf-sml-buffer-name t))))))
 
                                  (switch-to-buffer (wg-buf-name buffer))
 
                                  (goto-char (point-max)))))))
 

	
 
;; Geiser repls
 
;; http://www.nongnu.org/geiser/
 
(wg-support 'geiser-repl-mode 'geiser
 
            `((save . (geiser-impl--implementation))
 
              (deserialize . ,(lambda (buffer vars)
 
                                (when (fboundp 'run-geiser)
 
                                  (wg-dbind (impl) vars
 
                                    (run-geiser impl)
 
                                    (goto-char (point-max))))
 
                                (switch-to-buffer (wg-buf-name buffer))))))
 

	
 
;; w3m-mode
 
(wg-support 'w3m-mode 'w3m
 
            `((save . (w3m-current-url))
 
              (deserialize . ,(lambda (buffer vars)
 
                                (wg-dbind (url) vars
 
                                  (w3m-goto-url url))))))
 

	
 
;; notmuch
 
(wg-support 'notmuch-hello-mode 'notmuch
 
            `((deserialize . ,(lambda (buffer vars) (notmuch)))))
 
            `((deserialize . ,(lambda (buffer vars)
 
                                (notmuch)
 
                                (get-buffer (wg-buf-name buffer))))))
 

	
 
;; Wanderlust modes:
 
;; WL - folders
 
;;(defun wg-deserialize-wl-folders-buffer (buf)
 
;;  ""
 
;;  (if (fboundp 'wl)
 
;;      (wg-dbind (this-function) (wg-buf-special-data buf)
 
;;        ;;(when (not (eq major-mode 'wl-folder-mode))
 
;;        (wl)
 
;;        (goto-char (point-max))
 
;;        (current-buffer)
 
;;        )))
 
;;
 
;;(defun wg-serialize-wl-folders-buffer (buffer)
 
;;  ""
 
;;  (if (fboundp 'wl)
 
;;      (with-current-buffer buffer
 
;;        (when (eq major-mode 'wl-folder-mode)
 
;;          (list 'wg-deserialize-wl-folders-buffer
 
;;                )))))
 

	
 
;; WL - summary mode (list of mails)
 
;;(defun wg-deserialize-wl-summary-buffer (buf)
 
;;  ""
 
;;  (interactive)
 
;;  (if (fboundp 'wl)
 
;;      (wg-dbind (this-function param-list) (wg-buf-special-data buf)
 
;;        (when (not (eq major-mode 'wl-summary-mode))
 
;;          (let ((fld-name (car param-list)))
 
;;            ;;(switch-to-buffer "*scratch*")
 
;;            ;;(wl)
 
;;            ;;(wl-folder-jump-folder fld-name)
 
;;            ;;(message fld-name)
 
;;            ;;(goto-char (point-max))
 
;;            ;;(insert fld-name)
 
;;            (current-buffer)
 
;;          )))))
 
;;
 
;;(defun wg-serialize-wl-summary-buffer (buffer)
 
;;  ""
 
;;  (if (fboundp 'wl)
 
;;      (with-current-buffer buffer
 
;;        (when (eq major-mode 'wl-summary-mode)
 
;;          (list 'wg-deserialize-wl-summary-buffer
 
;;                (wg-take-until-unreadable (list wl-summary-buffer-folder-name))
 
;;                )))))
 
;;
 
;;
 
;;;; mime-view-mode
 
;;
 
;;(defun wg-deserialize-mime-view-buffer (buf)
 
;;  ""
 
;;  (wg-dbind (this-function) (wg-buf-special-data buf)
 
;;    (when (not (eq major-mode 'mime-view-mode))
 
;;      ;;(wl-summary-enter-handler 3570)     ; only in wl-summary-mode
 
;;      ;;(wl-summary-enter-handler)     ; only in wl-summary-mode
 
;;      (current-buffer)
 
;;      )))
 
;;
 
;;(defun wg-serialize-mime-view-buffer (buffer)
 
;;  ""
 
;;  (with-current-buffer buffer
 
;;    (when (eq major-mode 'mime-view-mode)
 
;;      (list 'wg-deserialize-mime-view-buffer
 
;;            ))))
 

	
 

	
 
;; emms-playlist-mode
 
;;
 
;; Help me on this one:
 
;; 1. How to start emms without any user interaction?
 
;;
 
;;(defun wg-deserialize-emms-buffer (buf)
 
;;  "Deserialize emms-playlist buffer BUF."
 
;;  (when (require 'emms-setup nil 'noerror)
 
;;    (require 'emms-player-mplayer)
 
;;    (emms-standard)
 
;;    (emms-default-players)
 
;;    (if (fboundp 'emms-playlist-mode)
 
;;        (wg-dbind (this-function args) (wg-buf-special-data buf)
 
;;          (let ((default-directory (car args)))
 
;;            (save-window-excursion
 
;;              ;;(emms)
 
;;              (if (or (null emms-playlist-buffer)
 
;;                      (not (buffer-live-p emms-playlist-buffer)))
 
;;                  ;;(call-interactively 'emms-add-file)
 
;;                  (emms-source-directory "/usr/data/disk_3/Music/SORT/")
 
;;                ))
 
;;            ;; (emms)
 
;;            ;;(with-current-buffer emms-playlist-buffer-name
 
;;            ;;(emms-source-playlist-directory-tree "/usr/data/disk_3/Music/SORT/")
 
;;            ;;(emms-source-directory "/usr/data/disk_3/Music/SORT")
 
;;            ;;(switch-to-buffer emms-playlist-buffer-name)
 
;;            (emms-playlist-mode-go)
 
;;            (current-buffer)
 
;;            )))))
0 comments (0 inline, 0 general)