app/irc: remove hard dependencies on persp-mode

And fix wrong type argument perspective nil error on M-x circe
This commit is contained in:
Henrik Lissner 2019-12-26 22:40:29 -05:00
parent d1f4a77fbb
commit 01e728dad5
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -49,16 +49,17 @@ workspace for it."
(defun +irc/quit () (defun +irc/quit ()
"Kill current circe session and workgroup." "Kill current circe session and workgroup."
(interactive) (interactive)
(if (y-or-n-p "Really kill IRC session?") (unless (y-or-n-p "Really kill IRC session?")
(user-error "Aborted"))
(let (circe-channel-killed-confirmation (let (circe-channel-killed-confirmation
circe-server-killed-confirmation) circe-server-killed-confirmation)
(when +irc--defer-timer (when +irc--defer-timer
(cancel-timer +irc--defer-timer)) (cancel-timer +irc--defer-timer))
(disable-circe-notifications) (disable-circe-notifications)
(mapc #'kill-buffer (doom-buffers-in-mode 'circe-mode (buffer-list) t)) (mapc #'kill-buffer (doom-buffers-in-mode 'circe-mode (buffer-list) t))
(when (featurep! :ui workspaces)
(when (equal (+workspace-current-name) +irc--workspace-name) (when (equal (+workspace-current-name) +irc--workspace-name)
(+workspace/delete +irc--workspace-name))) (+workspace/delete +irc--workspace-name)))))
(message "Aborted")))
;;;###autoload ;;;###autoload
(defun +irc/ivy-jump-to-channel (&optional this-server) (defun +irc/ivy-jump-to-channel (&optional this-server)
@ -90,7 +91,7 @@ argument) is non-nil only show channels in current server."
;;;###autoload ;;;###autoload
(defun +irc/tracking-next-buffer () (defun +irc/tracking-next-buffer ()
"Dissables switching to an unread buffer unless in the irc workspace." "Disables switching to an unread buffer unless in the irc workspace."
(interactive) (interactive)
(when (derived-mode-p 'circe-mode) (when (derived-mode-p 'circe-mode)
(tracking-next-buffer))) (tracking-next-buffer)))
@ -103,13 +104,12 @@ argument) is non-nil only show channels in current server."
(defun +circe-buffer-p (buf) (defun +circe-buffer-p (buf)
"Return non-nil if BUF is a `circe-mode' buffer." "Return non-nil if BUF is a `circe-mode' buffer."
(with-current-buffer buf (with-current-buffer buf
(and (derived-mode-p 'circe-mode) (derived-mode-p 'circe-mode)))
(eq (safe-persp-name (get-current-persp))
+irc--workspace-name))))
;;;###autoload ;;;###autoload
(defun +irc--add-circe-buffer-to-persp-h () (defun +irc--add-circe-buffer-to-persp-h ()
(when (bound-and-true-p persp-mode) (when (and (bound-and-true-p persp-mode)
(+workspace-exists-p +irc--workspace-name))
(let ((persp (get-current-persp)) (let ((persp (get-current-persp))
(buf (current-buffer))) (buf (current-buffer)))
;; Add a new circe buffer to irc workspace when we're in another workspace ;; Add a new circe buffer to irc workspace when we're in another workspace