<commit_before>;;; init-wl.el --- Configuration file for the Wanderlust Email client
;;
;; Author: <NAME> <<EMAIL>>
;; Maintainer: <NAME>
;;
;; Created: Thu Jul 17 09:49:48 2008 (+0100)
;; Version: 0.1
;; Last-updated: Sun Apr 12 15:41:18 2009 (+0100)
;;           By: <NAME>
;;     Update #: 3
;; URL: http://www.emacswiki.org/emacs/hgw-init-wl.el
;; Keywords: convenience
;; Compatibility: GNU Emacs 23.x (may work with earlier versions)
;;
;; This file is NOT part of Emacs.
;;
;; ----------------------------------------------------------------------------
;;
;;; Commentary:
;;
;; This is my complete configuration file for Wanderlust, the excellent Email
;; client, which has been cobbled together from the examples and documentation
;; supplied with Wanderlust, reading the source-code, and scanning the mailing
;; lists <EMAIL>, <EMAIL> and of course from the web.
;; Mailing list postings by <NAME>, <NAME>, <NAME>AYAMA
;; have been particularly useful as have configuration files posted on the web
;; by <NAME>, <NAME> and <NAME>.
;;
;; ----------------------------------------------------------------------------
;;
;;; Change log:
;;
;; Version 0.1
;; * Initial release
;;
;; ----------------------------------------------------------------------------
;;
;; This program 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 3, or
;; (at your option) any later version.
;;
;; This program 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 this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;; ----------------------------------------------------------------------------
;;
;;; Code:

;; ----------------------------------------------------------------------------
;;; Autoload Wanderlust on command "wl"

