Show
Ignore:
Timestamp:
07/16/06 08:36:52 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/erc/erc-log.el

    r4035 r4111  
    116116                 (symbol))) 
    117117 
    118 (defcustom erc-save-buffer-on-part nil 
    119   "*Save the channel buffer content using `erc-save-buffer-in-logs' on PART." 
    120   :group 'erc-log 
    121   :type 'boolean) 
    122  
    123118(defcustom erc-truncate-buffer-on-save nil 
    124119  "Truncate any ERC (channel, query, server) buffer when it is saved." 
     
    151146                 (const nil))) 
    152147 
    153 (defcustom erc-log-insert-log-on-open t 
     148(defcustom erc-log-insert-log-on-open nil 
    154149  "*Insert log file contents into the buffer if a log file exists." 
    155150  :group 'erc-log 
    156151  :type 'boolean) 
    157152 
    158 (defcustom erc-save-queries-on-quit nil 
    159   "Save all query (also channel) buffers of the server on QUIT. 
    160 See the variable `erc-save-buffer-on-part' for details." 
     153(defcustom erc-save-buffer-on-part t 
     154  "*Save the channel buffer content using `erc-save-buffer-in-logs' on PART. 
     155 
     156If you set this to nil, you may want to enable both 
     157`erc-log-write-after-send' and `erc-log-write-after-insert'." 
     158  :group 'erc-log 
     159  :type 'boolean) 
     160 
     161(defcustom erc-save-queries-on-quit t 
     162  "*Save all query (also channel) buffers of the server on QUIT. 
     163 
     164If you set this to nil, you may want to enable both 
     165`erc-log-write-after-send' and `erc-log-write-after-insert'." 
     166  :group 'erc-log 
     167  :type 'boolean) 
     168 
     169(defcustom erc-log-write-after-send nil 
     170  "*If non-nil, write to log file after every message you send. 
     171 
     172If you set this to nil, you may want to enable both 
     173`erc-save-buffer-on-part' and `erc-save-queries-on-quit'." 
     174  :group 'erc-log 
     175  :type 'boolean) 
     176 
     177(defcustom erc-log-write-after-insert nil 
     178  "*If non-nil, write to log file when new text is added to a 
     179logged ERC buffer. 
     180 
     181If you set this to nil, you may want to enable both 
     182`erc-save-buffer-on-part' and `erc-save-queries-on-quit'." 
    161183  :group 'erc-log 
    162184  :type 'boolean) 
     
    188210          (not erc-away))))" 
    189211  ;; enable 
    190   ((add-hook 'erc-insert-post-hook 
    191              'erc-save-buffer-in-logs) 
    192    (add-hook 'erc-send-post-hook 
    193              'erc-save-buffer-in-logs)) 
     212  ((when erc-log-write-after-insert 
     213     (add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)) 
     214   (when erc-log-write-after-send 
     215     (add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)) 
     216   (add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs) 
     217   (add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) 
     218   (add-hook 'erc-quit-hook 'erc-conditional-save-queries) 
     219   (add-hook 'erc-part-hook 'erc-conditional-save-buffer) 
     220   ;; append, so that 'erc-initialize-log-marker runs first 
     221   (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)) 
    194222  ;; disable 
    195   ((remove-hook 'erc-insert-post-hook 
    196                 'erc-save-buffer-in-logs) 
    197    (remove-hook 'erc-send-post-hook 
    198                 'erc-save-buffer-in-logs))) 
    199  
    200 (when erc-enable-logging 
    201   (add-hook 'erc-kill-buffer-hook 
    202             'erc-save-buffer-in-logs) 
    203   (add-hook 'erc-kill-channel-hook 
    204             'erc-save-buffer-in-logs) 
    205   (add-hook 'erc-quit-hook 
    206             'erc-conditional-save-queries) 
    207   (add-hook 'erc-part-hook 
    208             'erc-conditional-save-buffer)) 
     223  ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs) 
     224   (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs) 
     225   (remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs) 
     226   (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) 
     227   (remove-hook 'erc-quit-hook 'erc-conditional-save-queries) 
     228   (remove-hook 'erc-part-hook 'erc-conditional-save-buffer) 
     229   (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging))) 
    209230 
    210231(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs) 
    211232 
    212 ;;;functionality referenced from erc.el 
     233;;; functionality referenced from erc.el 
    213234(defun erc-log-setup-logging () 
    214235  "Setup the buffer-local logging variables in the current buffer. 
     
    224245                     (move-marker erc-last-saved-position 
    225246                                  (1- (point-max))))))) 
    226  
    227 ;;; Append, so that 'erc-initialize-log-marker keeps running first. 
    228 (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append) 
    229247 
    230248(defun erc-log-all-but-server-buffers (buffer)