diff options
| author | Gnus developers | 2011-01-19 22:22:18 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-01-19 22:22:18 +0000 |
| commit | 672022e7fb15d230475b97e72c09b43c1ac10555 (patch) | |
| tree | 935cdd4ec6cce7fa41e341d391ce4e806f2d8329 /lisp | |
| parent | 8beb828a0bf0ba523cdd99396d036ab4b3bfa464 (diff) | |
| download | emacs-672022e7fb15d230475b97e72c09b43c1ac10555.tar.gz emacs-672022e7fb15d230475b97e72c09b43c1ac10555.zip | |
gnus-art.el (gnus-article-add-buttons): Simplify condition.
(gnus-button-push): Remove gnus-button-entry function, it fails heavily if you have the same regexp several times.
(gnus-button-push): Fix matching when regexp is symbol.
spam.el (spam-spamassassin-register-with-sa-learn): Insert a full From header with a date and "nobody" as the sender.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/gnus/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 92 | ||||
| -rw-r--r-- | lisp/gnus/spam.el | 5 |
3 files changed, 48 insertions, 61 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index b3d9ac82a9e..128e4bf024e 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2011-01-19 Tom Rauchenwald <sehnsucht.nach.unendlichkeit@quantentunnel.de> (tiny change) | ||
| 2 | |||
| 3 | * spam.el (spam-spamassassin-register-with-sa-learn): Insert a full | ||
| 4 | From header with a date and "nobody" as the sender. | ||
| 5 | |||
| 6 | 2011-01-19 Julien Danjou <julien@danjou.info> | ||
| 7 | |||
| 8 | * gnus-art.el (gnus-article-add-buttons): Simplify condition. | ||
| 9 | (gnus-button-push): Remove gnus-button-entry function, it fails heavily | ||
| 10 | if you have the same regexp several times. | ||
| 11 | (gnus-button-push): Fix matching when regexp is symbol. | ||
| 12 | |||
| 1 | 2011-01-15 Glenn Morris <rgm@gnu.org> | 13 | 2011-01-15 Glenn Morris <rgm@gnu.org> |
| 2 | 14 | ||
| 3 | * message.el (message-mail): A compose-mail function should | 15 | * message.el (message-mail): A compose-mail function should |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 36944267ad2..7c56acfebd4 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -4413,7 +4413,6 @@ commands: | |||
| 4413 | (gnus-update-format-specifications nil 'article-mode) | 4413 | (gnus-update-format-specifications nil 'article-mode) |
| 4414 | (set (make-local-variable 'page-delimiter) gnus-page-delimiter) | 4414 | (set (make-local-variable 'page-delimiter) gnus-page-delimiter) |
| 4415 | (set (make-local-variable 'gnus-page-broken) nil) | 4415 | (set (make-local-variable 'gnus-page-broken) nil) |
| 4416 | (make-local-variable 'gnus-button-marker-list) | ||
| 4417 | (make-local-variable 'gnus-article-current-summary) | 4416 | (make-local-variable 'gnus-article-current-summary) |
| 4418 | (make-local-variable 'gnus-article-mime-handles) | 4417 | (make-local-variable 'gnus-article-mime-handles) |
| 4419 | (make-local-variable 'gnus-article-decoded-p) | 4418 | (make-local-variable 'gnus-article-decoded-p) |
| @@ -4436,10 +4435,6 @@ commands: | |||
| 4436 | (mm-enable-multibyte) | 4435 | (mm-enable-multibyte) |
| 4437 | (gnus-run-mode-hooks 'gnus-article-mode-hook)) | 4436 | (gnus-run-mode-hooks 'gnus-article-mode-hook)) |
| 4438 | 4437 | ||
| 4439 | (defvar gnus-button-marker-list nil | ||
| 4440 | "Regexp matching any of the regexps from `gnus-button-alist'. | ||
| 4441 | Internal variable.") | ||
| 4442 | |||
| 4443 | (defun gnus-article-setup-buffer () | 4438 | (defun gnus-article-setup-buffer () |
| 4444 | "Initialize the article buffer." | 4439 | "Initialize the article buffer." |
| 4445 | (let* ((name (if gnus-single-article-buffer "*Article*" | 4440 | (let* ((name (if gnus-single-article-buffer "*Article*" |
| @@ -4483,8 +4478,6 @@ Internal variable.") | |||
| 4483 | (setq gnus-article-mime-handle-alist nil) | 4478 | (setq gnus-article-mime-handle-alist nil) |
| 4484 | (buffer-disable-undo) | 4479 | (buffer-disable-undo) |
| 4485 | (setq buffer-read-only t) | 4480 | (setq buffer-read-only t) |
| 4486 | ;; This list just keeps growing if we don't reset it. | ||
| 4487 | (setq gnus-button-marker-list nil) | ||
| 4488 | (unless (eq major-mode 'gnus-article-mode) | 4481 | (unless (eq major-mode 'gnus-article-mode) |
| 4489 | (gnus-article-mode)) | 4482 | (gnus-article-mode)) |
| 4490 | (setq truncate-lines gnus-article-truncate-lines) | 4483 | (setq truncate-lines gnus-article-truncate-lines) |
| @@ -7726,28 +7719,16 @@ It does this by highlighting everything after | |||
| 7726 | "Say whether PROP exists in the region." | 7719 | "Say whether PROP exists in the region." |
| 7727 | (text-property-not-all b e prop nil)) | 7720 | (text-property-not-all b e prop nil)) |
| 7728 | 7721 | ||
| 7729 | (defun gnus-article-add-buttons (&optional force) | 7722 | (defun gnus-article-add-buttons () |
| 7730 | "Find external references in the article and make buttons of them. | 7723 | "Find external references in the article and make buttons of them. |
| 7731 | \"External references\" are things like Message-IDs and URLs, as | 7724 | \"External references\" are things like Message-IDs and URLs, as |
| 7732 | specified by `gnus-button-alist'." | 7725 | specified by `gnus-button-alist'." |
| 7733 | (interactive (list 'force)) | 7726 | (interactive) |
| 7734 | (gnus-with-article-buffer | 7727 | (gnus-with-article-buffer |
| 7735 | (let ((inhibit-point-motion-hooks t) | 7728 | (let ((inhibit-point-motion-hooks t) |
| 7736 | (case-fold-search t) | 7729 | (case-fold-search t) |
| 7737 | (alist gnus-button-alist) | 7730 | (alist gnus-button-alist) |
| 7738 | beg entry regexp) | 7731 | beg entry regexp) |
| 7739 | ;; Remove all old markers. | ||
| 7740 | (let (marker entry new-list) | ||
| 7741 | (while (setq marker (pop gnus-button-marker-list)) | ||
| 7742 | (if (or (< marker (point-min)) (>= marker (point-max))) | ||
| 7743 | (push marker new-list) | ||
| 7744 | (goto-char marker) | ||
| 7745 | (when (setq entry (gnus-button-entry)) | ||
| 7746 | (put-text-property (match-beginning (nth 1 entry)) | ||
| 7747 | (match-end (nth 1 entry)) | ||
| 7748 | 'gnus-callback nil)) | ||
| 7749 | (set-marker marker nil))) | ||
| 7750 | (setq gnus-button-marker-list new-list)) | ||
| 7751 | ;; We skip the headers. | 7732 | ;; We skip the headers. |
| 7752 | (article-goto-body) | 7733 | (article-goto-body) |
| 7753 | (setq beg (point)) | 7734 | (setq beg (point)) |
| @@ -7758,18 +7739,16 @@ specified by `gnus-button-alist'." | |||
| 7758 | (let ((start (match-beginning (nth 1 entry))) | 7739 | (let ((start (match-beginning (nth 1 entry))) |
| 7759 | (end (match-end (nth 1 entry))) | 7740 | (end (match-end (nth 1 entry))) |
| 7760 | (from (match-beginning 0))) | 7741 | (from (match-beginning 0))) |
| 7761 | (when (and (or (eq t (nth 2 entry)) | 7742 | (when (and (eval (nth 2 entry)) |
| 7762 | (eval (nth 2 entry))) | ||
| 7763 | (not (gnus-button-in-region-p | 7743 | (not (gnus-button-in-region-p |
| 7764 | start end 'gnus-callback))) | 7744 | start end 'gnus-callback))) |
| 7765 | ;; That optional form returned non-nil, so we add the | 7745 | ;; That optional form returned non-nil, so we add the |
| 7766 | ;; button. | 7746 | ;; button. |
| 7767 | (setq from (set-marker (make-marker) from)) | 7747 | (setq from (set-marker (make-marker) from)) |
| 7768 | (push from gnus-button-marker-list) | ||
| 7769 | (unless (and (eq (car entry) 'gnus-button-url-regexp) | 7748 | (unless (and (eq (car entry) 'gnus-button-url-regexp) |
| 7770 | (gnus-article-extend-url-button from start end)) | 7749 | (gnus-article-extend-url-button from start end)) |
| 7771 | (gnus-article-add-button start end | 7750 | (gnus-article-add-button start end |
| 7772 | 'gnus-button-push from) | 7751 | 'gnus-button-push (list from entry)) |
| 7773 | (gnus-put-text-property | 7752 | (gnus-put-text-property |
| 7774 | start end | 7753 | start end |
| 7775 | 'gnus-string (buffer-substring-no-properties | 7754 | 'gnus-string (buffer-substring-no-properties |
| @@ -7916,41 +7895,38 @@ url is put as the `gnus-button-url' overlay property on the button." | |||
| 7916 | (let ((gnus-article-mime-handle-alist-1 gnus-article-mime-handle-alist)) | 7895 | (let ((gnus-article-mime-handle-alist-1 gnus-article-mime-handle-alist)) |
| 7917 | (gnus-set-mode-line 'article)))) | 7896 | (gnus-set-mode-line 'article)))) |
| 7918 | 7897 | ||
| 7919 | (defun gnus-button-entry () | 7898 | (defun gnus-button-push (marker-and-entry) |
| 7920 | ;; Return the first entry in `gnus-button-alist' matching this place. | ||
| 7921 | (let ((alist gnus-button-alist) | ||
| 7922 | (entry nil)) | ||
| 7923 | (while alist | ||
| 7924 | (setq entry (pop alist)) | ||
| 7925 | (if (looking-at (eval (car entry))) | ||
| 7926 | (setq alist nil) | ||
| 7927 | (setq entry nil))) | ||
| 7928 | entry)) | ||
| 7929 | |||
| 7930 | (defun gnus-button-push (marker) | ||
| 7931 | ;; Push button starting at MARKER. | 7899 | ;; Push button starting at MARKER. |
| 7932 | (save-excursion | 7900 | (save-excursion |
| 7933 | (goto-char marker) | 7901 | (let* ((marker (car marker-and-entry)) |
| 7934 | (let* ((entry (gnus-button-entry)) | 7902 | (entry (cadr marker-and-entry)) |
| 7935 | (inhibit-point-motion-hooks t) | 7903 | (regexp (car entry)) |
| 7936 | (fun (nth 3 entry)) | 7904 | (inhibit-point-motion-hooks t)) |
| 7937 | (args (or (and (eq (car entry) 'gnus-button-url-regexp) | 7905 | (goto-char marker) |
| 7938 | (get-char-property marker 'gnus-button-url)) | 7906 | ;; This is obviously true, or something bad is happening :) |
| 7939 | (mapcar (lambda (group) | 7907 | ;; But we need it to have the match-data |
| 7940 | (let ((string (match-string group))) | 7908 | (when (looking-at (or (if (symbolp regexp) |
| 7941 | (set-text-properties | 7909 | (symbol-value regexp) |
| 7942 | 0 (length string) nil string) | 7910 | regexp))) |
| 7943 | string)) | 7911 | (let ((fun (nth 3 entry)) |
| 7944 | (nthcdr 4 entry))))) | 7912 | (args (or (and (eq (car entry) 'gnus-button-url-regexp) |
| 7945 | (cond | 7913 | (get-char-property marker 'gnus-button-url)) |
| 7946 | ((fboundp fun) | 7914 | (mapcar (lambda (group) |
| 7947 | (apply fun args)) | 7915 | (let ((string (match-string group))) |
| 7948 | ((and (boundp fun) | 7916 | (set-text-properties |
| 7949 | (fboundp (symbol-value fun))) | 7917 | 0 (length string) nil string) |
| 7950 | (apply (symbol-value fun) args)) | 7918 | string)) |
| 7951 | (t | 7919 | (nthcdr 4 entry))))) |
| 7952 | (gnus-message 1 "You must define `%S' to use this button" | 7920 | |
| 7953 | (cons fun args))))))) | 7921 | (cond |
| 7922 | ((fboundp fun) | ||
| 7923 | (apply fun args)) | ||
| 7924 | ((and (boundp fun) | ||
| 7925 | (fboundp (symbol-value fun))) | ||
| 7926 | (apply (symbol-value fun) args)) | ||
| 7927 | (t | ||
| 7928 | (gnus-message 1 "You must define `%S' to use this button" | ||
| 7929 | (cons fun args))))))))) | ||
| 7954 | 7930 | ||
| 7955 | (defun gnus-parse-news-url (url) | 7931 | (defun gnus-parse-news-url (url) |
| 7956 | (let (scheme server port group message-id articles) | 7932 | (let (scheme server port group message-id articles) |
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 194668e8dc8..3bce27625d0 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el | |||
| @@ -2726,9 +2726,8 @@ With a non-nil REMOVE, remove the ADDRESSES." | |||
| 2726 | (with-current-buffer summary-buffer-name | 2726 | (with-current-buffer summary-buffer-name |
| 2727 | (setq article-string (spam-get-article-as-string article))) | 2727 | (setq article-string (spam-get-article-as-string article))) |
| 2728 | (when (stringp article-string) | 2728 | (when (stringp article-string) |
| 2729 | (insert "From \n") ; mbox separator (sa-learn only checks the | 2729 | ;; mbox separator |
| 2730 | ; first five chars, so we can get away with | 2730 | (insert (concat "From nobody " (current-time-string) "\n")) |
| 2731 | ; a bogus line)) | ||
| 2732 | (insert article-string) | 2731 | (insert article-string) |
| 2733 | (insert "\n")))) | 2732 | (insert "\n")))) |
| 2734 | ;; call sa-learn on all messages at the same time | 2733 | ;; call sa-learn on all messages at the same time |