(autoload 'wl "wl" "Wanderlust" t)
(autoload 'wl-other-frame "wl" "Wanderlust on new frame." nil)
(autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)
(autoload 'wl-user-agent-compose "wl-draft" "Compose with Wanderlust." t)


;; default setting for wanderlust
(setq
 wl-forward-subject-prefix "Fwd: " )    ;; use "Fwd: " not "Forward: "


;; Header From:
;;(setq wl-from "<NAME> <<EMAIL>>")

;; If (system-name) does not return FQDN,
;; set following as a local domain name without hostname.
;;(setq wl-local-domain "trs.com.cn")

;;(setq wl-subscribed-mailing-list t)
;;(setq wl-draft-delete-myself-from-cc t)
;; Mail-Followup-To:’ field is automatically inserted in the draft buffer
;; (setq wl-insert-mail-followup-to t)
;; ‘Mail-Reply-To:’ field is automatically inserted in the draft buffer.
(setq wl-insert-mail-reply-to t)

;; The initial setting is full. Style of draft buffer window (except for replying and forwarding). keep is to use current window, full is to use full frame window, split is to split current window and use it.
;;(setq wl-draft-buffer-style full)
;;(setq wl-draft-reply-buffer-style full)
;; Open draft in a frame
;;(setq wl-draft-use-frame t)


;; suggested by <NAME> on the WL mailing list
;;It's not uncommon to forget
;;to add a subject or an attachment when you send a mail (or at least, when I
;;send a mail…). However, using wl-mail-send-pre-hook we can let Wanderlust warn
;;us when something like that happens.
(defun djcb-wl-draft-subject-check ()
  "check whether the message has a subject before sending"
  (if (and (< (length (std11-field-body "Subject")) 1)
           (null (y-or-n-p "No subject! Send current draft?")))
      (error "Abort.")))


;; note, this check could cause some false positives; anyway, better
;; safe than sorry...
(defun djcb-wl-draft-attachment-check ()
  "if attachment is mention but none included, warn the the user"
  (save-excursion
    (goto-char 0)
    (unless ;; don't we have an attachment?

        (re-search-forward "^Content-Disposition: attachment" nil t)
      (when ;; no attachment; did we mention an attachment?
          (re-search-forward "attach" nil t)
        (unless (y-or-n-p "Possibly missing an attachment. Send current draft?")
          (error "Abort."))))))

(add-hook 'wl-mail-send-pre-hook 'djcb-wl-draft-subject-check)
(add-hook 'wl-mail-send-pre-hook 'djcb-wl-draft-attachment-check)

;; [[ SEMI Setting ]]

;; Disable inline display of HTML part.
;; Put before load `mime-setup'
(setq mime-setup-enable-inline-html nil)

;; Don't split large message.
(setq mime-edit-split-message nil)

;; If lines of message are larger than this value, treat it as `large'.
(setq mime-edit-message-default-max-lines 1000)
(require 'signature)


;; --------------------------
;; comment because there is no such metamail package of mimencode
;; solve some encode issue
;;(setq mel-b-ccl-module nil)
;;(setq mel-q-ccl-module nil)
;;(setq base64-external-encoder '("mimencode"))
;;(setq base64-external-decoder '("mimencode" "-u"))
;;(setq base64-external-decoder-option-to-specify-file '("-o"))
;;(setq quoted-printable-external-encoder '("mimencode" "-q"))
;;(setq quoted-printable-external-decoder '("mimencode" "-q" "-u"))
;;(setq quoted-printable-external-decoder-option-to-specify-file '("-o"))
;;(setq base64-internal-decoding-limit 0)
;;(setq base64-internal-encoding-limit 0)
;;(setq quoted-printable-internal-decoding-limit 0)
;;(setq quoted-printable-internal-encoding-limit 0)

;;(setq-default mime-transfer-level 8)
;;(setq mime-header-accept-quoted-encoded-words t)



;; ----------------------------------------------------------------------------
;;; w3m octet configuration for handling attachments

;;(require 'mime-w3m)
(require 'octet)
;;(require 'w3m-util)
(octet-mime-setup)

;;------------------------
;;  when a new e-mail has arrived, or when there's a meeting in 15 minutes you should attend.
;;  Pop-up a warning
(defun djcb-popup (title msg &optional icon sound)
  "Show a popup if we're on X, or echo it otherwise; TITLE is the title
of the message, MSG is the context. Optionally, you can provide an ICON and
a sound to be played"

  (interactive)
  (when sound (shell-command
               (concat "mplayer -really-quiet " sound " 2> /dev/null")))<commit_msg>changed<commit_after>;;; init-wl.el --- Configuration file for the Wanderlust Email client
;;
;; Author: <NAME> <<EMAIL>>
;; Maintainer: <NAME>
;;
;; Created: Thu Jul 17 09:49:48 2008 (+0100)
;; Version: 0.1
;; Last-updated: Sun Apr 12 15:41:18 2009 (+0100)
;;           By: <NAME>
;;     Update #: 3
;; URL: http://www.emacswiki.org/emacs/hgw-init-wl.el
;; Keywords: convenience
;; Compatibility: GNU Emacs 23.x (may work with earlier versions)
;;
;; This file is NOT part of Emacs.
;;
;; ----------------------------------------------------------------------------
;;
;;; Commentary:
;;
;; This is my complete configuration file for Wanderlust, the excellent Email
;; client, which has been cobbled together from the examples and documentation
;; supplied with Wanderlust, reading the source-code, and scanning the mailing
;; lists <EMAIL>, <EMAIL> and of course from the web.
;; Mailing list postings by <NAME>, <NAME>, <NAME>
;; have been particularly useful as have configuration files posted on the web
;; by <NAME>, <NAME> and <NAME>.
;;
;; ----------------------------------------------------------------------------
;;
;;; Change log:
;;
;; Version 0.1
;; * Initial release
;;
;; ----------------------------------------------------------------------------
;;
;; This program 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 3, or
;; (at your option) any later version.
;;
;; This program 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 this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;; ----------------------------------------------------------------------------
;;
;;; Code:

;; ----------------------------------------------------------------------------
;;; Autoload Wanderlust on command "wl"

(autoload 'wl "wl" "Wanderlust" t)
(autoload 'wl-other-frame "wl" "Wanderlust on new frame." nil)
(autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)
(autoload 'wl-user-agent-compose "wl-draft" "Compose with Wanderlust." t)


;; default setting for wanderlust
(setq
 wl-forward-subject-prefix "Fwd: " )    ;; use "Fwd: " not "Forward: "


;; Header From:
;;(setq wl-from "<NAME> <<EMAIL>>")

;; If (system-name) does not return FQDN,
;; set following as a local domain name without hostname.
;;(setq wl-local-domain "trs.com.cn")

;;(setq wl-subscribed-mailing-list t)
;;(setq wl-draft-delete-myself-from-cc t)
;; Mail-Followup-To:’ field is automatically inserted in the draft buffer
;; (setq wl-insert-mail-followup-to t)
;; ‘Mail-Reply-To:’ field is automatically inserted in the draft buffer.
(setq wl-insert-mail-reply-to t)

;; The initial setting is full. Style of draft buffer window (except for replying and forwarding). keep is to use current window, full is to use full frame window, split is to split current window and use it.
;;(setq wl-draft-buffer-style full)
;;(setq wl-draft-reply-buffer-style full)
;; Open draft in a frame
;;(setq wl-draft-use-frame t)


;; suggested by <NAME> on the WL mailing list
;;It's not uncommon to forget
;;to add a subject or an attachment when you send a mail (or at least, when I
;;send a mail…). However, using wl-mail-send-pre-hook we can let Wanderlust warn
;;us when something like that happens.
(defun djcb-wl-draft-subject-check ()
  "check whether the message has a subject before sending"
  (if (and (< (length (std11-field-body "Subject")) 1)
           (null (y-or-n-p "No subject! Send current draft?")))
      (error "Abort.")))


;; note, this check could cause some false positives; anyway, better
;; safe than sorry...
(defun djcb-wl-draft-attachment-check ()
  "if attachment is mention but none included, warn the the user"
  (save-excursion
    (goto-char 0)
    (unless ;; don't we have an attachment?

        (re-search-forward "^Content-Disposition: attachment" nil t)
      (when ;; no attachment; did we mention an attachment?
          (re-search-forward "attach" nil t)
        (unless (y-or-n-p "Possibly missing an attachment. Send current draft?")
          (error "Abort."))))))

(add-hook 'wl-mail-send-pre-hook 'djcb-wl-draft-subject-check)
(add-hook 'wl-mail-send-pre-hook 'djcb-wl-draft-attachment-check)

;; [[ SEMI Setting ]]

;; Disable inline display of HTML part.
;; Put before load `mime-setup'
(setq mime-setup-enable-inline-html nil)

;; Don't split large message.
(setq mime-edit-split-message nil)

;; If lines of message are larger than this value, treat it as `large'.
(setq mime-edit-message-default-max-lines 1000)
(require 'signature)


;; --------------------------
;; comment because there is no such metamail package of mimencode
;; solve some encode issue
;;(setq mel-b-ccl-module nil)
;;(setq mel-q-ccl-module nil)
;;(setq base64-external-encoder '("mimencode"))
;;(setq base64-external-decoder '("mimencode" "-u"))
;;(setq base64-external-decoder-option-to-specify-file '("-o"))
;;(setq quoted-printable-external-encoder '("mimencode" "-q"))
;;(setq quoted-printable-external-decoder '("mimencode" "-q" "-u"))
;;(setq quoted-printable-external-decoder-option-to-specify-file '("-o"))
;;(setq base64-internal-decoding-limit 0)
;;(setq base64-internal-encoding-limit 0)
;;(setq quoted-printable-internal-decoding-limit 0)
;;(setq quoted-printable-internal-encoding-limit 0)

;;(setq-default mime-transfer-level 8)
;;(setq mime-header-accept-quoted-encoded-words t)



;; ----------------------------------------------------------------------------
;;; w3m octet configuration for handling attachments

(require 'mime-w3m)
(require 'octet)
(require 'w3m-util)
(octet-mime-setup)

;;------------------------
;;  when a new e-mail has arrived, or when there's a meeting in 15 minutes you should attend.
;;  Pop-up a warning
(defun djcb-popup (title msg &optional icon sound)
  "Show a popup if we're on X, or echo it otherwise; TITLE is the title
of the message, MSG is the context. Optionally, you can provide an ICON and
a sound to be played"

  (interactive)
  (when sound (shell-command
               (concat "mplayer -really-quiet " sound " 2> /dev/null")))
{'fraction_non_alphanumeric': 0.2051242594444872, 'fraction_numerical': 0.012310533199969224, 'mean_word_length': 2.8285714285714287, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5606545', 'n_tokens_mistral': 4072, 'n_tokens_neox': 3860, 'n_words': 1431}