all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Viewing PDFs as text?
@ 2008-03-10 20:52 Alan
  2008-03-10 22:59 ` Peter Dyballa
                   ` (3 more replies)
  0 siblings, 4 replies; 44+ messages in thread
From: Alan @ 2008-03-10 20:52 UTC (permalink / raw)
  To: help-gnu-emacs

Less (via lesspipe, I think) is able to read pdf files as text, using
pdftotext.  It would be much easier for me to browse pdfs using
emacs.

I would like to do this from dired.

There is a doc-view.el facility, that seems too complicated for me.
Did I misunderstand that, or is it possible in some other way to view
pdfs from dired, as text?

Thank you for any ideas.

Alan Davis


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

* Re: Viewing PDFs as text?
  2008-03-10 20:52 Viewing PDFs as text? Alan
@ 2008-03-10 22:59 ` Peter Dyballa
       [not found] ` <mailman.8684.1205189951.18990.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 44+ messages in thread
From: Peter Dyballa @ 2008-03-10 22:59 UTC (permalink / raw)
  To: Alan; +Cc: help-gnu-emacs


Am 10.03.2008 um 21:52 schrieb Alan:

> There is a doc-view.el facility, that seems too complicated for me.

What is too complicated? By typing v on a PDF file I can see it a bit  
later, after background conversion to PNG format.

The other option, without doc-view, is, for example: ! pdtotext RET

--
Greetings

   Pete

      _o    o         o   o
    _<<     \\_/\_,   \\_ \\_/\_,
   (*)/(*) (*)   (*) (*) `-    (*)






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

* Re: Viewing PDFs as text?
       [not found] ` <mailman.8684.1205189951.18990.help-gnu-emacs@gnu.org>
@ 2008-03-11  3:42   ` Roland Winkler
  2008-03-11  7:45     ` Tassilo Horn
       [not found]     ` <mailman.8699.1205221811.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 44+ messages in thread
From: Roland Winkler @ 2008-03-11  3:42 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 10.03.2008 um 21:52 schrieb Alan:
>
>> There is a doc-view.el facility, that seems too complicated for me.
>
> What is too complicated? By typing v on a PDF file I can see it a
> bit  later, after background conversion to PNG format.

It would be nice if doc-view used a plain text format if emacs is
running in a tty. Or am I missing something?

Roland


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

* Re: Viewing PDFs as text?
  2008-03-10 20:52 Viewing PDFs as text? Alan
  2008-03-10 22:59 ` Peter Dyballa
       [not found] ` <mailman.8684.1205189951.18990.help-gnu-emacs@gnu.org>
@ 2008-03-11  7:43 ` Tassilo Horn
  2008-03-11  8:07 ` Tim X
  3 siblings, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-11  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

Alan <lngndvs@gmail.com> writes:

> Less (via lesspipe, I think) is able to read pdf files as text, using
> pdftotext.  It would be much easier for me to browse pdfs using emacs.
>
> I would like to do this from dired.

! pdftotext ? - RET

will show the text in a new buffer.

> There is a doc-view.el facility, that seems too complicated for me.

It's not complicated.  Just hit v on the file in dired.  But doc-view.el
works only if you run an x11 emacs.

Bye,
Tassilo
-- 
If programmers deserve to  be rewarded for creating innovative programs,
by the same  token they deserve to be punished if  they restrict the use
of these programs. (Richard M. Stallman)





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

* Re: Viewing PDFs as text?
  2008-03-11  3:42   ` Roland Winkler
@ 2008-03-11  7:45     ` Tassilo Horn
       [not found]     ` <mailman.8699.1205221811.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-11  7:45 UTC (permalink / raw)
  To: help-gnu-emacs

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> It would be nice if doc-view used a plain text format if emacs is
> running in a tty. Or am I missing something?

No, I'll have a look if that's easy to do.  Til then you can use

  ! pdftotext ? - RET

from within dired.

Bye,
Tassilo
-- 
Richard Stallman  doesn't use web browsers,  he sends a link  to a demon
that uses wget to fetch the page and sends it back to him.





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

* Re: Viewing PDFs as text?
  2008-03-10 20:52 Viewing PDFs as text? Alan
                   ` (2 preceding siblings ...)
  2008-03-11  7:43 ` Tassilo Horn
@ 2008-03-11  8:07 ` Tim X
  2008-03-20  6:19   ` Alan
  3 siblings, 1 reply; 44+ messages in thread
From: Tim X @ 2008-03-11  8:07 UTC (permalink / raw)
  To: help-gnu-emacs

Alan <lngndvs@gmail.com> writes:

> Less (via lesspipe, I think) is able to read pdf files as text, using
> pdftotext.  It would be much easier for me to browse pdfs using
> emacs.
>
> I would like to do this from dired.
>
> There is a doc-view.el facility, that seems too complicated for me.
> Did I misunderstand that, or is it possible in some other way to view
> pdfs from dired, as text?
>

doc-view will do what you want. However, if you just want a text version
of the file, you may find the following useful. this is my txutils.el
package. It converts various file types (doc, pdf, ps etc) to text or
sometimes html and then displays the output in an emacs buffer. I use
advice to attach this to view-file (v in dired). As an added benefit, if
you do a view file on an html file, it will render in w3m. 

Note that this works perfectly for me. Your milage may differ and you
may find bugs. I'm certanly happy to recieve bug reports, but cannot
guarantee a timely update/fix.

Tim

;;      Filename: /home/tcross/projects/emacs-convert/txutils.el
;; Creation Date: Wednesday, 20 September 2006 10:13 PM EST
;; Last Modified: Monday, 27 November 2006 06:38 PM EST
;;       Version: 2.0
;;        Author: Tim Cross 
;;   Description: Convert files from doc, ps, pdf, ppt to a format
;;                which can be viewed within emacs (i.e. text or html)

