diff options
Diffstat (limited to 'lisp/org/ol-gnus.el')
-rw-r--r-- | lisp/org/ol-gnus.el | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lisp/org/ol-gnus.el b/lisp/org/ol-gnus.el index 99472315f67..af88c1a1532 100644 --- a/lisp/org/ol-gnus.el +++ b/lisp/org/ol-gnus.el @@ -34,7 +34,8 @@ (require 'gnus-sum) (require 'gnus-util) (require 'nnheader) -(require 'nnir) +(or (require 'nnselect nil t) ; Emacs >= 28 + (require 'nnir nil t)) ; Emacs < 28 (require 'ol) @@ -61,7 +62,7 @@ ;;; Customization variables (defcustom org-gnus-prefer-web-links nil - "If non-nil, `org-store-link' creates web links to Google groups or Gmane. + "If non-nil, `org-store-link' creates web links to Google groups. \\<org-mode-map>When nil, Gnus will be used for such links. Using a prefix argument to the command `\\[org-store-link]' (`org-store-link') negates this setting for the duration of the command." @@ -87,8 +88,8 @@ negates this setting for the duration of the command." (defun org-gnus-group-link (group) "Create a link to the Gnus group GROUP. If GROUP is a newsgroup and `org-gnus-prefer-web-links' is -non-nil, create a link to groups.google.com or gmane.org. -Otherwise create a link to the group inside Gnus. +non-nil, create a link to groups.google.com. Otherwise create a +link to the group inside Gnus. If `org-store-link' was called with a prefix arg the meaning of `org-gnus-prefer-web-links' is reversed." @@ -96,10 +97,7 @@ If `org-store-link' was called with a prefix arg the meaning of (if (and (string-prefix-p "nntp" group) ;; Only for nntp groups (org-xor current-prefix-arg org-gnus-prefer-web-links)) - (concat (if (string-match "gmane" unprefixed-group) - "http://news.gmane.org/" - "http://groups.google.com/group/") - unprefixed-group) + (concat "https://groups.google.com/group/" unprefixed-group) (concat "gnus:" group)))) (defun org-gnus-article-link (group newsgroups message-id x-no-archive) @@ -110,7 +108,7 @@ parameters are the Gnus GROUP, the NEWSGROUPS the article was posted to and the X-NO-ARCHIVE header value of that article. If GROUP is a newsgroup and `org-gnus-prefer-web-links' is -non-nil, create a link to groups.google.com or gmane.org. +non-nil, create a link to groups.google.com. Otherwise create a link to the article inside Gnus. If `org-store-link' was called with a prefix arg the meaning of @@ -118,9 +116,7 @@ If `org-store-link' was called with a prefix arg the meaning of (if (and (org-xor current-prefix-arg org-gnus-prefer-web-links) newsgroups ;make web links only for nntp groups (not x-no-archive)) ;and if X-No-Archive isn't set - (format (if (string-match-p "gmane\\." newsgroups) - "http://mid.gmane.org/%s" - "http://groups.google.com/groups/search?as_umsgid=%s") + (format "https://groups.google.com/groups/search?as_umsgid=%s" (url-encode-url message-id)) (concat "gnus:" group "#" message-id))) @@ -140,9 +136,15 @@ If `org-store-link' was called with a prefix arg the meaning of (`(nnvirtual . ,_) (save-excursion (car (nnvirtual-map-article (gnus-summary-article-number))))) - (`(nnir . ,_) + (`(,(or `nnselect `nnir) . ,_) ; nnir is for Emacs < 28. (save-excursion - (nnir-article-group (gnus-summary-article-number)))) + (cond + ((fboundp 'nnselect-article-group) + (nnselect-article-group (gnus-summary-article-number))) + ((fboundp 'nnir-article-group) + (nnir-article-group (gnus-summary-article-number))) + (t + (error "No article-group variant bound"))))) (_ gnus-newsgroup-name))) (header (if (eq major-mode 'gnus-article-mode) ;; When in an article, first move to summary @@ -215,7 +217,7 @@ If `org-store-link' was called with a prefix arg the meaning of (format "nntp+%s:%s" (or (cdr server) (car server)) group) article))) -(defun org-gnus-open (path) +(defun org-gnus-open (path _) "Follow the Gnus message or folder link specified by PATH." (unless (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path) (error "Error in Gnus link %S" path)) |