diff options
| author | Sam Steingold | 2015-04-21 08:54:04 -0400 |
|---|---|---|
| committer | Sam Steingold | 2015-04-29 08:24:51 -0400 |
| commit | 5e7ed98f7c6497b67376977fafdf2dd860537f14 (patch) | |
| tree | 835c095a102dfcaf8e27afeb2121a4ed80b08cd5 | |
| parent | 967f054bff9dfaf507a77a16465c38a738040ee8 (diff) | |
| download | emacs-5e7ed98f7c6497b67376977fafdf2dd860537f14.tar.gz emacs-5e7ed98f7c6497b67376977fafdf2dd860537f14.zip | |
bury RCIRC buffers when there is no activity
lisp/net/rcirc.el (rcirc-non-irc-buffer): remove
(rcirc-bury-buffers): new function
(rcirc-next-active-buffer): when there is no new activity, use
`rcirc-bury-buffers' to hide all RCIRC buffers
| -rw-r--r-- | lisp/net/rcirc.el | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 5ea10475cea..11db7a2cab2 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -1924,17 +1924,13 @@ Uninteresting lines are those whose responses are listed in | |||
| 1924 | (goto-char overlay-arrow-position) | 1924 | (goto-char overlay-arrow-position) |
| 1925 | (message "No unread messages"))) | 1925 | (message "No unread messages"))) |
| 1926 | 1926 | ||
| 1927 | (defun rcirc-non-irc-buffer () | 1927 | (defun rcirc-bury-buffers () |
| 1928 | (let ((buflist (buffer-list)) | 1928 | "Bury all RCIRC buffers." |
| 1929 | buffer) | 1929 | (interactive) |
| 1930 | (while (and buflist (not buffer)) | 1930 | (dolist (buf (buffer-list)) |
| 1931 | (with-current-buffer (car buflist) | 1931 | (when (eq 'rcirc-mode (with-current-buffer buf major-mode)) |
| 1932 | (unless (or (eq major-mode 'rcirc-mode) | 1932 | (bury-buffer buf) ; buffers not shown |
| 1933 | (= ?\s (aref (buffer-name) 0)) ; internal buffers | 1933 | (quit-windows-on buf)))) ; buffers shown in a window |
| 1934 | (get-buffer-window (current-buffer))) | ||
| 1935 | (setq buffer (current-buffer)))) | ||
| 1936 | (setq buflist (cdr buflist))) | ||
| 1937 | buffer)) | ||
| 1938 | 1934 | ||
| 1939 | (defun rcirc-next-active-buffer (arg) | 1935 | (defun rcirc-next-active-buffer (arg) |
| 1940 | "Switch to the next rcirc buffer with activity. | 1936 | "Switch to the next rcirc buffer with activity. |
| @@ -1949,15 +1945,13 @@ With prefix ARG, go to the next low priority buffer with activity." | |||
| 1949 | (switch-to-buffer (car (if arg lopri hipri))) | 1945 | (switch-to-buffer (car (if arg lopri hipri))) |
| 1950 | (when (> (point) rcirc-prompt-start-marker) | 1946 | (when (> (point) rcirc-prompt-start-marker) |
| 1951 | (recenter -1))) | 1947 | (recenter -1))) |
| 1952 | (if (eq major-mode 'rcirc-mode) | 1948 | (rcirc-bury-buffers) |
| 1953 | (switch-to-buffer (rcirc-non-irc-buffer)) | 1949 | (message "No IRC activity.%s" |
| 1954 | (message "%s" (concat | 1950 | (if lopri |
| 1955 | "No IRC activity." | 1951 | (concat |
| 1956 | (when lopri | 1952 | " Type C-u " (key-description (this-command-keys)) |
| 1957 | (concat | 1953 | " for low priority activity.") |
| 1958 | " Type C-u " | 1954 | ""))))) |
| 1959 | (key-description (this-command-keys)) | ||
| 1960 | " for low priority activity.")))))))) | ||
| 1961 | 1955 | ||
| 1962 | (define-obsolete-variable-alias 'rcirc-activity-hooks | 1956 | (define-obsolete-variable-alias 'rcirc-activity-hooks |
| 1963 | 'rcirc-activity-functions "24.3") | 1957 | 'rcirc-activity-functions "24.3") |