GNU bug report logs - #37436
27.0.50; Function proposal doc-view-open-file

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Tue, 17 Sep 2019 06:32:02 UTC

Severity: wishlist

Tags: moreinfo

Found in version 27.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37436 in the body.
You can then email your comments to 37436 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#37436; Package emacs. (Tue, 17 Sep 2019 06:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Louis <bugs <at> gnu.support>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Sep 2019 06:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Function proposal doc-view-open-file
Date: Tue, 17 Sep 2019 08:31:06 +0200
In my opinion there shall be function that opens files as supported by
doc-view, rather separate function and not just find-file.

Such function should especially support opening PDF, DJVU, and other doc
view files at specific page number. The function doc-view-goto-page
already exists, but what is missing is something like

(doc-view-open-file "my-pdf-file.pdf" page-number)

And additionally it would be useful to open PDF/DJVU files by query
search in the PDF file:

(doc-view-open-file "my-pdf-file.pdf" nil "Query search HERE")


In GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2019-09-07 built on protected.rcdrun.com
Repository revision: 40eb4c51a40a37c14e882e6db3f880ba4528c089
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Hyperbola GNU/Linux-libre

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
kill-line: End of buffer
funcall-interactively: End of buffer [2 times]

Configured using:
 'configure --prefix=/package/text/emacs-2019-09-07 --with-modules
 --without-gpm --with-x-toolkit=lucid
 PKG_CONFIG_PATH=/home/data1/protected/GNUstep/Library/Libraries/pkgconfig:/usr/lib/pkgconfig'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS JSON PDUMPER
LCMS2 GMP

Important settings:
  value of $LC_ALL: de_DE.UTF-8
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort hashcash mail-extr emacsbug message rmc puny dired
dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache
epa derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date subr-x seq byte-opt gv bytecomp
byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils 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 45601 7137)
 (symbols 48 6065 1)
 (strings 32 16273 2203)
 (string-bytes 1 520970)
 (vectors 16 9869)
 (vector-slots 8 127539 6408)
 (floats 8 22 19)
 (intervals 56 254 0)
 (buffers 992 13))

-- 
Thanks,
Jean Louis




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37436; Package emacs. (Tue, 17 Sep 2019 07:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 37436 <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: 37436 <at> debbugs.gnu.org
Subject: Re: bug#37436: Acknowledgement (27.0.50; Function proposal
 doc-view-open-file)
Date: Tue, 17 Sep 2019 09:04:00 +0200
I have made this function now for me. But such could be improved for
GNU Emacs so that PDF, DJVU and other doc view file could be opened
straight from Emacs Lisp and at the specific page number for specific
query, even query number could be implemented.

(defun doc-view-open-file (file &optional page-number query match)
  "Opens PDF file in GNU Emacs at specific page number or at
specific match"
  (let* ((allowed-extensions '("pdf" "djvu" "dvi"))
	 (file-ext (file-name-extension file))
	 (match (if match match 0)))
    (when (and (file-exists-p file)
	       (seq-contains allowed-extensions file-ext 'equalp))
      (setq doc-view--current-search-matches nil)
      (let ((created (create-file-buffer file))
	    (buffer (get-file-buffer file)))
	(switch-to-buffer created)
	(set-visited-file-name file )
	(insert file)
	(doc-view-mode)
	(when page-number
	  (doc-view-goto-page page-number))
	(when query
	  (let ((txt (expand-file-name "doc.txt"
				       (doc-view--current-cache-dir))))
	    (if (file-readable-p txt)
		(progn
		  (setq doc-view--current-search-matches
			(doc-view-search-internal query txt))
		  (doc-view-search-next-match match)))))))))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37436; Package emacs. (Sat, 30 Jan 2021 07:35:01 GMT) Full text and rfc822 format available.

Message #11 received at 37436 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 37436 <at> debbugs.gnu.org
Subject: Re: bug#37436: 27.0.50; Function proposal doc-view-open-file
Date: Sat, 30 Jan 2021 08:33:56 +0100
Jean Louis <bugs <at> gnu.support> writes:

> I have made this function now for me. But such could be improved for
> GNU Emacs so that PDF, DJVU and other doc view file could be opened
> straight from Emacs Lisp and at the specific page number for specific
> query, even query number could be implemented.
>
> (defun doc-view-open-file (file &optional page-number query match)
>   "Opens PDF file in GNU Emacs at specific page number or at
> specific match"

Makes sense to me.  I think I've asked you before -- are you willing to
sign a copyright assignment to the FSF, and then we could include this
function in doc-view.el?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 30 Jan 2021 07:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#37436; Package emacs. (Mon, 01 Mar 2021 15:23:02 GMT) Full text and rfc822 format available.

Message #16 received at 37436 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: 37436 <at> debbugs.gnu.org
Subject: Re: bug#37436: 27.0.50; Function proposal doc-view-open-file
Date: Mon, 01 Mar 2021 16:21:52 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Makes sense to me.  I think I've asked you before -- are you willing to
> sign a copyright assignment to the FSF, and then we could include this
> function in doc-view.el?

More information was requested, but no response was given within a
month, so I'm closing this bug report.  If this is something that should
still be worked on, please respond to this email and we'll reopen the
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 37436 <at> debbugs.gnu.org and Jean Louis <bugs <at> gnu.support> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 01 Mar 2021 15:23:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 30 Mar 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.