;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Code:
-(require 'riece-filter)
(require 'riece-display)
(require 'riece-server)
(require 'riece-compat)
(require 'riece-commands)
(require 'riece-addon)
+(require 'riece-signal)
(autoload 'derived-mode-class "derived")
(riece-dialogue-buffer "*Dialogue*" riece-dialogue-mode)
(riece-others-buffer "*Others*" riece-others-mode)
(riece-channel-list-buffer "*Channels*" riece-channel-list-mode)
- (riece-user-list-buffer " *Users*" riece-user-list-mode)))
-
-(defvar riece-shrink-buffer-idle-timer nil
- "Timer object to periodically shrink channel buffers.")
-
-(defvar riece-addons-insinuated nil
- "Non nil if add-ons are already insinuated.")
+ (riece-user-list-buffer " *Users*" riece-user-list-mode)
+ (riece-temp-buffer " *Temp*")
+ (riece-debug-buffer "*Debug*")))
(defvar riece-select-keys
- `("1" riece-command-switch-to-channel-by-number-1
+ `("#" riece-command-switch-to-channel-by-number
+ "1" riece-command-switch-to-channel-by-number-1
"2" riece-command-switch-to-channel-by-number-2
"3" riece-command-switch-to-channel-by-number-3
"4" riece-command-switch-to-channel-by-number-4
[backspace] scroll-down
[return] scroll-up
" " scroll-up
+ [home] beginning-of-buffer
"$" end-of-buffer
+ [end] end-of-buffer
"/" riece-command-raw
">" end-of-buffer
"<" beginning-of-buffer
"f" riece-command-finger
"\C-tf" riece-command-toggle-freeze
"\C-to" riece-command-toggle-own-freeze
+ "\C-tO" riece-command-toggle-others-buffer-mode
"\C-tu" riece-command-toggle-user-list-buffer-mode
"\C-tc" riece-command-toggle-channel-buffer-mode
"\C-tC" riece-command-toggle-channel-list-buffer-mode
"p" riece-command-enter-message-to-user
"q" riece-command-quit
"r" riece-command-configure-windows
+ "s" riece-command-save-variables
"x" riece-command-copy-region
"t" riece-command-topic
- "w" riece-command-who)
+ "w" riece-command-who
+ "z" riece-command-suspend-resume)
(riece-define-keys riece-command-mode-map
"\r" riece-command-enter-message
[delete] riece-command-scroll-down
[backspace] riece-command-scroll-down
" " riece-command-scroll-up
+ [home] riece-command-beginning-of-buffer
"$" riece-command-end-of-buffer
+ [end] riece-command-end-of-buffer
">" riece-command-next-channel
"<" riece-command-previous-channel
"\C-j" riece-command-next-channel
(defvar print-quoted)
(defvar print-escape-multibyte)
(defun riece-save-variables-files ()
- "Save current settings to `riece-variables-file'."
+ "Save current settings to `riece-saved-variables-file'."
(with-temp-file riece-saved-variables-file
+ (insert ";;; This file is generated automatically by " riece-version ".\n"
+ ";;; Do not edit this file!\n\n")
(let ((print-quoted t)
(print-readably t)
print-escape-multibyte
(run-hooks 'riece-after-load-startup-hook)
(if (riece-server-opened)
(riece-command-configure-windows)
- (unless riece-addons-insinuated
- (setq riece-addons (riece-resolve-addons riece-addons))
- (let ((pointer riece-addons))
- (while pointer
- (riece-insinuate-addon (car pointer) riece-debug)
- (unless (get (car pointer) 'riece-addon-default-disabled)
- (riece-enable-addon (car pointer) riece-debug))
- (setq pointer (cdr pointer))))
- (setq riece-addons-insinuated t))
+ (modify-frame-parameters (selected-frame)
+ (list (cons 'riece-window-configuration
+ (current-window-configuration))))
+ (setq riece-addon-dependencies (riece-resolve-addons
+ (copy-sequence riece-addons)))
+ (let ((pointer riece-addon-dependencies))
+ (while pointer
+ (riece-insinuate-addon (car (car pointer)) riece-debug)
+ (setq pointer (cdr pointer))))
(if (or confirm (null riece-server))
(setq riece-server (completing-read "Server: " riece-server-alist)))
(if (stringp riece-server)
(setq riece-server (riece-server-name-to-server riece-server)))
(riece-create-buffers)
- (if riece-max-buffer-size
- (setq riece-shrink-buffer-idle-timer
- (riece-run-with-idle-timer
- riece-shrink-buffer-idle-time-delay t
- (lambda ()
- (let ((buffers riece-buffer-list))
- (while buffers
- (if (eq (derived-mode-class
- (with-current-buffer (car buffers)
- major-mode))
- 'riece-dialogue-mode)
- (riece-shrink-buffer (car buffers)))
- (setq buffers (cdr buffers))))))))
(switch-to-buffer riece-command-buffer)
(riece-display-connect-signals)
(riece-redisplay-buffers)
(riece-open-server riece-server "")
- (let ((server-list riece-startup-server-list))
- (while server-list
- (riece-command-open-server (car server-list))
- (setq server-list (cdr server-list))))
- (run-hooks 'riece-startup-hook)
- (message "%s" (substitute-command-keys
- "Type \\[describe-mode] for help"))))
-
-(defun riece-shrink-buffer (buffer)
- (save-excursion
- (set-buffer buffer)
- (goto-char (point-min))
- (while (> (buffer-size) riece-max-buffer-size)
- (let* ((inhibit-read-only t)
- buffer-read-only
- (start (point))
- (end (progn (beginning-of-line 2) (point)))
- (overlays (riece-overlays-in start end)))
- (while overlays
- (riece-delete-overlay (car overlays))
- (setq overlays (cdr overlays)))
- (delete-region start end)))))
+ ;; If no server process is available, exit.
+ (if (null riece-server-process-alist)
+ (riece-exit)
+ (let ((server-list riece-startup-server-list))
+ (while server-list
+ (riece-command-open-server (car server-list))
+ (setq server-list (cdr server-list))))
+ (let ((channel-list riece-startup-channel-list)
+ server)
+ (while channel-list
+ (setq server (riece-identity-server
+ (riece-parse-identity (car channel-list))))
+ (unless (riece-server-opened server)
+ (riece-command-open-server server))
+ (setq channel-list (cdr channel-list))))
+ (let ((pointer riece-addon-dependencies))
+ (while pointer
+ (unless (get (car (car pointer)) 'riece-addon-default-disabled)
+ (riece-enable-addon (car (car pointer)) riece-debug))
+ (setq pointer (cdr pointer))))
+ (run-hooks 'riece-startup-hook)
+ (message "%s" (substitute-command-keys
+ "Type \\[describe-mode] for help")))))
(defun riece-exit ()
- (let ((pointer riece-addons))
- (while pointer
- (riece-disable-addon (car pointer) riece-debug)
- (setq pointer (cdr pointer))))
(if riece-save-variables-are-dirty
(riece-save-variables-files))
(while riece-buffer-list
(buffer-live-p (car riece-buffer-list)))
(funcall riece-buffer-dispose-function (car riece-buffer-list)))
(setq riece-buffer-list (cdr riece-buffer-list)))
- (if riece-shrink-buffer-idle-timer
- (riece-cancel-timer riece-shrink-buffer-idle-timer))
+ (riece-clear-signal-slots)
(setq riece-server nil
riece-current-channels nil
riece-current-channel nil
riece-channel-list-indicator "No channel"
riece-away-indicator "-"
riece-operator-indicator "-"
+ riece-channel-status-indicator "-"
riece-freeze-indicator "-")
+ (modify-frame-parameters (selected-frame)
+ (list (list 'riece-window-configuration)))
(delete-other-windows)
(run-hooks 'riece-exit-hook))
(interactive)
(kill-all-local-variables)
+ ;; Make `truncate-partial-width-windows' buffer local and set it to
+ ;; nil. This causes `truncate-lines' to directly control line
+ ;; truncation.
+ (make-local-variable 'truncate-partial-width-windows)
+ (setq truncate-partial-width-windows nil)
+
+ (make-local-variable 'riece-mode-line-buffer-identification)
(setq riece-away-indicator "-"
riece-operator-indicator "-"
+ riece-channel-status-indicator "-"
major-mode 'riece-command-mode
mode-name "Command"
+ riece-mode-line-buffer-identification
+ '("Riece: "
+ riece-away-indicator
+ riece-operator-indicator
+ riece-channel-status-indicator
+ " "
+ riece-user-indicator
+ " "
+ riece-channel-indicator)
mode-line-buffer-identification
(riece-mode-line-buffer-identification
- '("Riece: "
- riece-away-indicator
- riece-operator-indicator
- " "
- riece-user-indicator
- " "
- riece-channel-indicator)))
+ riece-mode-line-buffer-identification)
+ truncate-lines nil)
(riece-simplify-mode-line-format)
(use-local-map riece-command-mode-map)
"^[]{}'`"))
(run-hooks 'riece-command-mode-hook))
-
+
(defun riece-dialogue-mode ()
"Major mode for displaying the IRC dialogue.
All normal editing commands are turned off.
(kill-all-local-variables)
(make-local-variable 'riece-freeze)
(make-local-variable 'riece-freeze-indicator)
+
+ ;; Make `truncate-partial-width-windows' buffer local and set it to
+ ;; nil. This causes `truncate-lines' to directly control line truncation.
+ (make-local-variable 'truncate-partial-width-windows)
+ (setq truncate-partial-width-windows nil)
+
+ (make-local-variable 'riece-mode-line-buffer-identification)
(setq riece-freeze riece-default-freeze
riece-away-indicator "-"
riece-operator-indicator "-"
+ riece-channel-status-indicator "-"
major-mode 'riece-dialogue-mode
mode-name "Dialogue"
+ riece-mode-line-buffer-identification
+ '("Riece: "
+ riece-away-indicator
+ riece-operator-indicator
+ riece-freeze-indicator
+ riece-channel-status-indicator
+ " "
+ riece-channel-list-indicator " ")
mode-line-buffer-identification
(riece-mode-line-buffer-identification
- '("Riece: "
- riece-away-indicator
- riece-operator-indicator
- riece-freeze-indicator
- " "
- riece-channel-list-indicator " "))
+ riece-mode-line-buffer-identification)
+ truncate-lines nil
buffer-read-only t)
(riece-simplify-mode-line-format)
(use-local-map riece-dialogue-mode-map)
All normal editing commands are turned off.
Instead, these commands are available:
\\{riece-channel-mode-map}"
- (setq mode-line-buffer-identification
+ (make-local-variable 'riece-channel-buffer-window-point)
+ (make-local-variable 'riece-mode-line-buffer-identification)
+ (setq riece-mode-line-buffer-identification
+ '("Riece: "
+ riece-away-indicator
+ riece-operator-indicator
+ riece-freeze-indicator
+ riece-channel-status-indicator
+ " "
+ riece-long-channel-indicator)
+ mode-line-buffer-identification
(riece-mode-line-buffer-identification
- '("Riece: "
- riece-away-indicator
- riece-operator-indicator
- riece-freeze-indicator
- " "
- riece-long-channel-indicator))))
+ riece-mode-line-buffer-identification)))
(defun riece-channel-list-mode ()
"Major mode for displaying channel list.
All normal editing commands are turned off."
(kill-all-local-variables)
(buffer-disable-undo)
+
+ ;; Make `truncate-partial-width-windows' buffer local and set it to
+ ;; nil. This causes `truncate-lines' to directly control line truncation.
+ (make-local-variable 'truncate-partial-width-windows)
+ (setq truncate-partial-width-windows nil)
+
+ (make-local-variable 'riece-mode-line-buffer-identification)
(setq major-mode 'riece-channel-list-mode
- mode-name "Channels"
+ mode-name "Channels"
+ riece-mode-line-buffer-identification '("Riece: ")
mode-line-buffer-identification
- (riece-mode-line-buffer-identification '("Riece: "))
+ (riece-mode-line-buffer-identification
+ riece-mode-line-buffer-identification)
truncate-lines t
buffer-read-only t)
(make-local-hook 'riece-update-buffer-functions)
\\{riece-user-list-mode-map}"
(kill-all-local-variables)
(buffer-disable-undo)
+
+ ;; Make `truncate-partial-width-windows' buffer local and set it to
+ ;; nil. This causes `truncate-lines' to directly control line truncation.
+ (make-local-variable 'truncate-partial-width-windows)
+ (setq truncate-partial-width-windows nil)
+
+ (make-local-variable 'riece-mode-line-buffer-identification)
(setq major-mode 'riece-user-list-mode
- mode-name "Users"
+ mode-name "Users"
+ riece-mode-line-buffer-identification
+ '("Riece: " riece-long-channel-indicator " ")
mode-line-buffer-identification
(riece-mode-line-buffer-identification
- '("Riece: " riece-long-channel-indicator " "))
+ riece-mode-line-buffer-identification)
truncate-lines t
buffer-read-only t)
(if (boundp 'transient-mark-mode)
(eq major-mode (nth 2 (car alist))))
(funcall (nth 2 (car alist))))
(setq alist (cdr alist))))))
-
+
+(defvar reporter-prompt-for-summary-p)
+(defun riece-submit-bug-report (&optional recent-messages recent-keys)
+ "Submit via mail a bug report on Riece."
+ ;; This strange form ensures that (recent-keys) is the value before
+ ;; the bug subject string is read.
+ (interactive (list (riece-recent-messages 20) (recent-keys)))
+ (message "Querying server version...")
+ (let ((pointer riece-server-process-alist)
+ nickname)
+ (while pointer
+ (when (riece-server-process-opened (cdr (car pointer)))
+ (process-send-string (cdr (car pointer)) "VERSION\r\n")
+ (if (setq nickname
+ (with-current-buffer (process-buffer (cdr (car pointer)))
+ riece-real-nickname))
+ (process-send-string
+ (cdr (car pointer))
+ (format "PRIVMSG %s :\1VERSION\1\r\n" nickname))))
+ (setq pointer (cdr pointer))))
+ (sit-for 3)
+ (message "Querying server version...done")
+ (require 'reporter)
+ (let ((reporter-prompt-for-summary-p t))
+ (unless riece-debug
+ (error "Please turn on riece-debug and restart Riece."))
+ (reporter-submit-bug-report
+ "liece@unixuser.org"
+ (riece-version)
+ '(riece-debug)
+ nil
+ nil
+ "This bug report will be sent to the Riece Development Team,
+not to your local site managers!!
+
+Please write in Japanese or English, because the Riece maintainers do
+not have translators to read other languages for them.
+
+Please describe as succinctly as possible:
+\t- What happened.
+\t- What you thought should have happened.
+\t- Precisely what you were doing at the time.
+
+Also include a reliable recipe for triggering the bug, as well as
+any lisp back-traces that you may have.
+\(setq stack-trace-on-error t\), or \(setq debug-on-error t\) if you
+are familiar with the debugger, to get a lisp back-trace.")
+ (delete-other-windows)
+ (save-excursion
+ (goto-char (point-max))
+ (insert
+ "\nAdd-on state:\n"
+ "------------\n"
+ (save-window-excursion
+ (save-excursion
+ (riece-command-list-addons)
+ (search-forward "\n\n")
+ (buffer-substring (point-min) (point)))))
+ (insert "Recent messages from servers:\n"
+ "--------------------------")
+ (let ((pointer riece-server-process-alist))
+ (while pointer
+ (insert "\n- \"" (car (car pointer)) "\", \n"
+ (format "%S" (if (equal (car (car pointer)) "")
+ riece-server
+ (cdr (assoc (car (car pointer))
+ riece-server-alist))))
+ "\n"
+ (if (riece-server-process-opened (cdr (car pointer)))
+ (save-excursion
+ (set-buffer (process-buffer (cdr (car pointer))))
+ (goto-char (point-max))
+ (beginning-of-line -60)
+ (buffer-substring (point) (point-max)))
+ "(closed server)"))
+ (setq pointer (cdr pointer))))
+ (insert "\n\nRecent debug messages:\n"
+ "-----------------------------------\n"
+ (with-current-buffer riece-debug-buffer
+ (buffer-string)))
+ ;; Insert recent keystrokes.
+ (insert "\n\nRecent keystrokes:\n"
+ "-----------------\n\n")
+ (let ((before-keys (point)))
+ (insert (key-description recent-keys))
+ (save-restriction
+ (narrow-to-region before-keys (point))
+ (goto-char before-keys)
+ (while (progn (move-to-column 50) (not (eobp)))
+ (search-forward " " nil t)
+ (insert "\n"))))
+ ;; Insert recent minibuffer messages.
+ (insert "\n\nRecent messages (most recent first):\n"
+ "-----------------------------------\n"
+ recent-messages))))
+
(provide 'riece)
;;; riece.el ends here