41 |
41 |
42 ;; (setq recentf-menu-filter 'recentf-arrange-by-dir) ; Too slow with dir widgets. |
42 ;; (setq recentf-menu-filter 'recentf-arrange-by-dir) ; Too slow with dir widgets. |
43 ;; Don't sort ``recentf-list`` so ``recentf-open-files`` show files in historical order! |
43 ;; Don't sort ``recentf-list`` so ``recentf-open-files`` show files in historical order! |
44 (setq recentf-menu-filter nil) |
44 (setq recentf-menu-filter nil) |
45 |
45 |
46 (defun my-recentf.clean-project (dir) |
46 (defun my/recentf-clean-project (dir) |
47 "Remove from recentf all files that belong to DIR directory." |
47 "Remove from recentf all files that belong to DIR directory." |
48 (interactive (list (read-directory-name "Exclude all paths"))) |
48 (interactive (list (read-directory-name "Exclude all paths"))) |
49 (let ( recentf-exclude ) |
49 (let ( recentf-exclude ) |
50 (setq recentf-exclude (list (concat "^" (regexp-quote (expand-file-name dir))))) |
50 (setq recentf-exclude (list (concat "^" (regexp-quote (expand-file-name dir))))) |
51 (recentf-cleanup) )) |
51 (recentf-cleanup) )) |
1720 (setq message-user-fqdn "gavenkoa.example.com") |
1720 (setq message-user-fqdn "gavenkoa.example.com") |
1721 |
1721 |
1722 ;; Kill message buffer after mail send. You always can use C-c C-s to preserve it. |
1722 ;; Kill message buffer after mail send. You always can use C-c C-s to preserve it. |
1723 (setq message-kill-buffer-on-exit t) |
1723 (setq message-kill-buffer-on-exit t) |
1724 |
1724 |
1725 (defconst my-safe-filename-char-regex "[[:alnum:]-_!.@]" |
1725 (defconst my--message-safe-filename-regex "[[:alnum:]-_!.@]" |
1726 "Safe file names.") |
1726 "Safe file names.") |
1727 |
1727 |
1728 (defun my-clean-filename (filename) |
1728 (defun my--message-refine-filename (filename) |
1729 (mapconcat |
1729 (mapconcat |
1730 (lambda (ch) (or (when (string-match my-safe-filename-char-regex (char-to-string ch)) (char-to-string ch)) "-")) |
1730 (lambda (ch) (or (when (string-match my--message-safe-filename-regex (char-to-string ch)) (char-to-string ch)) "-")) |
1731 filename "") ) |
1731 filename "") ) |
1732 |
1732 |
1733 (defun my-message-save () |
1733 (defun my--message-save () |
1734 "Store message in `gnus-article-save-directory' after |
1734 "Store message in `gnus-article-save-directory' after |
1735 successful sending. It is possible that mail rejected and I lost |
1735 successful sending. It is possible that mail rejected and I lost |
1736 it completely, this func save it for me." |
1736 it completely, this func save it for me." |
1737 (unless (eq major-mode 'message-mode) |
1737 (unless (eq major-mode 'message-mode) |
1738 (error "Attempt to call my-message-save in non message-mode buffer")) |
1738 (error "Attempt to call my--message-save in non message-mode buffer")) |
1739 (make-directory gnus-article-save-directory t) |
1739 (make-directory gnus-article-save-directory t) |
1740 (let ( (buf (current-buffer)) |
1740 (let ( (buf (current-buffer)) |
1741 (field-to (my-clean-filename (or (message-fetch-field "Newsgroups") (message-fetch-field "To")))) |
1741 (field-to (my--message-refine-filename (or (message-fetch-field "Newsgroups") (message-fetch-field "To")))) |
1742 (field-subject (my-clean-filename (message-fetch-field "Subject"))) |
1742 (field-subject (my--message-refine-filename (message-fetch-field "Subject"))) |
1743 file ) |
1743 file ) |
1744 (when (> (length field-to) 32) |
1744 (when (> (length field-to) 32) |
1745 (setq field-to (substring field-to 0 32))) |
1745 (setq field-to (substring field-to 0 32))) |
1746 (when (> (length field-subject) 64) |
1746 (when (> (length field-subject) 64) |
1747 (setq field-subject (substring field-subject 0 64))) |
1747 (setq field-subject (substring field-subject 0 64))) |
1748 (setq file (concat gnus-article-save-directory "/" (format-time-string "%F_%H-%M-%S") "_" field-to "_" field-subject)) |
1748 (setq file (concat gnus-article-save-directory "/" (format-time-string "%F_%H-%M-%S") "_" field-to "_" field-subject)) |
1749 (with-temp-file file |
1749 (with-temp-file file |
1750 (insert-buffer-substring buf) |
1750 (insert-buffer-substring buf) |
1751 )) ) |
1751 )) ) |
1752 (add-hook 'message-sent-hook 'my-message-save) |
1752 (add-hook 'message-sent-hook 'my--message-save) |
1753 |
1753 |
1754 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1754 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1755 (message "smtp, smtpmail") |
1755 (message "smtp, smtpmail") |
1756 |
1756 |
1757 (when (and (not (eq system-type 'gnu/linux)) (boundp 'smtpmail-smtp-server)) |
1757 (when (and (not (eq system-type 'gnu/linux)) (boundp 'smtpmail-smtp-server)) |
2018 's (- gnus-score-interactive-default-score) (current-time-string))))) |
2018 's (- gnus-score-interactive-default-score) (current-time-string))))) |
2019 (gnus-summary-kill-same-subject unmark)) |
2019 (gnus-summary-kill-same-subject unmark)) |
2020 (my--eval-after-load gnus-sum |
2020 (my--eval-after-load gnus-sum |
2021 (define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject)) |
2021 (define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject)) |
2022 |
2022 |
2023 (defun my-gnus.mark-thread-as-read () |
2023 (defun my/gnus-mark-thread-as-read () |
2024 "Mark unmarked articles in current thread as read and move to |
2024 "Mark unmarked articles in current thread as read and move to |
2025 next thread without selecting article." |
2025 next thread without selecting article." |
2026 (interactive) |
2026 (interactive) |
2027 (gnus-summary-top-thread) |
2027 (gnus-summary-top-thread) |
2028 (catch 'exit |
2028 (catch 'exit |
2030 (when (eq (gnus-summary-article-mark (gnus-summary-article-number)) gnus-unread-mark) |
2030 (when (eq (gnus-summary-article-mark (gnus-summary-article-number)) gnus-unread-mark) |
2031 (gnus-summary-mark-article (gnus-summary-article-number) gnus-del-mark)) |
2031 (gnus-summary-mark-article (gnus-summary-article-number) gnus-del-mark)) |
2032 (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0)) |
2032 (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0)) |
2033 (throw 'exit nil)) ))) |
2033 (throw 'exit nil)) ))) |
2034 (my--eval-after-load gnus-sum |
2034 (my--eval-after-load gnus-sum |
2035 (define-key gnus-summary-mode-map (kbd "H-k") #'my-gnus.mark-thread-as-read)) |
2035 (define-key gnus-summary-mode-map (kbd "H-k") #'my/gnus-mark-thread-as-read)) |
2036 |
2036 |
2037 (defun my-gnus-thread-score-function (&rest scores) |
2037 (defun my-gnus-thread-score-function (&rest scores) |
2038 "If any followup have positive score assign greater available |
2038 "If any followup have positive score assign greater available |
2039 score to thread, else assign lesser available score." |
2039 score to thread, else assign lesser available score." |
2040 (let ( (max (apply 'max scores)) (min (apply 'min scores)) ) |
2040 (let ( (max (apply 'max scores)) (min (apply 'min scores)) ) |