From 2e76c12c577989479dc497fc3afdef3e04b263a1 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Tue, 19 Oct 2010 22:20:47 +0000 Subject: [PATCH] Merge changes made in Gnus trunk. gnus.texi (Customizing the IMAP Connection): The port strings are strings. nnmairix.el (nnmairix-summary-mode-hook): Move nnmairix's `$' command to `G G' to avoid collisions. shr.el (shr-parse-style, shr-tag-span): New functions. nndoc.el (nndoc-type-alist): Add git support. (nndoc-git-type-p, nndoc-transform-git-article, nndoc-transform-git-headers): New functions. --- doc/misc/gnus.texi | 2 +- lisp/gnus/ChangeLog | 13 +++++++++++++ lisp/gnus/nndoc.el | 27 +++++++++++++++++++++++++++ lisp/gnus/nnmairix.el | 12 ++++++------ lisp/gnus/shr.el | 23 +++++++++++++++++++++++ 5 files changed, 70 insertions(+), 7 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 1a1f0d48eb9..c0b504ef5b3 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -14872,7 +14872,7 @@ The address of the server, like @samp{imap.gmail.com}. @item nnimap-server-port If the server uses a non-standard port, that can be specified here. A -typical port would be @samp{imap} or @samp{imaps}. +typical port would be @code{"imap"} or @code{"imaps"}. @item nnimap-stream How @code{nnimap} should connect to the server. Possible values are: diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 4c77c73db1d..f05cec4dd18 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,16 @@ +2010-10-19 Lars Magne Ingebrigtsen + + * nndoc.el (nndoc-type-alist): Add git support. + (nndoc-git-type-p): New function. + (nndoc-transform-git-article): Ditto. + (nndoc-transform-git-headers): Ditto. + + * shr.el (shr-parse-style): New function. + (shr-tag-span): Ditto. + + * nnmairix.el (nnmairix-summary-mode-hook): Move nnmairix's `$' command + to `G G' to avoid collisions. + 2010-10-19 Katsumi Yamaoka * shr.el: Load kinsoku if necessary. diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el index 6c9ef1cef87..5d946f5a6ec 100644 --- a/lisp/gnus/nndoc.el +++ b/lisp/gnus/nndoc.el @@ -138,6 +138,14 @@ from the document.") (generate-head-function . nndoc-generate-lanl-gov-head) (article-transform-function . nndoc-transform-lanl-gov-announce) (subtype preprints guess)) + (git + (file-begin . "\n- Log ---.*") + (article-begin . "^commit ") + (head-begin . "^Author: ") + (body-begin . "^$") + (file-end . "\n-----------------------------------------------------------------------") + (article-transform-function . nndoc-transform-git-article) + (header-transform-function . nndoc-transform-git-headers)) (rfc822-forward (article-begin . "^\n+") (body-end-function . nndoc-rfc822-forward-body-end-function) @@ -193,6 +201,7 @@ from the document.") (defvoo nndoc-prepare-body-function nil) (defvoo nndoc-generate-head-function nil) (defvoo nndoc-article-transform-function nil) +(defvoo nndoc-header-transform-function nil) (defvoo nndoc-article-begin-function nil) (defvoo nndoc-generate-article-function nil) (defvoo nndoc-dissection-function nil) @@ -234,6 +243,8 @@ from the document.") (insert (format "Lines: %d\n" (nth 4 entry))) (insert ".\n"))) + (when nndoc-header-transform-function + (funcall nndoc-header-transform-function)) (nnheader-fold-continuation-lines) 'headers))))) @@ -373,6 +384,7 @@ from the document.") nndoc-file-end nndoc-article-begin nndoc-body-begin nndoc-body-end-function nndoc-body-end nndoc-prepare-body-function nndoc-article-transform-function + nndoc-header-transform-function nndoc-generate-head-function nndoc-body-begin-function nndoc-head-begin-function nndoc-generate-article-function @@ -649,6 +661,21 @@ from the document.") (defun nndoc-slack-digest-type-p () 0) +(defun nndoc-git-type-p () + (and (search-forward "\n- Log ---" nil t) + (search-forward "\ncommit " nil t) + (search-forward "\nAuthor: " nil t))) + +(defun nndoc-transform-git-article (article) + (goto-char (point-min)) + (when (re-search-forward "^Author: " nil t) + (replace-match "From: " t t))) + +(defun nndoc-transform-git-headers () + (goto-char (point-min)) + (while (re-search-forward "^Author: " nil t) + (replace-match "From: " t t))) + (defun nndoc-lanl-gov-announce-type-p () (when (let ((case-fold-search nil)) (re-search-forward "^\\\\\\\\\n\\(Paper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z-\\.]+/[0-9]+\\|arXiv:\\)" nil t)) diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el index 0b7f0a40bd3..f63a860875a 100644 --- a/lisp/gnus/nnmairix.el +++ b/lisp/gnus/nnmairix.el @@ -188,17 +188,17 @@ (defun nnmairix-summary-mode-hook () "Nnmairix summary mode keymap." (define-key gnus-summary-mode-map - (kbd "$ t") 'nnmairix-search-thread-this-article) + (kbd "G G t") 'nnmairix-search-thread-this-article) (define-key gnus-summary-mode-map - (kbd "$ f") 'nnmairix-search-from-this-article) + (kbd "G G f") 'nnmairix-search-from-this-article) (define-key gnus-summary-mode-map - (kbd "$ m") 'nnmairix-widget-search-from-this-article) + (kbd "G G m") 'nnmairix-widget-search-from-this-article) (define-key gnus-summary-mode-map - (kbd "$ g") 'nnmairix-create-search-group-from-message) + (kbd "G G g") 'nnmairix-create-search-group-from-message) (define-key gnus-summary-mode-map - (kbd "$ o") 'nnmairix-goto-original-article) + (kbd "G G o") 'nnmairix-goto-original-article) (define-key gnus-summary-mode-map - (kbd "$ u") 'nnmairix-remove-tick-mark-original-article)) + (kbd "G G u") 'nnmairix-remove-tick-mark-original-article)) (add-hook 'gnus-group-mode-hook 'nnmairix-group-mode-hook) (add-hook 'gnus-summary-mode-hook 'nnmairix-summary-mode-hook) diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index d16899c14b7..e360eab9064 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el @@ -410,6 +410,29 @@ Return a string with image data." (defun shr-tag-s (cont) (shr-fontize-cont cont 'strike-through)) +(defun shr-tag-span (cont) + (let ((start (point)) + (color (cdr (assq 'color (shr-parse-style (cdr (assq :style cont))))))) + (shr-generic cont) + (when color + (let ((overlay (make-overlay start (point)))) + (overlay-put overlay 'face (cons 'foreground-color color)))))) + +(defun shr-parse-style (style) + (when style + (let ((plist nil)) + (dolist (elem (split-string style ";")) + (when elem + (setq elem (split-string elem ":")) + (when (and (car elem) + (cadr elem)) + (let ((name (replace-regexp-in-string "^ +\\| +$" "" (car elem))) + (value (replace-regexp-in-string "^ +\\| +$" "" (cadr elem)))) + (push (cons (intern name obarray) + value) + plist))))) + plist))) + (defun shr-tag-a (cont) (let ((url (cdr (assq :href cont))) (start (point)) -- 2.39.5