From: Lars Magne Ingebrigtsen Date: Thu, 13 Jun 2013 14:31:52 +0000 (+0000) Subject: lisp/gnus/shr.el (shr-expand-url): Expansion should chop off the bits after the last... X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2016^2~129 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=94fa6ec7b306b47c251f7b8b67662598027a7ff3;p=emacs.git lisp/gnus/shr.el (shr-expand-url): Expansion should chop off the bits after the last slash lisp/gnus/eww.el (eww-tag-select): Use the first value as the default value --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index ff086ebffda..83831264f58 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,10 @@ +2013-06-13 Lars Magne Ingebrigtsen + + * shr.el (shr-expand-url): Expansion should chop off the bits after the + last slash. + + * eww.el (eww-tag-select): Use the first value as the default value. + 2013-06-13 Rüdiger Sonderfeld * eww.el (eww): Prepend urls with http:// if scheme is missing. diff --git a/lisp/gnus/eww.el b/lisp/gnus/eww.el index 3f0399ed258..d4dd178fb70 100644 --- a/lisp/gnus/eww.el +++ b/lisp/gnus/eww.el @@ -154,9 +154,12 @@ (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url)) (defun eww-browse-url (url &optional new-window) - (push (list eww-current-url (point)) - eww-history) - (eww url)) + (let ((url-request-extra-headers + (append '(("User-Agent" . "eww/1.0")) + url-request-extra-headers))) + (push (list eww-current-url (point)) + eww-history) + (eww url))) (defun eww-quit () "Exit the Emacs Web Wowser." @@ -254,6 +257,9 @@ :value (cdr (assq :value (cdr elem))) :tag (cdr (assq 'text (cdr elem)))) options))) + ;; If we have no selected values, default to the first value. + (unless (plist-get (cdr menu) :value) + (nconc menu (list :value (nth 2 (car options))))) (nconc menu options) (apply 'widget-create menu) (put-text-property start (point) 'eww-widget menu) diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index 0a2c698a106..8cb16634e2b 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el @@ -492,7 +492,10 @@ size, and full-buffer size." url (let ((base shr-base)) ;; Chop off query string. - (when (string-match "^\\([^?]+\\)[?]" base) + (when (string-match "\\`\\([^?]+\\)[?]" base) + (setq base (match-string 1 base))) + ;; Chop off the bit after the last slash. + (when (string-match "\\`\\(.*\\)[/][^/]+" base) (setq base (match-string 1 base))) (cond ((and (string-match "\\`//" url)