;;;
;;; This file is not part of GNU Emacs, but the same permissions apply.
;;; This file is released under the Free software foundation GPL. 
;;;
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; GNU Emacs is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING.  If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;;
;;; Commentary
;;; ==========
;;;
;;; The very simple idea behind this basic utility is to make accessing
;;; files in .doc, .pdf, .ps and .ppt more easily accessible without
;;; having to leave emacs or manually convert the file format prior
;;; to being able to view the contents in emacs.
;;;
;;; There are packages which will enable calls to external viewers
;;; for files of specific formats, such as xpdf for pdf etc. However,
;;; I wanted to have everything within emacs as this makes integration,
;;; cutting/pasting etc a lot easier, plus as a blind user, most
;;; external utilities are of little use because they don't also include
;;; speech support.
;;;
;;; The objective here is to have things setup so that when browsing
;;; a directory with dired, you can just hit 'v' for any file you want to
;;; view and you will be presented with a text or html version without
;;; needing to do any manual conversion - or even careing about what
;;; would need to be done.
;;;
;;; You need the following packages (or at least utilities which will
;;; do the same thing). Most of these are fairly standard with many Linux 
;;; distros these days. 
;;; The wv utilities which contain wvText for converting MS Word docs
;;; The xpdf utilities which include pdftotext for converting PDF to text
;;; The Ghostscript package which contains pstotext for converting PS to text
;;; The ppthtml utility for converting MS Power Point files to html
;;; A configured and working browse-url setup. I use w3m as my browser
;;;
;;; Customizing 
;;; ===========
;;;
;;; The easiest way to customize the conversion utility settings is to
;;; use M-x customize-group <RET> txutils <RET>
;;;
;;; In the txutils customize group, you will find just one setting, which
;;; is an alist of values indexed by a regular expression that matches against
;;; file extensions - a crude way of determining the source filetype
;;; (i.e. *.doc, *.pdf, *.ps, *.ppt, *.xls, *.html etc). See the
;;; documentation for more details.
;;;
;;; Installation 
;;; ============
;;; 
;;; Pretty straight forward. Place this file somewhere in your load path 
;;; and put a (require 'txutils) in your .emacs. You may want to byte
;;; compile this file.
;;;
;;; Thanks
;;; ======
;;;
;;; A number of people provided suggestions on how to improve both my elisp
;;; and the program itself. In particular, thanks goes to
;;; Lukas Loehrer
;;; Vinicius Jose Latorre
;;; Andreas Roehler
;;;
;;; plus a few others who gave general suggestions, feedback and
;;; encouragement. Thanks to everyone for taking the time and putting
;;; in the effort, its greatly appreciated.
;;; 
;;; Reporting Bugs
;;; ==============
;;; 
;;; This is the first bit of elisp I've allowed out into the world and 
;;; while I am really learning to love both elisp and cl lisp, I'm still 
;;; very much a novice. Therefore, there IS bugs and probably some pretty 
;;; poor style within this stuff. Feedback, bug reports and suggestions 
;;; always welcome. Send e-mail to tcross@une.edu.au
;;;

(require 'custom)
(require 'browse-url)

; make-temp-file is part of apel prior to emacs 22
(static-when (= emacs-major-version 21)
  (require 'poe))

(defgroup txutils nil
  "Customize group for txutils."
  :prefix "txutils-"
  :group 'External)

(defcustom txutils-convert-alist
  '( ;; MS Word
    ("\\.\\(?:DOC\\|doc\\)$"     doc  "/usr/bin/wvText"    nil nil nil nil nil)
    ;; PDF
    ("\\.\\(?:PDF\\|pdf\\)$"     pdf  "/usr/bin/pdftotext" nil nil nil nil nil)
    ;; PostScript
    ("\\.\\(?:PS\\|ps\\)$"       ps   "/usr/bin/pstotext"  "-output" t nil nil nil)
    ;; MS PowerPoint
    ("\\.\\(?:PPT\\|ppt\\)$"     ppt  "/usr/bin/ppthtml"   nil nil nil t t))

  "*Association for program convertion.

Each element has the following form:

(REGEXP SYMBOL CONVERTER SWITCHES INVERT REDIRECT-INPUT REDIRECT-OUTPUT HTML-OUTPUT)

Where:

REGEXP		   is a regexp to match file type to convert.

SYMBOL		   is a symbol to designate the fyle type.

CONVERTER	   is a program to convert the fyle type to text or HTML.

SWITCHES	   is a string which gives command line switches for the conversion 
               program. Nil means there are no switches needed.

INVERT		   indicates if input and output program option is to be 
               inverted or not.  Non-nil means to invert, that is, output 
               option first then input option.  Nil means do not invert, 
               that is, input option first then output option.

REDIRECT-INPUT indicates to use < to direct input from the input
               file. This is useful for utilities which accept input
               from stdin rather than a file.

REDIRECT-OUTPUT indicates to use > to direct output to the output
               file. This is useful for utilities that only send output to 
               stdout.

HTML-OUTPUT    Indicates the conversion program creates HTML output 
               rather than plain text."

  :type '(repeat
          (list :tag "Convertion"
                (regexp  :tag "File Type Regexp")
                (symbol  :tag "File Type Symbol")
                (string  :tag "Converter")
                (choice  :menu-tag "Output Option"
                         :tag "Output Option"
                         (const :tag "None" nil)
                         string)
                (boolean :tag "Invert I/O Option")
                (boolean :tag "Redirect Standard Input")
                (boolean :tag "Redirect Standard Output")
                (boolean :tag "HTML Output")))
  :group 'txutils)

(defun txutils-run-command (cmd &optional output-buffer)
  "Execute shell command with arguments, putting output in buffer."
  (= 0 (shell-command cmd (if output-buffer
                              output-buffer
                            "*txutils-output*")
                          (if output-buffer
                              "*txutils-output*"))))

(defun txutils-quote-expand-file-name (file-name)
  "Expand file name and quote special chars if required."
  (shell-quote-argument (expand-file-name file-name)))

(defun txutils-file-alist (file-name)
  "Return alist associated with file of this type."
  (let ((al txutils-convert-alist))
    (while (and al 
                (not (string-match (caar al) file-name)))
      (setq al (cdr al)))
    (if al
        (cdar al)
      nil)))

(defun txutils-make-temp-name (orig-name type-alist)
  "Create a temp file name from original file name"
  (make-temp-file (file-name-sans-extension 
                   (file-name-nondirectory orig-name)) nil
                  (if (nth 7 type-alist)
                      ".html"
                    ".txt")))

(defun txutils-build-cmd (input-file output-file type-alist)
  "Create the command string from conversion alist."
  (let ((f1 (if (nth 3 type-alist)
                output-file
              input-file))
        (f2 (if (nth 3 type-alist)
                input-file
              output-file)))
    (concat
     (nth 1 type-alist)
     (if (nth 2 type-alist)               ; Add cmd line switches
         (concat " " (nth 2 type-alist)))
     (if (nth 4 type-alist)          ; redirect input (which may be output
         (concat " < " f1)           ; if arguments are inverted!)
       (concat " " f1))
     (if (nth 5 type-alist)          ; redirect output (see above comment)
         (concat " > " f2)
       (concat " " f2)))))

(defun txutils-do-file-conversion (file-name)
  "Based on file extension, convert file to text. Return name of text file"
  (interactive "fFile to convert: ")
  (let ((f-alist (txutils-file-alist file-name))
        output-file)
    (when f-alist
      (message "Performing file conversion for %s." file-name)
      (setq output-file (txutils-make-temp-name file-name f-alist))
      (message "Command: %s" (txutils-build-cmd file-name output-file f-alist))
      (if (txutils-run-command 
           (txutils-build-cmd (txutils-quote-expand-file-name file-name)
                              (txutils-quote-expand-file-name 
                               output-file) f-alist))
          output-file
        file-name))))

(defadvice view-file (around txutils pre act comp)
  "Perform file conversion or call web browser to view contents of file."
  (let ((file-arg (ad-get-arg 0)))
    (if (txutils-file-alist file-arg)
      (ad-set-arg 0 (txutils-do-file-conversion file-arg)))
    (if (string-match "\\.\\(?:HTML?\\|html?\\)$" (ad-get-arg 0))
        (browse-url-of-file (ad-get-arg 0))
      ad-do-it)))

(provide 'txutils)



-- 
tcross (at) rapttech dot com dot au


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

* Re: Viewing PDFs as text?
       [not found]     ` <mailman.8699.1205221811.18990.help-gnu-emacs@gnu.org>
@ 2008-03-11 13:11       ` Roland Winkler
  2008-03-11 17:57         ` Bastien
                           ` (2 more replies)
  0 siblings, 3 replies; 44+ messages in thread
From: Roland Winkler @ 2008-03-11 13:11 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:
> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
>
>> It would be nice if doc-view used a plain text format if emacs is
>> running in a tty. Or am I missing something?
>
> No, I'll have a look if that's easy to do.  Til then you can use
>
>   ! pdftotext ? - RET
>
> from within dired.

Of course, not all pdf files are such that pdftotext can give
meaningful results. Figures and, say, formulas in a file generated
with pdflatex will be screwed up. However, fairly often I need to
use a tty. Anything that helps me along that way is greatly
appreciated. For me, one of the big advantages of emacs is that it
allows me to get the most out of a plain old tty.

Roland


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

* Re: Viewing PDFs as text?
  2008-03-11 13:11       ` Roland Winkler
@ 2008-03-11 17:57         ` Bastien
  2008-03-11 20:51           ` Stefan Monnier
  2008-03-12  8:32           ` Tassilo Horn
  2008-03-12 13:45         ` Tassilo Horn
       [not found]         ` <mailman.8756.1205329519.18990.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 44+ messages in thread
From: Bastien @ 2008-03-11 17:57 UTC (permalink / raw)
  To: emacs developers; +Cc: Roland Winkler

When trying to view a PDF with in a tty, `doc-view-initiate-display'
throws an error about missing support for image, png or other utilities.

Maybe it would be better to display the output of pdftotext directly in
a tty.  In X Window, the default behavior would be to display the image
when images are supported, and to fall back on pdftotext when not.

What do you think?

PS: See the request below by Roland.

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> Tassilo Horn <tassilo@member.fsf.org> writes:
>> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
>>
>>> It would be nice if doc-view used a plain text format if emacs is
>>> running in a tty. Or am I missing something?
>>
>> No, I'll have a look if that's easy to do.  Til then you can use
>>
>>   ! pdftotext ? - RET
>>
>> from within dired.
>
> Of course, not all pdf files are such that pdftotext can give
> meaningful results. Figures and, say, formulas in a file generated
> with pdflatex will be screwed up. However, fairly often I need to
> use a tty. Anything that helps me along that way is greatly
> appreciated. For me, one of the big advantages of emacs is that it
> allows me to get the most out of a plain old tty.

-- 
Bastien




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

* Re: Viewing PDFs as text?
  2008-03-11 17:57         ` Bastien
@ 2008-03-11 20:51           ` Stefan Monnier
  2008-03-12  8:32           ` Tassilo Horn
  1 sibling, 0 replies; 44+ messages in thread
From: Stefan Monnier @ 2008-03-11 20:51 UTC (permalink / raw)
  To: Bastien; +Cc: Roland Winkler, emacs developers

> When trying to view a PDF with in a tty, `doc-view-initiate-display'
> throws an error about missing support for image, png or other utilities.

> Maybe it would be better to display the output of pdftotext directly in
> a tty.  In X Window, the default behavior would be to display the image
> when images are supported, and to fall back on pdftotext when not.

> What do you think?

Sounds like a good idea, but the implementation doesn't seem
as obvious.  So... patches welcome,


        Stefan


> PS: See the request below by Roland.

> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

>> Tassilo Horn <tassilo@member.fsf.org> writes:
>>> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
>>> 
>>>> It would be nice if doc-view used a plain text format if emacs is
>>>> running in a tty. Or am I missing something?
>>> 
>>> No, I'll have a look if that's easy to do.  Til then you can use
>>> 
>>> ! pdftotext ? - RET
>>> 
>>> from within dired.
>> 
>> Of course, not all pdf files are such that pdftotext can give
>> meaningful results. Figures and, say, formulas in a file generated
>> with pdflatex will be screwed up. However, fairly often I need to
>> use a tty. Anything that helps me along that way is greatly
>> appreciated. For me, one of the big advantages of emacs is that it
>> allows me to get the most out of a plain old tty.

> -- 
> Bastien





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

* Re: Viewing PDFs as text?
  2008-03-11 17:57         ` Bastien
  2008-03-11 20:51           ` Stefan Monnier
@ 2008-03-12  8:32           ` Tassilo Horn
  2008-03-12  9:54             ` Phil Jackson
  2008-03-12 12:11             ` Tassilo Horn
  1 sibling, 2 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-12  8:32 UTC (permalink / raw)
  To: emacs-devel

Bastien <bzg@altern.org> writes:

Hi Bastien,

> When trying to view a PDF with in a tty, `doc-view-initiate-display'
> throws an error about missing support for image, png or other
> utilities.
>
> Maybe it would be better to display the output of pdftotext directly
> in a tty.  In X Window, the default behavior would be to display the
> image when images are supported, and to fall back on pdftotext when
> not.

That would be the ideal behavior.  But looking at the code it seems
quite hard to do, especially if you want to keep most/all of doc-view's
features.

What could be done was to open a separate buffer (in fundamental-mode)
that displays the output of pdftotext.  I'll give that a try.

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2008-03-12  8:32           ` Tassilo Horn
@ 2008-03-12  9:54             ` Phil Jackson
  2008-03-12 12:12               ` Tassilo Horn
  2008-03-12 12:11             ` Tassilo Horn
  1 sibling, 1 reply; 44+ messages in thread
From: Phil Jackson @ 2008-03-12  9:54 UTC (permalink / raw)
  To: emacs-devel

Tassilo Horn <tassilo@member.fsf.org> writes:

>> When trying to view a PDF with in a tty, `doc-view-initiate-display'
>> throws an error about missing support for image, png or other
>> utilities.
>>
>> Maybe it would be better to display the output of pdftotext directly
>> in a tty.  In X Window, the default behavior would be to display the
>> image when images are supported, and to fall back on pdftotext when
>> not.
>
> That would be the ideal behavior.  But looking at the code it seems
> quite hard to do, especially if you want to keep most/all of doc-view's
> features.
>
> What could be done was to open a separate buffer (in fundamental-mode)
> that displays the output of pdftotext.  I'll give that a try.

How about a generic 2txt mode that could use any of the 2txt (odt, ods,
xls, doc, pdf, ps, ...) tools and do the right thing? Something like:

("\\.\\(pdf\\|xls\\|..." . 2txt-mode) in the auto-mode-alist and then
the mode uses the correct tool depending on the extension.

Cheers,
Phil
-- 
 Phil Jackson




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

* Re: Viewing PDFs as text?
  2008-03-12  8:32           ` Tassilo Horn
  2008-03-12  9:54             ` Phil Jackson
@ 2008-03-12 12:11             ` Tassilo Horn
  1 sibling, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-12 12:11 UTC (permalink / raw)
  To: emacs-devel

Tassilo Horn <tassilo@member.fsf.org> writes:

>> When trying to view a PDF with in a tty, `doc-view-initiate-display'
>> throws an error about missing support for image, png or other
>> utilities.
>>
>> Maybe it would be better to display the output of pdftotext directly
>> in a tty.  In X Window, the default behavior would be to display the
>> image when images are supported, and to fall back on pdftotext when
>> not.
>
> That would be the ideal behavior.  But looking at the code it seems
> quite hard to do, especially if you want to keep most/all of
> doc-view's features.
>
> What could be done was to open a separate buffer (in fundamental-mode)
> that displays the output of pdftotext.  I'll give that a try.

That's now in CVS.  With C-c C-t you can open a new buffer that shows
the text of the current document.  When d-v-m doesn't work this binding
will be mentioned.

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2008-03-12  9:54             ` Phil Jackson
@ 2008-03-12 12:12               ` Tassilo Horn
  0 siblings, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-12 12:12 UTC (permalink / raw)
  To: emacs-devel

Phil Jackson <phil@shellarchive.co.uk> writes:

Hi Phil,

> How about a generic 2txt mode that could use any of the 2txt (odt,
> ods, xls, doc, pdf, ps, ...) tools and do the right thing?

Sounds like a good idea.  Patches welcome.

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2008-03-11 13:11       ` Roland Winkler
  2008-03-11 17:57         ` Bastien
@ 2008-03-12 13:45         ` Tassilo Horn
  2008-03-13  3:37           ` Bastien
       [not found]         ` <mailman.8756.1205329519.18990.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 44+ messages in thread
From: Tassilo Horn @ 2008-03-12 13:45 UTC (permalink / raw)
  To: help-gnu-emacs

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

Hi Roland,

>> No, I'll have a look if that's easy to do.  Til then you can use
>>
>>   ! pdftotext ? - RET
>>
>> from within dired.
>
> Of course, not all pdf files are such that pdftotext can give
> meaningful results. Figures and, say, formulas in a file generated
> with pdflatex will be screwed up. However, fairly often I need to use
> a tty. Anything that helps me along that way is greatly
> appreciated. For me, one of the big advantages of emacs is that it
> allows me to get the most out of a plain old tty.

In emacs from the current CVS I've added a new binding C-c C-t in
doc-view-mode which opens the text of the current doc in a new buffer.
When on a tty a message mentions that.

Bye,
Tassilo





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

* Re: Viewing PDFs as text?
       [not found]         ` <mailman.8756.1205329519.18990.help-gnu-emacs@gnu.org>
@ 2008-03-12 15:38           ` Roland Winkler
  2008-03-18 22:47             ` Roland Winkler
  0 siblings, 1 reply; 44+ messages in thread
From: Roland Winkler @ 2008-03-12 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:
> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
> In emacs from the current CVS I've added a new binding C-c C-t in
> doc-view-mode which opens the text of the current doc in a new buffer.
> When on a tty a message mentions that.

Currently I am unabled to test that. But I'll do it as soon as I
can.

Roland


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

* Re: Viewing PDFs as text?
  2008-03-12 13:45         ` Tassilo Horn
@ 2008-03-13  3:37           ` Bastien
  2008-03-13  9:29             ` Tassilo Horn
  0 siblings, 1 reply; 44+ messages in thread
From: Bastien @ 2008-03-13  3:37 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

Hi Tassilo,

Tassilo Horn <tassilo@member.fsf.org> writes:

>> Of course, not all pdf files are such that pdftotext can give
>> meaningful results. Figures and, say, formulas in a file generated
>> with pdflatex will be screwed up. However, fairly often I need to use
>> a tty. Anything that helps me along that way is greatly
>> appreciated. For me, one of the big advantages of emacs is that it
>> allows me to get the most out of a plain old tty.
>
> In emacs from the current CVS I've added a new binding C-c C-t in
> doc-view-mode which opens the text of the current doc in a new buffer.
> When on a tty a message mentions that.

Thanks for this! 

I tried it and found this problem: when the buffer is already converted
C-c C-t on it will fail because it tries to create a directory that does
already exist.

,----
| (defun doc-view-doc->txt (txt callback)
|   "Convert the current document to text and call CALLBACK when done."
|   (make-directory (doc-view-current-cache-dir))
`----

A check before making this directory is enough to make it work ok here,
but you know the code better than I do. 

HTH,

-- 
Bastien




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

* Re: Viewing PDFs as text?
  2008-03-13  3:37           ` Bastien
@ 2008-03-13  9:29             ` Tassilo Horn
  2008-03-13 10:09               ` Bastien
  2008-03-13 11:49               ` Emacs 23 and msb.el Guy Durrieu
  0 siblings, 2 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-13  9:29 UTC (permalink / raw)
  To: Bastien; +Cc: help-gnu-emacs

Bastien <bzg@altern.org> writes:

Hi Bastien,

> I tried it and found this problem: when the buffer is already
> converted C-c C-t on it will fail because it tries to create a
> directory that does already exist.
>
> ,----
> | (defun doc-view-doc->txt (txt callback)
> |   "Convert the current document to text and call CALLBACK when done."
> |   (make-directory (doc-view-current-cache-dir))
> `----
>
> A check before making this directory is enough to make it work ok
> here, but you know the code better than I do.

That shouldn't happen.

,----[ C-h f make-directory RET ]
| make-directory is an interactive compiled Lisp function in `files.el'.
| 
| (make-directory dir &optional parents)
| 
| Create the directory dir and any nonexistent parent dirs.
| If dir already exists as a directory, do nothing.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----

Are you sure this is the place the error is thrown?

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2008-03-13  9:29             ` Tassilo Horn
@ 2008-03-13 10:09               ` Bastien
  2008-03-13 10:30                 ` Tassilo Horn
  2008-03-13 11:49               ` Emacs 23 and msb.el Guy Durrieu
  1 sibling, 1 reply; 44+ messages in thread
From: Bastien @ 2008-03-13 10:09 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:

> ,----[ C-h f make-directory RET ]
> | make-directory is an interactive compiled Lisp function in `files.el'.
> | 
> | (make-directory dir &optional parents)
> | 
> | Create the directory dir and any nonexistent parent dirs.
> | If dir already exists as a directory, do nothing.
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> `----

Ok, so for me `make-directory' throws an error where it should silently
do nothing.  Strange.  I'm using Emacs 23.0.60.2 -- don't you have this
error?

-- 
Bastien




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

* Re: Viewing PDFs as text?
  2008-03-13 10:09               ` Bastien
@ 2008-03-13 10:30                 ` Tassilo Horn
  2008-03-13 18:32                   ` Tassilo Horn
  0 siblings, 1 reply; 44+ messages in thread
From: Tassilo Horn @ 2008-03-13 10:30 UTC (permalink / raw)
  To: Bastien; +Cc: help-gnu-emacs

Bastien <bzg@altern.org> writes:

Hi Bastien,

>> ,----[ C-h f make-directory RET ]
>> | make-directory is an interactive compiled Lisp function in `files.el'.
>> | 
>> | (make-directory dir &optional parents)
>> | 
>> | Create the directory dir and any nonexistent parent dirs.
>> | If dir already exists as a directory, do nothing.
>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> `----
>
> Ok, so for me `make-directory' throws an error where it should
> silently do nothing.  Strange.  I'm using Emacs 23.0.60.2 -- don't you
> have this error?

Hm, when I tried the code yesterday I didn't get that error.  Now I
updated my emacs and I can reproduce the problem.  I'll report a bug for
that.

Bye,
Tassilo
-- 
Richard Stallman is the only man  alive who can pronounce GNU the way it
is meant to be pronounced.




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

* Emacs 23 and msb.el
  2008-03-13  9:29             ` Tassilo Horn
  2008-03-13 10:09               ` Bastien
@ 2008-03-13 11:49               ` Guy Durrieu
  2008-11-06  6:36                 ` Emacs 23: strange character display Guy Durrieu
  1 sibling, 1 reply; 44+ messages in thread
From: Guy Durrieu @ 2008-03-13 11:49 UTC (permalink / raw)
  To: help-gnu-emacs


Hello,

I recently tried emacs 23. Until now I was using  msb.el, but it doesn't
seem to work anymore with this version (Symbol's function definition is
void: menu-bar-select-buffer) although it still is in the distribution.

Did I miss something ?

Thanks in advance for your help !

Regards.

-- Guy Durrieu.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Guy DURRIEU                  e-mail Guy.Durrieu@cert.fr
ONERA /DTIM
CEntRe de Toulouse, 2, avenue Edouard Belin  B.P. 74025
31055 TOULOUSE CEDEX 4 FRANCE
tel    (33) 05.62.25.26.59   fax    (33) 05.62.25.25.93
avertissement http://www.onera.fr/onera-en/emails-terms
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=







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

* Re: Viewing PDFs as text?
  2008-03-13 10:30                 ` Tassilo Horn
@ 2008-03-13 18:32                   ` Tassilo Horn
  2008-03-13 18:45                     ` Bastien Guerry
  0 siblings, 1 reply; 44+ messages in thread
From: Tassilo Horn @ 2008-03-13 18:32 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:

>>> ,----[ C-h f make-directory RET ]
>>> | make-directory is an interactive compiled Lisp function in `files.el'.
>>> | 
>>> | (make-directory dir &optional parents)
>>> | 
>>> | Create the directory dir and any nonexistent parent dirs.
>>> | If dir already exists as a directory, do nothing.
>>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> `----
>>
>> Ok, so for me `make-directory' throws an error where it should
>> silently do nothing.  Strange.  I'm using Emacs 23.0.60.2 -- don't
>> you have this error?
>
> Hm, when I tried the code yesterday I didn't get that error.  Now I
> updated my emacs and I can reproduce the problem.  I'll report a bug
> for that.

Ok, I did that and the function works correctly, but the docstring was
wrong.  I fixed doc-view.el accordingly.

Thanks for the report,
Tassilo
-- 
Richard Stallman wrote a program that divides by zero.





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

* Re: Viewing PDFs as text?
  2008-03-13 18:32                   ` Tassilo Horn
@ 2008-03-13 18:45                     ` Bastien Guerry
  0 siblings, 0 replies; 44+ messages in thread
From: Bastien Guerry @ 2008-03-13 18:45 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:

> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>>>> ,----[ C-h f make-directory RET ]
>>>> | make-directory is an interactive compiled Lisp function in `files.el'.
>>>> | 
>>>> | (make-directory dir &optional parents)
>>>> | 
>>>> | Create the directory dir and any nonexistent parent dirs.
>>>> | If dir already exists as a directory, do nothing.
>>>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>> `----
>>>
>>> Ok, so for me `make-directory' throws an error where it should
>>> silently do nothing.  Strange.  I'm using Emacs 23.0.60.2 -- don't
>>> you have this error?
>>
>> Hm, when I tried the code yesterday I didn't get that error.  Now I
>> updated my emacs and I can reproduce the problem.  I'll report a bug
>> for that.
>
> Ok, I did that and the function works correctly, but the docstring was
> wrong.  I fixed doc-view.el accordingly.

Thanks!

-- 
Bastien




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

* Re: Viewing PDFs as text?
  2008-03-12 15:38           ` Viewing PDFs as text? Roland Winkler
@ 2008-03-18 22:47             ` Roland Winkler
  2008-03-19 10:09               ` Tassilo Horn
  0 siblings, 1 reply; 44+ messages in thread
From: Roland Winkler @ 2008-03-18 22:47 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:
> In emacs from the current CVS I've added a new binding C-c C-t in
> doc-view-mode which opens the text of the current doc in a new buffer.
> When on a tty a message mentions that.

Hi,

would it make sense to have a variable like
`doc-view-default-action' so that I can open a pdf file in a tty and
get immediately the text buffer?

Thanks,

Roland


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

* Re: Viewing PDFs as text?
  2008-03-18 22:47             ` Roland Winkler
@ 2008-03-19 10:09               ` Tassilo Horn
  2008-03-19 14:48                 ` Roland Winkler
  2009-01-26  0:05                 ` Roland Winkler
  0 siblings, 2 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-19 10:09 UTC (permalink / raw)
  To: Roland Winkler; +Cc: help-gnu-emacs

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

Hi Roland,

> would it make sense to have a variable like `doc-view-default-action'
> so that I can open a pdf file in a tty and get immediately the text
> buffer?

That could be done, but I don't think it would be a good idea, because
it opens a new buffer that has nothing to do with doc-view and that
could confuse users.  And IMO C-x C-f /path/to/file RET C-c C-t isn't
too hard to type.

BTW, if you only use emacs in a terminal and don't use doc-view at all,
there's a package named txutils [1] that will fit your needs better.

Bye,
Tassilo
__________
[1] http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg01129.html




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

* Re: Viewing PDFs as text?
  2008-03-19 10:09               ` Tassilo Horn
@ 2008-03-19 14:48                 ` Roland Winkler
  2008-03-19 21:08                   ` Tassilo Horn
       [not found]                   ` <mailman.9221.1205960921.18990.help-gnu-emacs@gnu.org>
  2009-01-26  0:05                 ` Roland Winkler
  1 sibling, 2 replies; 44+ messages in thread
From: Roland Winkler @ 2008-03-19 14:48 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

On Wed Mar 19 2008 Tassilo Horn wrote:
> That could be done, but I don't think it would be a good idea,
> because it opens a new buffer that has nothing to do with doc-view
> and that could confuse users. 

Well, many emacs options can potentially confuse users, and I do not
request that creating the text buffer is made the default. Yet emacs
has a lot to do with customization and achieving a goal in the most
efficient way.

> BTW, if you only use emacs in a terminal and don't use doc-view at
> all, there's a package named txutils [1] that will fit your needs
> better.

Thanks, I'll look into txutils.

However, I spend about half of my time with emacs in a tty and the
other half of my time it is running under X. Many emacs packages
need to behave differently in these different environments. Yet the
advantage is generally that I can use one package in both
environments, and this one package comes with one set of commands,
keybindings, customizations, etc.

Roland




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

* Re: Viewing PDFs as text?
  2008-03-19 14:48                 ` Roland Winkler
@ 2008-03-19 21:08                   ` Tassilo Horn
       [not found]                   ` <mailman.9221.1205960921.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-19 21:08 UTC (permalink / raw)
  To: help-gnu-emacs

"Roland Winkler" <Roland.Winkler@physik.uni-erlangen.de> writes:

> On Wed Mar 19 2008 Tassilo Horn wrote:
>> That could be done, but I don't think it would be a good idea,
>> because it opens a new buffer that has nothing to do with doc-view
>> and that could confuse users.
>
> Well, many emacs options can potentially confuse users, and I do not
> request that creating the text buffer is made the default. Yet emacs
> has a lot to do with customization

But an option to tell doc-view not to use doc-view?

> and achieving a goal in the most efficient way.

I think you could use txutils and put something like

(unless window-system
  (require 'txutils))

into your ~/.emacs.  Then it will use doc-view if you use X11 or txutils
on a tty.

> However, I spend about half of my time with emacs in a tty and the
> other half of my time it is running under X. Many emacs packages need
> to behave differently in these different environments. Yet the
> advantage is generally that I can use one package in both
> environments, and this one package comes with one set of commands,
> keybindings, customizations, etc.

Sure, but the "let doc-view open the text in a new buffer" shares
nothing with doc-view.  No functionality, no keymaps, no mode, no
buffer, really nothing.

Bye,
Tassilo
-- 
When Richard Stallman goes to the loo, he core dumps.





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

* Re: Viewing PDFs as text?
       [not found]                   ` <mailman.9221.1205960921.18990.help-gnu-emacs@gnu.org>
@ 2008-03-19 23:54                     ` Roland Winkler
  2008-03-20 20:25                       ` Tassilo Horn
  0 siblings, 1 reply; 44+ messages in thread
From: Roland Winkler @ 2008-03-19 23:54 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tassilo@member.fsf.org> writes:
> "Roland Winkler" <Roland.Winkler@physik.uni-erlangen.de> writes:
>> Well, many emacs options can potentially confuse users, and I do not
>> request that creating the text buffer is made the default. Yet emacs
>> has a lot to do with customization
>
> But an option to tell doc-view not to use doc-view?

Even if one can see only the plain text in a buffer, the buffer
content is still associated wth the original pdf (or dvi) file.

So as the code matures, I can well imagine that it will be useful if
at least some doc-view functionality can be made available in a tty.
For example, when you add print commands that allow one to print
selected pages (or convert these pages to some other format), that
would be a neat feature even if one can work only with a plain text
buffer to "view" a pdf file.

Roland


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

* Re: Viewing PDFs as text?
  2008-03-11  8:07 ` Tim X
@ 2008-03-20  6:19   ` Alan
  2008-03-20  8:50     ` Tim X
  0 siblings, 1 reply; 44+ messages in thread
From: Alan @ 2008-03-20  6:19 UTC (permalink / raw)
  To: help-gnu-emacs

On Mar 11, 6:07 pm, Tim X <t...@nospam.dev.null> wrote:
> Alan <lngn...@gmail.com> writes:
> > Less (via lesspipe, I think) is able to read pdf files as text, using
> > pdftotext.  It would be much easier for me to browse pdfs using
> > emacs.
>
>
> doc-view will do what you want. However, if you just want a text version
> of the file, you may find the following useful. this is my txutils.el
> package. It converts various file types (doc, pdf, ps etc) to text or
> sometimes html and then displays the output in an emacs buffer. I use
> advice to attach this to view-file (v in dired). As an added benefit, if
> you do a view file on an html file, it will render in w3m.
>
> Note that this works perfectly for me. Your milage may differ and you
> may find bugs. I'm certanly happy to recieve bug reports, but cannot
> guarantee a timely update/fix.

I am using a snapshot of CVS emacs (23.0.60).  I had to edit
txutils.el to remove the "static-when" clause, but I'm not sure why.
The file did byte-compile after I did so.  However, view-file ("v")
does not seem to be re-defined in any way.

I think this package can do what I want.  I DO NOT want to convert to
png or other formats, or even to a text file.  I only want to view the
file, which would seem to me, after all, to be the intention of the
"view-file" command.

Thank you very much.

Alan


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

* Re: Viewing PDFs as text?
  2008-03-20  6:19   ` Alan
@ 2008-03-20  8:50     ` Tim X
  0 siblings, 0 replies; 44+ messages in thread
From: Tim X @ 2008-03-20  8:50 UTC (permalink / raw)
  To: help-gnu-emacs

Alan <lngndvs@gmail.com> writes:

> On Mar 11, 6:07 pm, Tim X <t...@nospam.dev.null> wrote:
>> Alan <lngn...@gmail.com> writes:
>> > Less (via lesspipe, I think) is able to read pdf files as text, using
>> > pdftotext.  It would be much easier for me to browse pdfs using
>> > emacs.
>>
>>
>> doc-view will do what you want. However, if you just want a text version
>> of the file, you may find the following useful. this is my txutils.el
>> package. It converts various file types (doc, pdf, ps etc) to text or
>> sometimes html and then displays the output in an emacs buffer. I use
>> advice to attach this to view-file (v in dired). As an added benefit, if
>> you do a view file on an html file, it will render in w3m.
>>
>> Note that this works perfectly for me. Your milage may differ and you
>> may find bugs. I'm certanly happy to recieve bug reports, but cannot
>> guarantee a timely update/fix.
>
> I am using a snapshot of CVS emacs (23.0.60).  I had to edit
> txutils.el to remove the "static-when" clause, but I'm not sure why.
> The file did byte-compile after I did so.  However, view-file ("v")
> does not seem to be re-defined in any way.
>
> I think this package can do what I want.  I DO NOT want to convert to
> png or other formats, or even to a text file.  I only want to view the
> file, which would seem to me, after all, to be the intention of the
> "view-file" command.
>
> Thank you very much.
>
> Alan

Hi Allen,

The bit that deals with emacs 21 can probably be removed now - it was
requird when there was more emacs 21 aound, but now that emacs 22 has
been released, I proably should remove it.

Apart from that, it works perfectly for me. I'll have to check the
view-file advice - maybe I have it in a different file. After a bit of
time, I tend to forget and get confused about some of this stuff.

Tim

-- 
tcross (at) rapttech dot com dot au


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

* Re: Viewing PDFs as text?
  2008-03-19 23:54                     ` Roland Winkler
@ 2008-03-20 20:25                       ` Tassilo Horn
  0 siblings, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2008-03-20 20:25 UTC (permalink / raw)
  To: help-gnu-emacs

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> So as the code matures, I can well imagine that it will be useful if
> at least some doc-view functionality can be made available in a tty.

Basically it doesn't matter too much if you put the png image or just
some text into the page overlay in doc-view.  That would need some work,
but it should be doable.  Currently my time is quite limited, so I won't
implement it in the nearer future.  Maybe some other dev wants to
volunteer.

You might want to write an enhancement request using M-x
report-emacs-bug, so that it won't be forgotten.

Bye,
Tassilo
-- 
There is no  software development process, only a  bunch of programs RMS
allows to exist.





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

* Emacs 23: strange character display
  2008-03-13 11:49               ` Emacs 23 and msb.el Guy Durrieu
@ 2008-11-06  6:36                 ` Guy Durrieu
  2008-11-06  7:48                   ` Paul R
  0 siblings, 1 reply; 44+ messages in thread
From: Guy Durrieu @ 2008-11-06  6:36 UTC (permalink / raw)
  To: help-gnu-emacs


Hello,

Under Emacs 23, when I type a character with an accent (e.g. "é", or
"è") on my french keyboard, the character is not immediatly displayed:
it only appears at screen on occurrence of the next event (e. g. next
character entered). This was not the behaviour of the previous Emacs
versions. Would somebody explain me this difference and maybe how to
change this behaviour of Emacs 23?

Thanks in advance for your help!

Regards.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Guy DURRIEU                  e-mail Guy.Durrieu@cert.fr
ONERA /DTIM
CEntRe de Toulouse, 2, avenue Edouard Belin  B.P. 74025
31055 TOULOUSE CEDEX 4 FRANCE
tel    (33) 05.62.25.26.59   fax    (33) 05.62.25.25.93
avertissement http://www.onera.fr/onera-en/emails-terms
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=







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

* Re: Emacs 23: strange character display
  2008-11-06  6:36                 ` Emacs 23: strange character display Guy Durrieu
@ 2008-11-06  7:48                   ` Paul R
  2008-11-06 13:12                     ` Guy Durrieu
  0 siblings, 1 reply; 44+ messages in thread
From: Paul R @ 2008-11-06  7:48 UTC (permalink / raw)
  To: Guy Durrieu; +Cc: help-gnu-emacs

On Thu, 06 Nov 2008 07:36:32 +0100, Guy Durrieu <Guy.Durrieu@cert.fr> said:
Guy> This was not the behaviour of the previous Emacs versions. Would
Guy> somebody explain me this difference and maybe how to change this
Guy> behaviour of Emacs 23?

You must give more details because emacs is at the end of the fairly
long chaining that eventually leads to inputing character in a buffer :)

So do you use latest emacs cvs ?
What is the hosting operating system ?
Are you running under X, in a terminal emulator, or under ttys ?


-- 
  Paul




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

* Re: Emacs 23: strange character display
  2008-11-06  7:48                   ` Paul R
@ 2008-11-06 13:12                     ` Guy Durrieu
  0 siblings, 0 replies; 44+ messages in thread
From: Guy Durrieu @ 2008-11-06 13:12 UTC (permalink / raw)
  To: Paul R; +Cc: help-gnu-emacs

Paul R a écrit :
> On Thu, 06 Nov 2008 07:36:32 +0100, Guy Durrieu <Guy.Durrieu@cert.fr> said:
> Guy> This was not the behaviour of the previous Emacs versions. Would
> Guy> somebody explain me this difference and maybe how to change this
> Guy> behaviour of Emacs 23?
> 
> You must give more details because emacs is at the end of the fairly
> long chaining that eventually leads to inputing character in a buffer :)
> 
> So do you use latest emacs cvs ?
> What is the hosting operating system ?
> Are you running under X, in a terminal emulator, or under ttys ?
> 
> 

Thanks for your answer.

As suggested by Peter Dyballa, I tried emacs -Q (the first thing I had
to try!) and the problem disappears, which seems to indicate that
something in my previous environment is more or less incompatible with
emacs 23.

Regards.

-- GD.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Guy DURRIEU                  e-mail Guy.Durrieu@cert.fr
ONERA /DTIM
CEntRe de Toulouse, 2, avenue Edouard Belin  B.P. 74025
31055 TOULOUSE CEDEX 4 FRANCE
tel    (33) 05.62.25.26.59   fax    (33) 05.62.25.25.93
avertissement http://www.onera.fr/onera-en/emails-terms
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=







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

* Re: Viewing PDFs as text?
  2008-03-19 10:09               ` Tassilo Horn
  2008-03-19 14:48                 ` Roland Winkler
@ 2009-01-26  0:05                 ` Roland Winkler
       [not found]                   ` <87eiyqpjg1.fsf@thinkpad.tsdh.de>
  1 sibling, 1 reply; 44+ messages in thread
From: Roland Winkler @ 2009-01-26  0:05 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

On Wed Mar 19 2008 Tassilo Horn wrote:
> > would it make sense to have a variable like `doc-view-default-action'
> > so that I can open a pdf file in a tty and get immediately the text
> > buffer?
> 
> That could be done, but I don't think it would be a good idea, because
> it opens a new buffer that has nothing to do with doc-view and that
> could confuse users.  And IMO C-x C-f /path/to/file RET C-c C-t isn't
> too hard to type.
> 
> BTW, if you only use emacs in a terminal and don't use doc-view at all,
> there's a package named txutils [1] that will fit your needs better.

I just ran into this old email.

emacs-w3m now uses doc-view as its default viewer for pdf file.
Certainly this makes sense. It would appear useful to me if for such
an environment doc-view provided a unified and consistent interface
for viewing pdf files both for emacs running under X and emacs
running in a tty.

Roland




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

* Re: Viewing PDFs as text?
       [not found]                   ` <87eiyqpjg1.fsf@thinkpad.tsdh.de>
@ 2009-01-26 19:14                     ` Samuel Wales
  2009-01-26 19:48                       ` Tassilo Horn
  0 siblings, 1 reply; 44+ messages in thread
From: Samuel Wales @ 2009-01-26 19:14 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs, Roland Winkler

I missed the first part of the thread and also don't seem to have
doc-view, as I am on a mac and do not have emacs 23, but this is
fantastic functionality.

Even in X, and whether links are opened from w3m or from ido or from a
link in org-mode, I will normally want pdf to open in emacs as text,
with a command available to run an external viewer.  Preferably the
external viewer can be chosen at the time of following the original
link OR as a separate command after you have already run the emacs
version.

Again, I am out of the loop, but wouldn't the normal way to be to have
a variable that allows something like  'emacs-only, 'external-only,
'when-gui as options?

Apologies for noise if this is irrelevant.

> I think most of the time nobody wants to view a pdf/ps/dvi as plain
> text.  So my general advice would be: Use doc-view in X11 frames, but do

Except for the silent users who need plain text for accessibility reasons!

-- 
For personal and corporate gain, myalgic encephalomyelitis denialists
are knowingly causing massive suffering and 25-years-early death by
grossly corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




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

* Re: Viewing PDFs as text?
  2009-01-26 19:14                     ` Samuel Wales
@ 2009-01-26 19:48                       ` Tassilo Horn
  2009-01-26 19:52                         ` Samuel Wales
  2009-01-26 22:28                         ` Drew Adams
  0 siblings, 2 replies; 44+ messages in thread
From: Tassilo Horn @ 2009-01-26 19:48 UTC (permalink / raw)
  To: Samuel Wales; +Cc: help-gnu-emacs, Roland Winkler

Samuel Wales <samologist@gmail.com> writes:

Hi Samuel,

> I missed the first part of the thread and also don't seem to have
> doc-view, as I am on a mac and do not have emacs 23, but this is
> fantastic functionality.

Thanks, I hope emacs 23 is coming soon that you can enjoy this new
feature.

> Again, I am out of the loop, but wouldn't the normal way to be to have
> a variable that allows something like 'emacs-only, 'external-only,
> 'when-gui as options?

Maybe.  But emacs currently does the same with pdf/ps/dvi files it does
with image files.  If it can display them (x11 frame) then it does, else
it opens it in an editing mode.  So at least it's consistent.

>> I think most of the time nobody wants to view a pdf/ps/dvi as plain
>> text.  So my general advice would be: Use doc-view in X11 frames, but
>> do
>
> Except for the silent users who need plain text for accessibility
> reasons!

Sure!  But I guess you don't feel discriminated cause you need to type
`C-c C-t' once to get the pure text contents, right? ;-)

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2009-01-26 19:48                       ` Tassilo Horn
@ 2009-01-26 19:52                         ` Samuel Wales
  2009-01-26 20:37                           ` Tassilo Horn
  2009-01-26 22:28                         ` Drew Adams
  1 sibling, 1 reply; 44+ messages in thread
From: Samuel Wales @ 2009-01-26 19:52 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs, Roland Winkler

> `C-c C-t' once to get the pure text contents, right? ;-)

Please explain?   This works for the 3 use cases of w3m, ido, and org
invocations?

Thanks.

-- 
For personal and corporate gain, myalgic encephalomyelitis denialists
are knowingly causing massive suffering and 25-years-early death by
grossly corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




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

* Re: Viewing PDFs as text?
  2009-01-26 19:52                         ` Samuel Wales
@ 2009-01-26 20:37                           ` Tassilo Horn
  2009-01-26 20:47                             ` Samuel Wales
  2009-01-26 22:28                             ` Roland Winkler
  0 siblings, 2 replies; 44+ messages in thread
From: Tassilo Horn @ 2009-01-26 20:37 UTC (permalink / raw)
  To: Samuel Wales; +Cc: help-gnu-emacs, Roland Winkler

Samuel Wales <samologist@gmail.com> writes:

>> `C-c C-t' once to get the pure text contents, right? ;-)
>
> Please explain?  This works for the 3 use cases of w3m, ido, and org
> invocations?

No, no.  Only for pdf/ps/dvi files with emacs 23.  There you can do

  C-x C-f /path/to/file RET

which openes the file with doc-view, and `C-c C-t' will open a buffer
with the plain text contents then.

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2009-01-26 20:37                           ` Tassilo Horn
@ 2009-01-26 20:47                             ` Samuel Wales
  2009-01-27  9:11                               ` Tassilo Horn
  2009-01-26 22:28                             ` Roland Winkler
  1 sibling, 1 reply; 44+ messages in thread
From: Samuel Wales @ 2009-01-26 20:47 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs, Roland Winkler

Thanks for explanation.  I presume that would work for urls also.  I
will wait for Emacs 23.

-- 
For personal and corporate gain, myalgic encephalomyelitis denialists
are knowingly causing massive suffering and 25-years-early death by
grossly corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




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

* Re: Viewing PDFs as text?
  2009-01-26 20:37                           ` Tassilo Horn
  2009-01-26 20:47                             ` Samuel Wales
@ 2009-01-26 22:28                             ` Roland Winkler
  2009-01-27  9:33                               ` Tassilo Horn
  1 sibling, 1 reply; 44+ messages in thread
From: Roland Winkler @ 2009-01-26 22:28 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

On Mon Jan 26 2009 Tassilo Horn wrote:
> Samuel Wales <samologist@gmail.com> writes:
> 
> >> `C-c C-t' once to get the pure text contents, right? ;-)
> >
> > Please explain?  This works for the 3 use cases of w3m, ido, and org
> > invocations?
> 
> No, no.  Only for pdf/ps/dvi files with emacs 23.  There you can do
> 
>   C-x C-f /path/to/file RET
> 
> which openes the file with doc-view, and `C-c C-t' will open a buffer
> with the plain text contents then.

Somehow I am missing the point. How is this supposed to work from
within something like emacs-w3m when I have only a tty?
Currently, to the best of my knowledge, emacs-w3m doesn't know what
to do with pdf files when emacs 23 is running in a tty. I still
don't see why doc-view should not handle this, even if it gives only
a minimalistic set of features. Of course, one could incorporate
such a feature also into emacs-w3m itself. But that appears to be
the wrong place to me. (The next package dealing with pdf files
similar to emacs-w3m would have to reinvent the wheel.)

Roland




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

* RE: Viewing PDFs as text?
  2009-01-26 19:48                       ` Tassilo Horn
  2009-01-26 19:52                         ` Samuel Wales
@ 2009-01-26 22:28                         ` Drew Adams
  2009-01-27  9:10                           ` Tassilo Horn
  1 sibling, 1 reply; 44+ messages in thread
From: Drew Adams @ 2009-01-26 22:28 UTC (permalink / raw)
  To: 'Tassilo Horn', 'Samuel Wales'
  Cc: help-gnu-emacs, 'Roland Winkler'


> you need to type `C-c C-t' once to get the pure text contents

Peripheral to this discussion, but please see bug #2058.

Visiting a new, empty file buffer `foo.pdf' should not raise errors or attempt
to deal with the (as yet empty) buffer as PDF data. Emacs should act similarly
to what it does if you visit a new, empty file `foo.html'. It's OK to assume a
PDF/Doc View mode for the buffer, but an empty buffer for a not-yet-existant
file should not raise an error.

And the intro message about `C-c C-t' (which is what made me think of posting
this) is far too long (~3 lines).





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

* Re: Viewing PDFs as text?
  2009-01-26 22:28                         ` Drew Adams
@ 2009-01-27  9:10                           ` Tassilo Horn
  0 siblings, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2009-01-27  9:10 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs, 'Roland Winkler'

"Drew Adams" <drew.adams@oracle.com> writes:

Hi Drew,

>> you need to type `C-c C-t' once to get the pure text contents
>
> Peripheral to this discussion, but please see bug #2058.

I'll answer there.

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2009-01-26 20:47                             ` Samuel Wales
@ 2009-01-27  9:11                               ` Tassilo Horn
  0 siblings, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2009-01-27  9:11 UTC (permalink / raw)
  To: Samuel Wales; +Cc: help-gnu-emacs, Roland Winkler

Samuel Wales <samologist@gmail.com> writes:

> Thanks for explanation.  I presume that would work for urls also.

For urls and files in archives and urls pointing to files in remote
archives. ;-)

Bye,
Tassilo




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

* Re: Viewing PDFs as text?
  2009-01-26 22:28                             ` Roland Winkler
@ 2009-01-27  9:33                               ` Tassilo Horn
  0 siblings, 0 replies; 44+ messages in thread
From: Tassilo Horn @ 2009-01-27  9:33 UTC (permalink / raw)
  To: Roland Winkler; +Cc: help-gnu-emacs

"Roland Winkler" <Roland.Winkler@physik.uni-erlangen.de> writes:

> On Mon Jan 26 2009 Tassilo Horn wrote:
>> Samuel Wales <samologist@gmail.com> writes:
>> 
>> >> `C-c C-t' once to get the pure text contents, right? ;-)
>> >
>> > Please explain?  This works for the 3 use cases of w3m, ido, and org
>> > invocations?
>> 
>> No, no.  Only for pdf/ps/dvi files with emacs 23.  There you can do
>> 
>>   C-x C-f /path/to/file RET
>> 
>> which openes the file with doc-view, and `C-c C-t' will open a buffer
>> with the plain text contents then.
>
> Somehow I am missing the point. How is this supposed to work from
> within something like emacs-w3m when I have only a tty?

Emacs-w3m issues

  (find-file "file-or-url")

and if it is a PDF/DVI/PS, it'll be opened with doc-view.  If you are on
a tty then you cannot see the image but the pdf contents, which is not
really useful.  But with C-c C-t you'll get a new buffer with just the
plain text contents.

> Currently, to the best of my knowledge, emacs-w3m doesn't know what to
> do with pdf files when emacs 23 is running in a tty.  I still don't
> see why doc-view should not handle this, even if it gives only a
> minimalistic set of features. Of course, one could incorporate such a
> feature also into emacs-w3m itself. But that appears to be the wrong
> place to me. (The next package dealing with pdf files similar to
> emacs-w3m would have to reinvent the wheel.)

The right thing to to would be to modify `auto-mode-alist' and
`find-file' to allow the former to contain predicates, like:

  (if window-system
      'doc-view-mode
    'externally)

where externally would mean use the systems default external
application.

Then this behavior is centralized and not each mode which needs some
feature has to handle it itself.

Bye,
Tassilo




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

end of thread, other threads:[~2009-01-27  9:33 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 20:52 Viewing PDFs as text? Alan
2008-03-10 22:59 ` Peter Dyballa
     [not found] ` <mailman.8684.1205189951.18990.help-gnu-emacs@gnu.org>
2008-03-11  3:42   ` Roland Winkler
2008-03-11  7:45     ` Tassilo Horn
     [not found]     ` <mailman.8699.1205221811.18990.help-gnu-emacs@gnu.org>
2008-03-11 13:11       ` Roland Winkler
2008-03-11 17:57         ` Bastien
2008-03-11 20:51           ` Stefan Monnier
2008-03-12  8:32           ` Tassilo Horn
2008-03-12  9:54             ` Phil Jackson
2008-03-12 12:12               ` Tassilo Horn
2008-03-12 12:11             ` Tassilo Horn
2008-03-12 13:45         ` Tassilo Horn
2008-03-13  3:37           ` Bastien
2008-03-13  9:29             ` Tassilo Horn
2008-03-13 10:09               ` Bastien
2008-03-13 10:30                 ` Tassilo Horn
2008-03-13 18:32                   ` Tassilo Horn
2008-03-13 18:45                     ` Bastien Guerry
2008-03-13 11:49               ` Emacs 23 and msb.el Guy Durrieu
2008-11-06  6:36                 ` Emacs 23: strange character display Guy Durrieu
2008-11-06  7:48                   ` Paul R
2008-11-06 13:12                     ` Guy Durrieu
     [not found]         ` <mailman.8756.1205329519.18990.help-gnu-emacs@gnu.org>
2008-03-12 15:38           ` Viewing PDFs as text? Roland Winkler
2008-03-18 22:47             ` Roland Winkler
2008-03-19 10:09               ` Tassilo Horn
2008-03-19 14:48                 ` Roland Winkler
2008-03-19 21:08                   ` Tassilo Horn
     [not found]                   ` <mailman.9221.1205960921.18990.help-gnu-emacs@gnu.org>
2008-03-19 23:54                     ` Roland Winkler
2008-03-20 20:25                       ` Tassilo Horn
2009-01-26  0:05                 ` Roland Winkler
     [not found]                   ` <87eiyqpjg1.fsf@thinkpad.tsdh.de>
2009-01-26 19:14                     ` Samuel Wales
2009-01-26 19:48                       ` Tassilo Horn
2009-01-26 19:52                         ` Samuel Wales
2009-01-26 20:37                           ` Tassilo Horn
2009-01-26 20:47                             ` Samuel Wales
2009-01-27  9:11                               ` Tassilo Horn
2009-01-26 22:28                             ` Roland Winkler
2009-01-27  9:33                               ` Tassilo Horn
2009-01-26 22:28                         ` Drew Adams
2009-01-27  9:10                           ` Tassilo Horn
2008-03-11  7:43 ` Tassilo Horn
2008-03-11  8:07 ` Tim X
2008-03-20  6:19   ` Alan
2008-03-20  8:50     ` Tim X

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.