unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37436: 27.0.50; Function proposal doc-view-open-file
@ 2019-09-17  6:31 Jean Louis
       [not found] ` <handler.37436.B.156870188321045.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Louis @ 2019-09-17  6:31 UTC (permalink / raw)
  To: 37436


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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#37436: Acknowledgement (27.0.50; Function proposal doc-view-open-file)
       [not found] ` <handler.37436.B.156870188321045.ack@debbugs.gnu.org>
@ 2019-09-17  7:04   ` Jean Louis
  2021-01-30  7:33     ` bug#37436: 27.0.50; Function proposal doc-view-open-file Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Louis @ 2019-09-17  7:04 UTC (permalink / raw)
  To: 37436

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)))))))))






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#37436: 27.0.50; Function proposal doc-view-open-file
  2019-09-17  7:04   ` bug#37436: Acknowledgement (27.0.50; Function proposal doc-view-open-file) Jean Louis
@ 2021-01-30  7:33     ` Lars Ingebrigtsen
  2021-03-01 15:21       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-30  7:33 UTC (permalink / raw)
  To: Jean Louis; +Cc: 37436

Jean Louis <bugs@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#37436: 27.0.50; Function proposal doc-view-open-file
  2021-01-30  7:33     ` bug#37436: 27.0.50; Function proposal doc-view-open-file Lars Ingebrigtsen
@ 2021-03-01 15:21       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-01 15:21 UTC (permalink / raw)
  To: Jean Louis; +Cc: 37436

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-01 15:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17  6:31 bug#37436: 27.0.50; Function proposal doc-view-open-file Jean Louis
     [not found] ` <handler.37436.B.156870188321045.ack@debbugs.gnu.org>
2019-09-17  7:04   ` bug#37436: Acknowledgement (27.0.50; Function proposal doc-view-open-file) Jean Louis
2021-01-30  7:33     ` bug#37436: 27.0.50; Function proposal doc-view-open-file Lars Ingebrigtsen
2021-03-01 15:21       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).