From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?G=C3=B6ktu=C4=9F?= Kayaalp Newsgroups: gmane.emacs.bugs Subject: bug#34374: 27.0.50; Outside an eww buffer, optionally use new buffer when calling eww instead of reusing *eww* Date: Fri, 08 Feb 2019 00:19:36 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="99745"; mail-complaints-to="usenet@blaine.gmane.org" To: 34374@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 07 22:27:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1grrCU-000Plf-Cf for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Feb 2019 22:27:14 +0100 Original-Received: from localhost ([127.0.0.1]:47188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grrCT-0007ip-CU for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Feb 2019 16:27:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grrCL-0007ie-PD for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:27:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grrCJ-0001TL-TS for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:27:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39376) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1grrCJ-0001TC-Od for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:27:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1grrCJ-00031F-DH for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:27:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?G=C3=B6ktu=C4=9F?= Kayaalp Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Feb 2019 21:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34374 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154957478811560 (code B ref -1); Thu, 07 Feb 2019 21:27:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Feb 2019 21:26:28 +0000 Original-Received: from localhost ([127.0.0.1]:38657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1grrBj-00030L-SU for submit@debbugs.gnu.org; Thu, 07 Feb 2019 16:26:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1grrBh-000308-P6 for submit@debbugs.gnu.org; Thu, 07 Feb 2019 16:26:26 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:49244) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grrBZ-0000R1-DG for submit@debbugs.gnu.org; Thu, 07 Feb 2019 16:26:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grrBX-0007d0-B1 for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:26:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grrBR-0000Io-Vn for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:26:13 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:60629) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grrBR-0000Ho-5i for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2019 16:26:09 -0500 X-Originating-IP: 176.218.86.160 Original-Received: from localhost (unknown [176.218.86.160]) (Authenticated sender: self@gkayaalp.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id A7772C0005 for ; Thu, 7 Feb 2019 21:26:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:155239 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eww should support conveniently avoiding using the same buffer even when not in an eww buffer (M-x eww or browse-url). Currently, in an eww buffer, =E2=80=98eww-open-in-new-buffer=E2=80=99 opens the link under point= in a new buffer, and =E2=80=98eww=E2=80=99 reuses the buffer. When running =E2=80= =98eww=E2=80=99 outside an eww buffer, it reuses the =E2=80=98*eww*=E2=80=99 buffer. Attached is a patch = where by default this behaviour is retained, but when a new custom, =E2=80=98eww-reuse-buffer=E2=80=99 is truthy (defaults to nil), Eww uses a = new buffer (obtained via =E2=80=98generate-new-buffer=E2=80=99) instead, unless the cu= rrent buffer is an eww buffer. The navigation behaviour in eww buffers is retained. I have manually tested the general use of EWW with this patch applied. But I haven=E2=80=99t found a test suite for EWW; if I missed it, I can run= it, or any other suggested testing. In case the patch is good enough to apply as it is, I have my copyright stuff sorted already. All the best, -gk. In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll= bars) of 2019-02-04 built on alpha Repository revision: ef17247fe9cab2d59e470daad24314c868248b0a Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 System Description: Debian GNU/Linux buster/sid Recent messages: Mark set [3 times] Mark saved where search started Mark set Auto-saving...done eww-reuse-buffer Quit [5 times] eww-reuse-buffer Saving file /home/g/co/External/emacs/lisp/net/eww.el... Wrote /home/g/co/External/emacs/lisp/net/eww.el Finding changes in /home/g/co/External/emacs/lisp/net/eww.el...done Quit Configured using: 'configure --prefix=3D/home/g/local/emacs --with-x-toolkit=3Dathena --with-imagemagick --with-modules --with-file-notification=3Dyes --with-gameuser=3Dno --with-mailutils' Configured features: XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LC_MONETARY: tr_TR.UTF-8 value of $LC_TIME: tr_TR.UTF-8 value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: Diff Minor modes in effect: auto-image-file-mode: t show-paren-mode: t gk-ucins-entry-mode: t global-gk-minor-mode: t gk-minor-mode: t yas-global-mode: t yas-minor-mode: t winner-mode: t global-whitespace-mode: t whitespace-mode: t which-key-mode: t save-place-mode: t persistent-scratch-autosave-mode: t global-paren-face-mode: t magit-todos-mode: t global-magit-file-mode: t url-handler-mode: t diff-auto-refine-mode: t global-git-commit-mode: t shell-dirtrack-mode: t eval-sexp-fu-flash-mode: t auto-insert-mode: t tooltip-mode: t global-eldoc-mode: t electric-quote-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow mailalias mail-extr emacsbug dired-aux misearch multi-isearch dabbrev eieio-opt speedbar sb-image ezimage dframe help-fns radix-tree network-stream url-cache vc-filewise sh-script executable vc-git org-rmail org-mhe org-irc org-info org-gnus nnir org-docview org-bibtex bibtex org-bbdb org-w3m term disp-table ehelp image-file paren init gk-feeds man emms-librefm-stream emms-librefm-scrobbler emms-playlist-limit emms-volume emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd emms-playing-time emms-lyrics emms-url emms-streams emms-show-all emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-opusinfo emms-info-ogginfo emms-info-mp3info emms-info later-do emms-playlist-mode emms-player-vlc emms-player-mpv emms-player-mplayer emms-player-simple emms-source-playlist emms-source-file locate ob-python ob-shell warnings ibuf-macs yasnippet elec-pair zencoding-mode winner whole-line-or-region whitespace which-key wdired vc-rcs vc-cvs vc vc-dispatcher tramp-cache tls gnutls time thinks spam spam-stat gnus-uu yenc gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig solarized color smtpmail sendmail scheme saveplace rmailsum python-django tree-widget sql view python tramp-sh tramp tramp-loaddefs trampver tramp-compat hippie-exp pixel-scroll persistent-scratch perl-mode pdf-tools pdf-sync pdf-outline pdf-links pdf-isearch pdf-misc pdf-view pdf-cache pdf-util pass-listing password-store paren-face paredit ox-org ox-hugo ox-blackfriday ox-md ox-groff ox-beamer ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox org-variable-pitch org-protocol org-mobile org-agenda org-inlinetask org-eww org-checklist org-capture olivetti nnfolder multiple-cursors mc-hide-unmatched-lines-mode mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors mc-edit-lines multiple-cursors-core mastodon mairix cus-edit cus-start cus-load magit-todos pcre2el rxt pcase re-builder hl-todo async grep magit-bookmark magit-imenu git-rebase magit-extras magit-ediff ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff magit-subtree magit-submodule magit-obsolete magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-collab ghub url-http url-gw nsm url-auth let-alist magit-files magit-refs magit-status magit package url-handlers magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode diff-mode magit-core magit-autorevert autorevert filenotify magit-process magit-margin magit-mode ls-lisp lua-mode lorem-ipsum js sgml-mode inf-ruby ruby-mode smie inf-lisp imenu image-dired ido ibuffer-vc ibuf-ext ibuffer ibuffer-loaddefs hl-line highlight-parentheses goto-last-change gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gk-unilat gk-greek quail git-commit with-editor cl-extra server magit-git magit-section magit-utils magit-popup log-edit pcvs-util add-log forecast subr-x org-element org org-macro org-footnote org-pcomplete org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs org-loaddefs solar cal-dst ffap face-remap f eww mm-url gnus nnheader evil evil-keybindings evil-integration evil-maps evil-commands reveal flyspell ispell evil-jumps evil-command-window evil-types evil-search evil-ex shell pcomplete evil-macros evil-repeat evil-states evil-core evil-common windmove evil-digraphs evil-vars edmacro kmacro eval-sexp-fu rx highlight etags multifile xref project epa-mail emms-setup emms emms-compat elfeed-show elfeed-search wid-edit message rmc format-spec rfc822 mml mml-sec epa epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mail-utils gmm-utils mailheader shr text-property-search puny svg dom elfeed-csv elfeed elfeed-curl url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf mailcap elfeed-log elfeed-db elfeed-lib url-util time-date avl-tree generator url-queue url-parse url-vars xml-query xml eimp dollar doc-view jka-compr image-mode dired-x dired-subtree dired-narrow delsel dired-hacks-utils dired dired-loaddefs diminish diff desktop frameset debug backtrace find-func dart-mode s ucs-normalize help-mode dash copyright compile comint ring cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cal-menu calendar cal-loaddefs browse-url boxquote rect bookmark pp bibliothek derived goto-addr thingatpt pdf-info tq a bbdb-vcard bbdb-com crm mailabbrev vcard bbdb easymenu bbdb-site timezone autoinsert auth-source eieio eieio-core cl-macs eieio-loaddefs password-cache json map seq byte-opt bytecomp byte-compile cconv apropos ansi-color ace-jump-mode advice cl gv cl-seq cl-loaddefs cl-lib mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 1132574 122251) (symbols 48 54836 160) (strings 32 248082 22021) (string-bytes 1 17577942) (vectors 16 107140) (vector-slots 8 1980171 171906) (floats 8 1038 502) (intervals 56 61571 2996) (buffers 992 40)) --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-Support-not-reusing-eww-buffer-when-navigating-from-.patch Content-Transfer-Encoding: quoted-printable Content-Description: the patch >From dd47aa509a7f7d7548e4c048e42e7dc32a12fbe9 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?=3DC4=3DB0=3D2E=3D20G=3DC3=3DB6ktu=3DC4=3D9F=3D20Kayaalp?= =3D Date: Thu, 7 Feb 2019 14:33:08 +0300 Subject: [PATCH] Support not reusing *eww* buffer when navigating from a non-eww one MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/net/eww.el (eww-reuse-buffer): New defcustom. * lisp/net/eww.el (eww): Use the above to decide whether to use =E2=80=98get-buffer-create=E2=80=99 or =E2=80=98generate-new-buffer=E2=80= =99. * doc/misc/eww.texi (Basics): * etc/NEWS: Document the new feature. --- doc/misc/eww.texi | 8 +++++++- etc/NEWS | 6 ++++++ lisp/net/eww.el | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index b299ea1fb7..cc96909ab3 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -98,10 +98,16 @@ Basics (@code{eww-copy-page-url}) will copy the current URL to the kill ring. =20 @findex eww-open-in-new-buffer +@vindex eww-reuse-buffer @kindex M-RET The @kbd{M-@key{RET}} command (@code{eww-open-in-new-buffer}) opens the URL at point in a new EWW buffer, akin to opening a link in a new -``tab'' in other browsers. +``tab'' in other browsers. If you want this same behavior when +following links or running @code{eww} in a buffer that is not in +@code{eww-mode}, set @code{eww-reuse-buffer} to @code{nil}. Normal +navigation within an @code{eww-mode} buffer will not be affected, but +running @kbd{M-x eww} or following a URI with @code{browse-url} family +of functions will result in new eww buffers. =20 @findex eww-readable @kindex R diff --git a/etc/NEWS b/etc/NEWS index 72a6b385a8..5dc4c8b8b2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -652,6 +652,12 @@ has been executed. If set, shr will not render tags with attribute 'aria-hidden=3D"true"'. This attribute is meant to tell screen readers to ignore a tag. =20 ++++ +*** New option 'eww-reuse-buffer'. +If set (default), eww will reuse the "*eww*" buffer when called from a +non-eww buffer. If not, it will generate a new buffer and use it +instead. + ** Htmlfontify =20 *** The functions 'hfy-color', 'hfy-color-vals' and diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3b7d9d5c2f..2ac4c606de 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -153,6 +153,12 @@ eww-form-checkbox-symbol (const "=E2=98=90") ; Unicode BALLOT BOX string)) =20 +(defcustom eww-reuse-buffer t + "Reuse the *eww* buffer when not in an `eww-mode' buffer." + :version "27.1" + :group 'eww + :type 'boolean) + (defface eww-form-submit '((((type x w32 ns) (class color)) ; Like default mode line :box (:line-width 2 :style released-button) @@ -250,7 +256,12 @@ eww-suggested-uris (defun eww (url) "Fetch URL and render the page. If the input doesn't look like an URL or a domain name, the -word(s) will be searched for via `eww-search-prefix'." +word(s) will be searched for via `eww-search-prefix'. + +When the current buffer is not in `eww-mode', if +`eww-reuse-buffer' is non-nil, the *eww* buffer will be reused if +available, otherwise generated; if set to nil instead, a new +buffer will be used in case *eww* is already in use." (interactive (let* ((uris (eww-suggested-uris)) (prompt (concat "Enter URL or keywords" @@ -261,7 +272,9 @@ eww (pop-to-buffer-same-window (if (eq major-mode 'eww-mode) (current-buffer) - (get-buffer-create "*eww*"))) + (funcall + (if eww-reuse-buffer #'get-buffer-create #'generate-new-buffer) + "*eww*"))) (eww-setup-buffer) ;; Check whether the domain only uses "Highly Restricted" Unicode ;; IDNA characters. If not, transform to punycode to indicate that --=20 2.20.1 --=-=-=--