Changeset 4200 for trunk/lisp/erc/erc.el
- Timestamp:
- 04/07/07 15:49:28 (2 years ago)
- Files:
-
- trunk/lisp/erc/erc.el (modified) (52 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/erc/erc.el
r4190 r4200 67 67 ;;; Code: 68 68 69 (defconst erc-version-string "Version 5.2 stable pre-release"69 (defconst erc-version-string "Version 5.2" 70 70 "ERC version. This is used by function `erc-version'.") 71 71 … … 325 325 (defcustom erc-connect-pre-hook '(erc-initialize-log-marker) 326 326 "Hook called just before `erc' calls `erc-connect'. 327 Functions are run in the buffer-to-be."327 Functions are passed a buffer as the first argument." 328 328 :group 'erc-hooks 329 329 :type 'hook) … … 393 393 "Finds the USER corresponding to NICK in the current server's 394 394 `erc-server-users' hash table." 395 ( with-current-buffer (process-buffer erc-server-process)395 (erc-with-server-buffer 396 396 (gethash (erc-downcase nick) erc-server-users))) 397 397 … … 400 400 401 401 Adds USER with nickname NICK to the `erc-server-users' hash table." 402 ( with-current-buffer (process-buffer erc-server-process)402 (erc-with-server-buffer 403 403 (puthash (erc-downcase nick) user erc-server-users))) 404 404 … … 411 411 412 412 See also: `erc-remove-user'." 413 ( with-current-buffer (process-buffer erc-server-process)413 (erc-with-server-buffer 414 414 (remhash (erc-downcase nick) erc-server-users))) 415 415 … … 422 422 (let ((nick (erc-server-user-nickname user))) 423 423 (setf (erc-server-user-nickname user) new-nick) 424 ( with-current-buffer (process-buffer erc-server-process)424 (erc-with-server-buffer 425 425 (remhash (erc-downcase nick) erc-server-users) 426 426 (puthash (erc-downcase new-nick) user erc-server-users)) … … 515 515 (defun erc-get-server-nickname-list () 516 516 "Returns a list of known nicknames on the current server." 517 (if (erc-server-process-alive) 518 (with-current-buffer (erc-server-buffer) 519 (let (nicks) 520 (when (hash-table-p erc-server-users) 521 (maphash (lambda (n user) 522 (setq nicks 523 (cons (erc-server-user-nickname user) 524 nicks))) 525 erc-server-users) 526 nicks))))) 517 (erc-with-server-buffer 518 (let (nicks) 519 (when (hash-table-p erc-server-users) 520 (maphash (lambda (n user) 521 (setq nicks 522 (cons (erc-server-user-nickname user) 523 nicks))) 524 erc-server-users) 525 nicks)))) 527 526 528 527 (defun erc-get-channel-nickname-list () … … 539 538 (defun erc-get-server-nickname-alist () 540 539 "Returns an alist of known nicknames on the current server." 541 (if (erc-server-process-alive) 542 (with-current-buffer (erc-server-buffer) 543 (let (nicks) 544 (when (hash-table-p erc-server-users) 545 (maphash (lambda (n user) 546 (setq nicks 547 (cons (cons (erc-server-user-nickname user) nil) 548 nicks))) 549 erc-server-users) 550 nicks))))) 540 (erc-with-server-buffer 541 (let (nicks) 542 (when (hash-table-p erc-server-users) 543 (maphash (lambda (n user) 544 (setq nicks 545 (cons (cons (erc-server-user-nickname user) nil) 546 nicks))) 547 erc-server-users) 548 nicks)))) 551 549 552 550 (defun erc-get-channel-nickname-alist () … … 1294 1292 (error 1295 1293 "You should only run `erc-once-with-server-event' in a server buffer")) 1296 (let ((fun ( erc-gensym))1294 (let ((fun (make-symbol "fun")) 1297 1295 (hook (erc-get-hook event))) 1298 1296 (put fun 'erc-original-buffer (current-buffer)) … … 1317 1315 When FORMS execute, the current buffer is the server buffer associated with the 1318 1316 connection over which the data was received that triggered EVENT." 1319 (let ((fun ( erc-gensym))1317 (let ((fun (make-symbol "fun")) 1320 1318 (hook (erc-get-hook event))) 1321 1319 (fset fun `(lambda (proc parsed) … … 1371 1369 "Return non-nil if NICK is online." 1372 1370 (interactive "sNick: ") 1373 ( with-current-buffer (erc-server-buffer)1371 (erc-with-server-buffer 1374 1372 (let ((erc-online-p 'unknown)) 1375 1373 (erc-once-with-server-event … … 1421 1419 "Return the value of `erc-active-buffer' for the current server. 1422 1420 Defaults to the server buffer." 1423 ( with-current-buffer (erc-server-buffer)1421 (erc-with-server-buffer 1424 1422 (if (buffer-live-p erc-active-buffer) 1425 1423 erc-active-buffer … … 1604 1602 1605 1603 \(fn (TARGET [PROCESS]) BODY...)" 1606 (let ((buf ( erc-gensym))1607 (proc ( erc-gensym))1608 (target ( erc-gensym))1609 (process ( erc-gensym)))1604 (let ((buf (make-symbol "buf")) 1605 (proc (make-symbol "proc")) 1606 (target (make-symbol "target")) 1607 (process (make-symbol "process"))) 1610 1608 `(let* ((,target ,(car spec)) 1611 1609 (,process ,(cadr spec)) … … 1617 1615 (if (and ,target ,proc) 1618 1616 (erc-get-buffer ,target ,proc)))))) 1619 (when ,buf1617 (when (buffer-live-p ,buf) 1620 1618 (with-current-buffer ,buf 1621 1619 ,@body))))) … … 1672 1670 nil." 1673 1671 ;; Make the evaluation have the correct order 1674 (let ((pre ( erc-gensym))1675 (pro ( erc-gensym)))1672 (let ((pre (make-symbol "pre")) 1673 (pro (make-symbol "pro"))) 1676 1674 `(let ((,pro ,process) 1677 1675 (,pre ,pred)) … … 1756 1754 1757 1755 (defvar erc-away nil 1758 "Non-nil indicates that we are away.") 1756 "Non-nil indicates that we are away. 1757 1758 Use `erc-away-time' to access this if you might be in a channel 1759 buffer rather than a server buffer.") 1759 1760 (make-variable-buffer-local 'erc-away) 1760 1761 … … 1814 1815 '(set 1815 1816 :greedy t 1816 (const :tag "Set away status automatically" autoaway) 1817 (const :tag "Join channels automatically" autojoin) 1818 (const :tag "Buttonize URLs, nicknames, and other text" button) 1819 (const 1820 :tag 1821 "Mark unidentified users on freenode and other servers supporting CAPAB" 1822 capab-identify) 1823 (const :tag "Wrap long lines" fill) 1824 (const :tag "Launch an identd server on port 8113" identd) 1825 (const :tag "Highlight or remove IRC control characters" 1817 (const :tag "autoaway: Set away status automatically" autoaway) 1818 (const :tag "autojoin: Join channels automatically" autojoin) 1819 (const :tag "button: Buttonize URLs, nicknames, and other text" button) 1820 (const :tag "capab: Mark unidentified users on servers supporting CAPAB" 1821 capab-identify) 1822 (const :tag "completion: Complete nicknames and commands (programmable)" 1823 completion) 1824 (const :tag "hecomplete: Complete nicknames and commands (old)" hecomplete) 1825 (const :tag "fill: Wrap long lines" fill) 1826 (const :tag "identd: Launch an identd server on port 8113" identd) 1827 (const :tag "irccontrols: Highlight or remove IRC control characters" 1826 1828 irccontrols) 1827 (const :tag " Save buffers in logs" log)1828 (const :tag " Highlight pals, fools, and other keywords" match)1829 (const :tag " Display a menu in ERC buffers" menu)1830 (const :tag " Detect netsplits" netsplit)1831 (const :tag " Don't display non-IRC commands after evaluation"1829 (const :tag "log: Save buffers in logs" log) 1830 (const :tag "match: Highlight pals, fools, and other keywords" match) 1831 (const :tag "menu: Display a menu in ERC buffers" menu) 1832 (const :tag "netsplit: Detect netsplits" netsplit) 1833 (const :tag "noncommands: Don't display non-IRC commands after evaluation" 1832 1834 noncommands) 1833 (const :tag "Notify when the online status of certain users changes" 1835 (const :tag 1836 "notify: Notify when the online status of certain users changes" 1834 1837 notify) 1835 (const :tag "Complete nicknames and commands (programmable)" 1836 completion) 1837 (const :tag "Complete nicknames and commands (old)" hecomplete) 1838 (const :tag "Process CTCP PAGE requests from IRC" page) 1839 (const :tag "Make displayed lines read-only" readonly) 1840 (const :tag "Replace text in messages" replace) 1841 (const :tag "Enable an input history" ring) 1842 (const :tag "Scroll to the bottom of the buffer" scrolltobottom) 1843 (const :tag "Identify to Nickserv (IRC Services) automatically" 1838 (const :tag "page: Process CTCP PAGE requests from IRC" page) 1839 (const :tag "readonly: Make displayed lines read-only" readonly) 1840 (const :tag "replace: Replace text in messages" replace) 1841 (const :tag "ring: Enable an input history" ring) 1842 (const :tag "scrolltobottom: Scroll to the bottom of the buffer" 1843 scrolltobottom) 1844 (const :tag "services: Identify to Nickserv (IRC Services) automatically" 1844 1845 services) 1845 (const :tag " Convert smileys to pretty icons" smiley)1846 (const :tag " Play sounds when you receive CTCP SOUND requests"1846 (const :tag "smiley: Convert smileys to pretty icons" smiley) 1847 (const :tag "sound: Play sounds when you receive CTCP SOUND requests" 1847 1848 sound) 1848 (const :tag " Add timestamps to messages" stamp)1849 (const :tag " Check spelling" spelling)1850 (const :tag " Track channel activity in the mode-line" track)1851 (const :tag " Truncate buffers to a certain size" truncate)1852 (const :tag " Translate morse code in messages" unmorse)1849 (const :tag "stamp: Add timestamps to messages" stamp) 1850 (const :tag "spelling: Check spelling" spelling) 1851 (const :tag "track: Track channel activity in the mode-line" track) 1852 (const :tag "truncate: Truncate buffers to a certain size" truncate) 1853 (const :tag "unmorse: Translate morse code in messages" unmorse) 1853 1854 (repeat :tag "Others" :inline t symbol)) 1854 1855 :group 'erc) … … 1903 1904 (defun erc-open (&optional server port nick full-name 1904 1905 connect passwd tgt-list channel process) 1905 "ERC is a powerful, modular, and extensible IRC client. 1906 1907 Connect to SERVER on PORT as NICK with FULL-NAME. 1906 "Connect to SERVER on PORT as NICK with FULL-NAME. 1908 1907 1909 1908 If CONNECT is non-nil, connect to the server. Otherwise assume … … 1970 1969 ;; last invitation channel 1971 1970 (setq erc-invitation nil) 1972 ;; away flag1973 ;; Should only be used in session-buffers1974 (setq erc-away (let ((serverbuf (erc-server-buffer)))1975 (and serverbuf (with-current-buffer serverbuf erc-away))))1976 1971 ;; Server channel list 1977 1972 (setq erc-channel-list ()) … … 1988 1983 (when erc-log-p 1989 1984 (get-buffer-create (concat "*ERC-DEBUG: " server "*")))) 1990 (erc-determine-parameters server port nick full-name) 1991 1992 ;; Saving log file on exit 1993 (run-hooks 'erc-connect-pre-hook) 1994 1995 (when connect 1996 (erc-server-connect erc-session-server erc-session-port)) 1997 (erc-update-mode-line) 1998 (set-marker erc-insert-marker (point)) 1985 ;; set up prompt 1999 1986 (unless continued-session 2000 1987 (goto-char (point-max)) 2001 1988 (insert "\n")) 2002 (set-marker (process-mark erc-server-process) (point))2003 1989 (if continued-session 2004 1990 (goto-char old-point) … … 2006 1992 (erc-display-prompt) 2007 1993 (goto-char (point-max))) 1994 1995 (erc-determine-parameters server port nick full-name) 1996 1997 ;; Saving log file on exit 1998 (run-hook-with-args 'erc-connect-pre-hook buffer) 1999 2000 (when connect 2001 (erc-server-connect erc-session-server erc-session-port buffer)) 2002 (erc-update-mode-line) 2008 2003 2009 2004 ;; Now display the buffer in a window as per user wishes. … … 2017 2012 buffer)) 2018 2013 2019 (defun erc-initialize-log-marker () 2020 "Initialize the `erc-last-saved-position' marker to a sensible position." 2014 (defun erc-initialize-log-marker (buffer) 2015 "Initialize the `erc-last-saved-position' marker to a sensible position. 2016 BUFFER is the current buffer." 2017 (with-current-buffer buffer 2021 2018 (setq erc-last-saved-position (make-marker)) 2022 2019 (move-marker erc-last-saved-position 2023 (1- (marker-position erc-insert-marker)))) 2020 (1- (marker-position erc-insert-marker))))) 2024 2021 2025 2022 ;; interactive startup … … 2121 2118 password 2122 2119 (full-name (erc-compute-full-name))) 2123 "Select connection parameters and run ERC. 2124 Non-interactively, it takes keyword arguments 2120 "ERC is a powerful, modular, and extensible IRC client. 2121 This function is the main entry point for ERC. 2122 2123 It permits you to select connection parameters, and then starts ERC. 2124 2125 Non-interactively, it takes the keyword arguments 2125 2126 (server (erc-compute-server)) 2126 2127 (port (erc-compute-port)) … … 2133 2134 (erc :server \"irc.freenode.net\" :full-name \"Harry S Truman\") 2134 2135 2135 server and full-name will be set to those values, whereas2136 then the server and full-name will be set to those values, whereas 2136 2137 `erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will 2137 2138 be invoked for the values of the other parameters." … … 2139 2140 (erc-open server port nick full-name t password)) 2140 2141 2142 ;;;###autoload 2141 2143 (defalias 'erc-select 'erc) 2142 2144 … … 2429 2431 This function relies on the erc-parsed text-property being 2430 2432 present." 2431 (let ((prop-val ( get-text-property position 'erc-parsed)))2433 (let ((prop-val (erc-get-parsed-vector position))) 2432 2434 (and prop-val (member (erc-response.command prop-val) list)))) 2433 2435 … … 2587 2589 (erc-make-notice (format "Now ignoring %s" user)) 2588 2590 'active) 2589 (with-current-buffer (erc-server-buffer) 2590 (add-to-list 'erc-ignore-list user))) 2591 (if (null (with-current-buffer (erc-server-buffer) erc-ignore-list)) 2591 (erc-with-server-buffer (add-to-list 'erc-ignore-list user))) 2592 (if (null (erc-with-server-buffer erc-ignore-list)) 2592 2593 (erc-display-line (erc-make-notice "Ignore list is empty") 'active) 2593 2594 (erc-display-line (erc-make-notice "Ignore list:") 'active) … … 2595 2596 (erc-display-line (erc-make-notice item) 2596 2597 'active)) 2597 ( with-current-buffer (erc-server-buffer)erc-ignore-list))))2598 (erc-with-server-buffer erc-ignore-list)))) 2598 2599 t) 2599 2600 2600 2601 (defun erc-cmd-UNIGNORE (user) 2601 2602 "Remove the user specified in USER from the ignore list." 2602 (let ((ignored-nick (car ( with-current-buffer (erc-server-buffer)2603 (let ((ignored-nick (car (erc-with-server-buffer 2603 2604 (erc-member-ignore-case (regexp-quote user) 2604 2605 erc-ignore-list))))) … … 2615 2616 (erc-make-notice (format "No longer ignoring %s" user)) 2616 2617 'active) 2617 ( with-current-buffer (erc-server-buffer)2618 (erc-with-server-buffer 2618 2619 (setq erc-ignore-list (delete ignored-nick erc-ignore-list))))) 2619 2620 t) … … 2674 2675 ;; on all server buffers. 2675 2676 (erc-with-all-buffers-of-server nil 2676 #'erc-server-buffer-p2677 (erc-cmd-AWAY line)))2677 #'erc-open-server-buffer-p 2678 (erc-cmd-AWAY line))) 2678 2679 (put 'erc-cmd-GAWAY 'do-not-parse-args t) 2679 2680 … … 2867 2868 (defun erc-cmd-IDLE (nick) 2868 2869 "Show the length of time NICK has been idle." 2869 (let ((serverbuf (erc-server-buffer)) 2870 (origbuf (current-buffer)) 2870 (let ((origbuf (current-buffer)) 2871 2871 symlist) 2872 ( with-current-buffer serverbuf2872 (erc-with-server-buffer 2873 2873 (add-to-list 'symlist 2874 2874 (cons (erc-once-with-server-event … … 3028 3028 "Change current nickname to NICK." 3029 3029 (erc-log (format "cmd: NICK: %s (erc-bad-nick: %S)" nick erc-bad-nick)) 3030 (let ((nicklen (cdr (assoc "NICKLEN" ( with-current-buffer (erc-server-buffer)3031 erc-server-parameters)))))3030 (let ((nicklen (cdr (assoc "NICKLEN" (erc-with-server-buffer 3031 erc-server-parameters))))) 3032 3032 (and nicklen (> (length nick) (string-to-number nicklen)) 3033 3033 (erc-display-message … … 3168 3168 (let* ((s (match-string 1 reason)) 3169 3169 (buffer (erc-server-buffer)) 3170 (reason (funcall erc-quit-reason (if (equal s "") nil s)))) 3170 (reason (funcall erc-quit-reason (if (equal s "") nil s))) 3171 server-proc) 3171 3172 (with-current-buffer (if (and buffer 3172 3173 (bufferp buffer)) … … 3176 3177 (setq erc-server-quitting t) 3177 3178 (erc-set-active-buffer (erc-server-buffer)) 3179 (setq server-proc erc-server-process) 3178 3180 (erc-server-send (format "QUIT :%s" reason))) 3179 (run-hook-with-args 'erc-quit-hook erc-server-process)3181 (run-hook-with-args 'erc-quit-hook server-proc) 3180 3182 (when erc-kill-queries-on-quit 3181 (erc-kill-query-buffers erc-server-process))) 3183 (erc-kill-query-buffers server-proc)) 3184 ;; if the process has not been killed within 4 seconds, kill it 3185 (run-at-time 4 nil 3186 (lambda (proc) 3187 (when (and (processp proc) 3188 (memq (process-status proc) '(run open))) 3189 (delete-process proc))) 3190 server-proc)) 3182 3191 t) 3183 3192 (t nil))) … … 3190 3199 (defun erc-cmd-GQUIT (reason) 3191 3200 "Disconnect from all servers at once with the same quit REASON." 3192 (erc-with-all-buffers-of-server nil #'(lambda () 3193 (and (erc-server-buffer-p) 3194 (erc-server-process-alive))) 3201 (erc-with-all-buffers-of-server nil #'erc-open-server-buffer-p 3195 3202 (erc-cmd-QUIT reason))) 3196 3203 … … 3200 3207 (defun erc-cmd-RECONNECT () 3201 3208 "Try to reconnect to the current IRC server." 3202 (setq erc-server-reconnect-count 0) 3203 (erc-server-reconnect) 3209 (let ((buffer (or (erc-server-buffer) (current-buffer))) 3210 (process nil)) 3211 (with-current-buffer (if (bufferp buffer) buffer (current-buffer)) 3212 (setq erc-server-quitting nil) 3213 (setq erc-server-reconnecting t) 3214 (setq erc-server-reconnect-count 0) 3215 (setq process (get-buffer-process (erc-server-buffer))) 3216 (if process 3217 (delete-process process) 3218 (erc-server-reconnect)) 3219 (setq erc-server-reconnecting nil))) 3204 3220 t) 3205 3221 … … 3374 3390 erc-channel-banlist nil) 3375 3391 ;; fetch the ban list then callback 3376 ( with-current-buffer (erc-server-buffer)3392 (erc-with-server-buffer 3377 3393 (erc-once-with-server-event 3378 3394 368 … … 3444 3460 (setq erc-server-367-functions 'erc-banlist-store) 3445 3461 ;; fetch the ban list then callback 3446 ( with-current-buffer (erc-server-buffer)3462 (erc-with-server-buffer 3447 3463 (erc-once-with-server-event 3448 3464 368 … … 3738 3754 buf)) 3739 3755 3740 (defcustom erc-auto-query nil3756 (defcustom erc-auto-query 'bury 3741 3757 "If non-nil, create a query buffer each time you receive a private message. 3742 3758 … … 3812 3828 (let ((newnick (nth 1 erc-default-nicks)) 3813 3829 (nicklen (cdr (assoc "NICKLEN" 3814 ( with-current-buffer (erc-server-buffer)3830 (erc-with-server-buffer 3815 3831 erc-server-parameters))))) 3816 3832 (setq erc-bad-nick t) … … 4102 4118 4103 4119 Set user modes and run `erc-after-connect' hook." 4104 (unless erc-server-connected ; only once per session 4105 (let ((server (or erc-server-announced-name (erc-response.sender parsed))) 4106 (nick (car (erc-response.command-args parsed )))) 4107 (setq erc-server-connected t) 4108 (erc-update-mode-line) 4109 (erc-set-initial-user-mode nick) 4110 (erc-server-setup-periodical-server-ping) 4111 (run-hook-with-args 'erc-after-connect server nick)))) 4112 4113 (defun erc-set-initial-user-mode (nick) 4114 "If `erc-user-mode' is non-nil for NICK, set the user modes." 4115 (when erc-user-mode 4116 (let ((mode (if (functionp erc-user-mode) 4117 (funcall erc-user-mode) 4118 erc-user-mode))) 4119 (when (stringp mode) 4120 (erc-log (format "changing mode for %s to %s" nick mode)) 4121 (erc-server-send (format "MODE %s %s" nick mode)))))) 4120 (with-current-buffer (process-buffer proc) 4121 (unless erc-server-connected ; only once per session 4122 (let ((server (or erc-server-announced-name 4123 (erc-response.sender parsed))) 4124 (nick (car (erc-response.command-args parsed))) 4125 (buffer (process-buffer proc))) 4126 (setq erc-server-connected t) 4127 (erc-update-mode-line) 4128 (erc-set-initial-user-mode nick buffer) 4129 (erc-server-setup-periodical-ping buffer) 4130 (run-hook-with-args 'erc-after-connect server nick))))) 4131 4132 (defun erc-set-initial-user-mode (nick buffer) 4133 "If `erc-user-mode' is non-nil for NICK, set the user modes. 4134 The server buffer is given by BUFFER." 4135 (with-current-buffer buffer 4136 (when erc-user-mode 4137 (let ((mode (if (functionp erc-user-mode) 4138 (funcall erc-user-mode) 4139 erc-user-mode))) 4140 (when (stringp mode) 4141 (erc-log (format "changing mode for %s to %s" nick mode)) 4142 (erc-server-send (format "MODE %s %s" nick mode))))))) 4122 4143 4123 4144 (defun erc-display-error-notice (parsed string) … … 4346 4367 (cond 4347 4368 (away-p 4348 (erc-with-all-buffers-of-server proc nil 4349 (setq erc-away (current-time)))) 4369 (setq erc-away (current-time))) 4350 4370 (t 4351 4371 (let ((away-time erc-away)) 4352 4372 ;; away must be set to NIL BEFORE sending anything to prevent 4353 4373 ;; an infinite recursion 4354 (erc-with-all-buffers-of-server proc nil 4355 (setq erc-away nil)) 4374 (setq erc-away nil) 4356 4375 (save-excursion 4357 4376 (set-buffer (erc-active-buffer)) … … 5038 5057 (defun erc-set-current-nick (nick) 5039 5058 "Set the current nickname to NICK." 5040 (with-current-buffer (or (erc-server-buffer) 5041 (current-buffer)) 5059 (with-current-buffer (if (buffer-live-p (erc-server-buffer)) 5060 (erc-server-buffer) 5061 (current-buffer)) 5042 5062 (setq erc-server-current-nick nick))) 5043 5063 … … 5120 5140 match, returns that regexp." 5121 5141 (catch 'found 5122 (dolist (ignored ( with-current-buffer (erc-server-buffer)erc-ignore-list))5142 (dolist (ignored (erc-with-server-buffer erc-ignore-list)) 5123 5143 (if (string-match ignored spec) 5124 5144 (throw 'found ignored))))) … … 5674 5694 user)))) 5675 5695 5676 (defun erc-away- p()5677 "Return t if the current ERC process is set away."5678 (save-excursion 5679 (and (erc-server-buffer-live-p) 5680 (set-buffer (process-buffer erc-server-process)) 5681 erc-away)))5696 (defun erc-away-time () 5697 "Return non-nil if the current ERC process is set away. 5698 5699 In particular, the time that we were set away is returned. 5700 See `current-time' for details on the time format." 5701 (erc-with-server-buffer erc-away)) 5682 5702 5683 5703 ;; Mode line handling … … 5707 5727 Only used starting in Emacs 21. 5708 5728 5729 Set this to nil if you do not want the header line to be 5730 displayed. 5731 5709 5732 See `erc-mode-line-format' for which characters are can be used." 5710 5733 :group 'erc-mode-line-and-header 5711 :type 'string) 5734 :set (lambda (sym val) 5735 (set sym val) 5736 (when (fboundp 'erc-update-mode-line) 5737 (erc-update-mode-line nil))) 5738 :type '(choice (const :tag "Disabled" nil) 5739 string)) 5712 5740 5713 5741 (defcustom erc-header-line-uses-help-echo-p t … … 5735 5763 (defcustom erc-common-server-suffixes 5736 5764 '(("openprojects.net$" . "OPN") 5737 ("freenode.net$" . "OPN")) 5765 ("freenode.net$" . "freenode") 5766 ("oftc.net$" . "OFTC")) 5738 5767 "Alist of common server name suffixes. 5739 5768 This variable is used in mode-line display to save screen … … 5787 5816 "Return a formatted `erc-mode-line-away-status-format' 5788 5817 if `erc-away' is non-nil." 5789 (let ((a (when (erc-server-buffer-live-p) 5790 (with-current-buffer (process-buffer erc-server-process) 5791 erc-away)))) 5818 (let ((a (erc-away-time))) 5792 5819 (if a 5793 5820 (format-time-string erc-mode-line-away-status-format a) … … 5814 5841 (defun erc-format-lag-time () 5815 5842 "Return the estimated lag time to server, `erc-server-lag'." 5816 (let ((lag (when (erc-server-buffer-live-p) 5817 (with-current-buffer (process-buffer erc-server-process) 5818 erc-server-lag)))) 5843 (let ((lag (erc-with-server-buffer erc-server-lag))) 5819 5844 (cond (lag (format "lag:%.0f" lag)) 5820 5845 (t "")))) … … 6138 6163 nick user host channel 6139 6164 (if (not (string= reason "")) 6140 (format ": %s" reason) 6165 (format ": %s" 6166 (erc-replace-regexp-in-string "%" "%%" reason)) 6141 6167 ""))))) 6142 6168 … … 6233 6259 (text-property-not-all (point-min) (point-max) 'erc-parsed nil)) 6234 6260 6261 (defun erc-restore-text-properties () 6262 "Restore the property 'erc-parsed for the region." 6263 (let ((parsed-posn (erc-find-parsed-property))) 6264 (put-text-property 6265 (point-min) (point-max) 6266 'erc-parsed (when parsed-posn (erc-get-parsed-vector parsed-posn))))) 6267 6235 6268 (defun erc-get-parsed-vector (point) 6236 6269 "Return the whole parsed vector on POINT." … … 6264 6297 (and (string-equal erc-session-server host) 6265 6298 (= erc-session-port port) 6266 erc-server-connected 6267 (eq (erc-server-buffer) (current-buffer)))))))) 6299 (erc-open-server-buffer-p))))))) 6268 6300 (with-current-buffer (or server-buffer (current-buffer)) 6269 6301 (if (and server-buffer channel)
