diff options
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/rcirc.el | 81 | ||||
-rw-r--r-- | lisp/net/zone-mode.el | 120 |
2 files changed, 55 insertions, 146 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 1f051ffa9f2..c34ac7dcf78 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -40,6 +40,8 @@ ;; Open a new irc connection with: ;; M-x irc RET +;;; Todo: + ;;; Code: (require 'ring) @@ -140,6 +142,10 @@ number. If zero or nil, no truncating is done." (integer :tag "Number of lines")) :group 'rcirc) +(defcustom rcirc-show-maximum-output t + "*If non-nil, scroll buffer to keep the point at the bottom of +the window.") + (defcustom rcirc-authinfo nil "List of authentication passwords. Each element of the list is a list with a SERVER-REGEXP string @@ -297,6 +303,7 @@ and the cdr part is used for encoding." (defvar rcirc-urls nil "List of urls seen in the current buffer.") +(put 'rcirc-urls 'permanent-local t) (defvar rcirc-keepalive-seconds 60 "Number of seconds between keepalive pings. @@ -539,7 +546,10 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") (defun rcirc-buffer-process (&optional buffer) "Return the process associated with channel BUFFER. With no argument or nil as argument, use the current buffer." - (get-buffer-process (or buffer rcirc-server-buffer))) + (get-buffer-process (if buffer + (with-current-buffer buffer + rcirc-server-buffer) + rcirc-server-buffer))) (defun rcirc-server-name (process) "Return PROCESS server name, given by the 001 response." @@ -601,10 +611,11 @@ If NOTICEP is non-nil, send a notice instead of privmsg." (defvar rcirc-nick-completions nil) (defvar rcirc-nick-completion-start-offset nil) + (defun rcirc-complete-nick () "Cycle through nick completions from list of nicks in channel." (interactive) - (if (eq last-command 'rcirc-complete-nick) + (if (eq last-command this-command) (setq rcirc-nick-completions (append (cdr rcirc-nick-completions) (list (car rcirc-nick-completions)))) @@ -626,9 +637,10 @@ If NOTICEP is non-nil, send a notice instead of privmsg." rcirc-target)))))) (let ((completion (car rcirc-nick-completions))) (when completion + (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target) (delete-region (+ rcirc-prompt-end-marker - rcirc-nick-completion-start-offset) - (point)) + rcirc-nick-completion-start-offset) + (point)) (insert (concat completion (if (= (+ rcirc-prompt-end-marker rcirc-nick-completion-start-offset) @@ -709,7 +721,6 @@ If NOTICEP is non-nil, send a notice instead of privmsg." (make-local-variable 'rcirc-short-buffer-name) (setq rcirc-short-buffer-name nil) (make-local-variable 'rcirc-urls) - (setq rcirc-urls nil) (setq use-hard-newlines t) (make-local-variable 'rcirc-decode-coding-system) @@ -742,6 +753,9 @@ If NOTICEP is non-nil, send a notice instead of privmsg." (make-local-variable 'kill-buffer-hook) (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook) + (make-local-variable 'window-scroll-functions) + (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom) + ;; add to buffer list, and update buffer abbrevs (when target ; skip server buffer (let ((buffer (current-buffer))) @@ -1144,6 +1158,15 @@ is found by looking up RESPONSE in `rcirc-response-formats'." (make-variable-buffer-local 'rcirc-last-sender) (defvar rcirc-gray-toggle nil) (make-variable-buffer-local 'rcirc-gray-toggle) + +(defun rcirc-scroll-to-bottom (window display-start) + "Scroll window to show maximum output if `rcirc-show-maximum-output' is +non-nil." + (when rcirc-show-maximum-output + (with-selected-window window + (when (>= (window-point) rcirc-prompt-end-marker) + (recenter -1))))) + (defun rcirc-print (process sender response target text &optional activity) "Print TEXT in the buffer associated with TARGET. Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, @@ -1240,16 +1263,19 @@ record activity." ;; record modeline activity (when activity (let ((nick-match - (string-match (concat "\\b" - (regexp-quote (rcirc-nick process)) - "\\b") - text))) + (with-syntax-table rcirc-nick-syntax-table + (string-match (concat "\\b" + (regexp-quote (rcirc-nick process)) + "\\b") + text)))) (when (if rcirc-ignore-buffer-activity-flag ;; - Always notice when our nick is mentioned nick-match - ;; - Never bother us if a dim-nick spoke - (not (and rcirc-dim-nick-regexp sender - (string-match rcirc-dim-nick-regexp sender)))) + ;; - unless our nick is mentioned, don't bother us + ;; - with dim-nicks + (or nick-match + (not (and rcirc-dim-nick-regexp sender + (string-match rcirc-dim-nick-regexp sender))))) (rcirc-record-activity (current-buffer) (when (or nick-match (and (not (rcirc-channel-p rcirc-target)) @@ -1504,18 +1530,20 @@ activity. Only run if the buffer is not visible and (lopri (car pair)) (hipri (cdr pair))) (setq rcirc-activity-string - (if (or hipri lopri) - (concat "-" - (and hipri "[") - (rcirc-activity-string hipri) - (and hipri lopri ",") - (and lopri - (concat "(" - (rcirc-activity-string lopri) - ")")) - (and hipri "]") - "-") - "-[]-")))) + (cond ((or hipri lopri) + (concat "-" + (and hipri "[") + (rcirc-activity-string hipri) + (and hipri lopri ",") + (and lopri + (concat "(" + (rcirc-activity-string lopri) + ")")) + (and hipri "]") + "-")) + ((not (null (rcirc-process-list))) + "-[]-") + (t ""))))) (defun rcirc-activity-string (buffers) (mapconcat (lambda (b) @@ -1771,7 +1799,7 @@ nicks when no NICK is given. When listing ignored nicks, the ones added to the list automatically are marked with an asterisk." (interactive "sToggle ignoring of nick: ") (when (not (string= "" nick)) - (if (member nick rcirc-ignore-list) + (if (member-ignore-case nick rcirc-ignore-list) (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) (setq rcirc-ignore-list (cons nick rcirc-ignore-list)))) (rcirc-print process (rcirc-nick process) "IGNORE" target @@ -1800,6 +1828,7 @@ ones added to the list automatically are marked with an asterisk." "://") "www.") (1+ (char "-a-zA-Z0-9_.")) + (1+ (char "-a-zA-Z0-9_")) (optional ":" (1+ (char "0-9")))) (and (1+ (char "-a-zA-Z0-9_.")) (or ".com" ".net" ".org") @@ -1823,7 +1852,7 @@ ones added to the list automatically are marked with an asterisk." (defun rcirc-browse-url-at-point (point) "Send URL at point to `browse-url'." (interactive "d") - (let ((beg (previous-single-property-change point 'mouse-face)) + (let ((beg (previous-single-property-change (1+ point) 'mouse-face)) (end (next-single-property-change point 'mouse-face))) (browse-url (buffer-substring-no-properties beg end)))) diff --git a/lisp/net/zone-mode.el b/lisp/net/zone-mode.el deleted file mode 100644 index 441ef143f9c..00000000000 --- a/lisp/net/zone-mode.el +++ /dev/null @@ -1,120 +0,0 @@ -;;; zone-mode.el --- major mode for editing DNS zone files - -;; Copyright (C) 1998, 2002, 2003, 2004, 2005, -;; 2006 Free Software Foundation, Inc. - -;; Author: John Heidemann <johnh@isi.edu> -;; Keywords: DNS, languages - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; 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., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;;; -;;; See the comments in ``define-derived-mode zone-mode'' -;;; (the last function in this file) -;;; for what this mode is and how to use it automatically. -;;; - -;;; -;;; Credits: -;;; Zone-mode was written by John Heidemann <johnh@isi.edu>, -;;; with bug fixes from Simon Leinen <simon@limmat.switch.ch>. -;;; - -;;; Code: - -(defun zone-mode-update-serial () - "Update the serial number in a zone." - (interactive) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward "\\b\\([0-9]+\\)\\([0-9][0-9]\\)\\([ \t]+;[ \t]+[Ss]erial\\)" (point-max) t) - (let* ((old-date (match-string 1)) - (old-seq (match-string 2)) - (old-seq-num (string-to-number (match-string 2))) - (old-flag (match-string 3)) - (cur-date (format-time-string "%Y%m%d")) - (new-seq - (cond - ((not (string= old-date cur-date)) - "00") ;; reset sequence number - ((>= old-seq-num 99) - (error "Serial number's sequence cannot increment beyond 99")) - (t - (format "%02d" (1+ old-seq-num))))) - (old-serial (concat old-date old-seq)) - (new-serial (concat cur-date new-seq))) - (if (string-lessp new-serial old-serial) - (error "Serial numbers want to move backwards from %s to %s" old-serial new-serial) - (replace-match (concat cur-date new-seq old-flag) t t)))))) - -;;;###autoload -(defun zone-mode-update-serial-hook () - "Update the serial number in a zone if the file was modified." - (interactive) - (if (buffer-modified-p (current-buffer)) - (zone-mode-update-serial)) - nil ;; so we can run from write-file-hooks - ) - -(defvar zone-mode-syntax-table nil - "Zone-mode's syntax table.") - -(defun zone-mode-load-time-setup () - "Initialize `zone-mode' stuff." - (setq zone-mode-syntax-table (make-syntax-table)) - (modify-syntax-entry ?\; "<" zone-mode-syntax-table) - (modify-syntax-entry ?\n ">" zone-mode-syntax-table)) - -;;;###autoload -(define-derived-mode zone-mode fundamental-mode "zone" - "A mode for editing DNS zone files. - -Zone-mode does two things: - - - automatically update the serial number for a zone - when saving the file - - - fontification" - - (add-hook 'write-file-functions 'zone-mode-update-serial-hook nil t) - - (if (null zone-mode-syntax-table) - (zone-mode-load-time-setup)) ;; should have been run at load-time - - ;; font-lock support: - (set-syntax-table zone-mode-syntax-table) - (make-local-variable 'comment-start) - (setq comment-start ";") - (make-local-variable 'comment-start-skip) - ;; Look within the line for a ; following an even number of backslashes - ;; after either a non-backslash or the line beginning. - (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*") - (make-local-variable 'comment-column) - (setq comment-column 40) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults - '(nil nil nil nil beginning-of-line))) - -(zone-mode-load-time-setup) - -(provide 'zone-mode) - -;;; arch-tag: 6a2940ef-fd4f-4de7-b979-b027b09821fe -;;; zone-mode.el ends here |