all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5102: 23.1; doc-view on a buffer not linked to a file
@ 2009-12-02 12:17 ` harven
  2009-12-04 21:50   ` Juri Linkov
  2009-12-07 19:30   ` bug#5102: marked as done (23.1; doc-view on a buffer not linked to a file) Emacs bug Tracking System
  0 siblings, 2 replies; 10+ messages in thread
From: harven @ 2009-12-02 12:17 UTC (permalink / raw)
  To: bug-gnu-emacs

There is a problem when trying to display postscript code in a ps-mode buffer
if the buffer is not linked to a file.

Starting with emacs -Q,
- open a new buffer, 
- insert in that buffer the content of a postscript file,
- start ps-mode. 
Now if we type C-c C-c to view the postscript, we are prompted whether
we want to save the content of the buffer. If we answer "no", we get the error

Wrong type argument: stringp, nil

Message buffer reports that this was issued by doc-view-mode.

In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: 1
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
M-x r e p o r t - b u f <backspace> g <return>

Recent messages:
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50festival.el (source)...done
Enriched: decoding document...
Indenting...
For information about GNU Emacs and the GNU system, type C-h C-a.






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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-02 12:17 ` bug#5102: 23.1; doc-view on a buffer not linked to a file harven
@ 2009-12-04 21:50   ` Juri Linkov
  2009-12-04 22:43     ` Tassilo Horn
  2009-12-07 19:30   ` bug#5102: marked as done (23.1; doc-view on a buffer not linked to a file) Emacs bug Tracking System
  1 sibling, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2009-12-04 21:50 UTC (permalink / raw)
  To: harven; +Cc: Tassilo Horn, 5102

> There is a problem when trying to display postscript code
> in a ps-mode buffer if the buffer is not linked to a file.
>
> Starting with emacs -Q,
> - open a new buffer,
> - insert in that buffer the content of a postscript file,
> - start ps-mode.
> Now if we type C-c C-c to view the postscript, we are prompted whether
> we want to save the content of the buffer. If we answer "no", we get the error
>
> Wrong type argument: stringp, nil
>
> Message buffer reports that this was issued by doc-view-mode.

With `debug-on-error' enabled it displays:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    file-readable-p(nil)
    doc-view-mode()
    doc-view-toggle-display()
    call-interactively(doc-view-toggle-display nil nil)

Tassilo, please tell whether DocView is designed to work in non-file buffers?

-- 
Juri Linkov
http://www.jurta.org/emacs/





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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-04 21:50   ` Juri Linkov
@ 2009-12-04 22:43     ` Tassilo Horn
  2009-12-04 23:18       ` Drew Adams
  2009-12-05 18:49       ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Tassilo Horn @ 2009-12-04 22:43 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 5102, harven

Juri Linkov <juri@jurta.org> writes:

Hi Juri,

>> There is a problem when trying to display postscript code
>> in a ps-mode buffer if the buffer is not linked to a file.
>>
>> Starting with emacs -Q,
>> - open a new buffer,
>> - insert in that buffer the content of a postscript file,
>> - start ps-mode.
>> Now if we type C-c C-c to view the postscript, we are prompted whether
>> we want to save the content of the buffer. If we answer "no", we get the error
>>
>> Wrong type argument: stringp, nil
>>
>> Message buffer reports that this was issued by doc-view-mode.
>
> With `debug-on-error' enabled it displays:
>
>   Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>     file-readable-p(nil)
>     doc-view-mode()
>     doc-view-toggle-display()
>     call-interactively(doc-view-toggle-display nil nil)
>
> Tassilo, please tell whether DocView is designed to work in non-file
> buffers?

No, it cannot handle non-file buffers, because ghostscript and friends
only handle input files and don't support piping in the output.  So the
best we could do was to autosave to a temp directory.  But that might be
wrong with respect to security issues.  So I think asking the user to
save is the best we can do.  Of course, an explanatory message would be
better than an error.

Bye,
Tassilo





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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-04 22:43     ` Tassilo Horn
@ 2009-12-04 23:18       ` Drew Adams
  2009-12-05 10:12         ` Tassilo Horn
  2009-12-05 18:49       ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Drew Adams @ 2009-12-04 23:18 UTC (permalink / raw)
  To: 'Tassilo Horn', 5102, 'Juri Linkov'; +Cc: 'harven'

> No, it cannot handle non-file buffers, because ghostscript and friends
> only handle input files and don't support piping in the 
> output.

I don't mean to meddle here, and I might be way off base.

But FYI, printing.el uses ghostview (gsview32.exe on Windows), which IIRC comes
with ghostscript (gsprint.exe on Windows), in order to show buffer contents. You
might take a look at that.

Look at, for instance, menu item Printing > PostScript Preview > Buffer > 1-up.
The menus are pretty much identical between PostScript Preview and Printing, and
between viewing/printing a file and viewing/printing a buffer.

HTH.






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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-04 23:18       ` Drew Adams
@ 2009-12-05 10:12         ` Tassilo Horn
  0 siblings, 0 replies; 10+ messages in thread
From: Tassilo Horn @ 2009-12-05 10:12 UTC (permalink / raw)
  To: Drew Adams; +Cc: 5102, 'harven'

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

>> No, it cannot handle non-file buffers, because ghostscript and
>> friends only handle input files and don't support piping in the
>> output.
>
> I don't mean to meddle here, and I might be way off base.
>
> But FYI, printing.el uses ghostview (gsview32.exe on Windows), which
> IIRC comes with ghostscript (gsprint.exe on Windows), in order to show
> buffer contents. You might take a look at that.

At a first glance, it looks to me that it also saves the buffer contents
to some temporary file.

Bye,
Tassilo





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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-04 22:43     ` Tassilo Horn
  2009-12-04 23:18       ` Drew Adams
@ 2009-12-05 18:49       ` Stefan Monnier
  2009-12-05 23:23         ` Juri Linkov
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2009-12-05 18:49 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 5102, harven

>> Tassilo, please tell whether DocView is designed to work in non-file
>> buffers?

Yes, it is.

> No, it cannot handle non-file buffers, because ghostscript and friends
> only handle input files and don't support piping in the output.  So the

It already has special code for Tramp and jka-compr files, where it
saves the buffer's content to a temp file.

Harven(?), does the patch below help?


        Stefan


--- doc-view.el.~1.93.~	2009-11-30 22:13:35.000000000 -0500
+++ doc-view.el	2009-12-05 13:48:54.000000000 -0500
@@ -1237,7 +1237,7 @@
 	  ;; supposed to return nil for things like local files accessed via
 	  ;; `su' or via file://...
 	  ((let ((file-name-handler-alist nil))
-	     (not (file-readable-p buffer-file-name)))
+	     (not (and buffer-file-name (file-readable-p buffer-file-name))))
 	   (expand-file-name
 	    (file-name-nondirectory buffer-file-name)
 	    doc-view-cache-directory))





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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-05 18:49       ` Stefan Monnier
@ 2009-12-05 23:23         ` Juri Linkov
  2009-12-07  2:38           ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2009-12-05 23:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Tassilo Horn, 5102, harven

>>> Tassilo, please tell whether DocView is designed to work in non-file
>>> buffers?
>
> Yes, it is.
>
>> No, it cannot handle non-file buffers, because ghostscript and friends
>> only handle input files and don't support piping in the output.  So the
>
> It already has special code for Tramp and jka-compr files, where it
> saves the buffer's content to a temp file.
>
> Harven(?), does the patch below help?

Mails to Harven bounce back with the error:

  <harven@free.fr>: host mx1.free.fr said: 550 5.2.1 This mailbox
    has been blocked due to inactivity (in reply to RCPT TO command)

So I tried out your patch and it fails with:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    file-name-nondirectory(nil)
    doc-view-mode()
    doc-view-toggle-display()
    call-interactively(doc-view-toggle-display nil nil)

I don't understand how do you expect it to work.

-- 
Juri Linkov
http://www.jurta.org/emacs/





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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-05 23:23         ` Juri Linkov
@ 2009-12-07  2:38           ` Stefan Monnier
  2009-12-07 17:51             ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2009-12-07  2:38 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Tassilo Horn, 5102, harven

>>> No, it cannot handle non-file buffers, because ghostscript and friends
>>> only handle input files and don't support piping in the output.  So the
>> It already has special code for Tramp and jka-compr files, where it
>> saves the buffer's content to a temp file.
>> Harven(?), does the patch below help?
> Mails to Harven bounce back with the error:
>   <harven@free.fr>: host mx1.free.fr said: 550 5.2.1 This mailbox
>     has been blocked due to inactivity (in reply to RCPT TO command)
> So I tried out your patch and it fails with:
>   Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>     file-name-nondirectory(nil)
>     doc-view-mode()
>     doc-view-toggle-display()
>     call-interactively(doc-view-toggle-display nil nil)
> I don't understand how do you expect it to work.

Witha bit more help.  I've installed the patch below which seems to work
for me,


        Stefan


--- doc-view.el.~1.93.~	2009-11-30 22:13:35.000000000 -0500
+++ doc-view.el	2009-12-06 21:35:39.000000000 -0500
@@ -563,7 +563,7 @@
     (setq doc-view-current-cache-dir
 	  (file-name-as-directory
 	   (expand-file-name
-	    (concat (file-name-nondirectory buffer-file-name)
+	    (concat (file-name-nondirectory doc-view-buffer-file-name)
 		    "-"
 		    (let ((file doc-view-buffer-file-name))
 		      (with-temp-buffer
@@ -1228,6 +1228,7 @@
     (set (make-local-variable 'doc-view-buffer-file-name)
 	 (cond
 	  (jka-compr-really-do-compress
+           ;; FIXME: there's a risk of name conflicts here.
 	   (expand-file-name
 	    (file-name-nondirectory
 	     (file-name-sans-extension buffer-file-name))
@@ -1237,9 +1238,12 @@
 	  ;; supposed to return nil for things like local files accessed via
 	  ;; `su' or via file://...
 	  ((let ((file-name-handler-alist nil))
-	     (not (file-readable-p buffer-file-name)))
+	     (not (and buffer-file-name (file-readable-p buffer-file-name))))
+           ;; FIXME: there's a risk of name conflicts here.
 	   (expand-file-name
+	    (if buffer-file-name
 	    (file-name-nondirectory buffer-file-name)
+              (buffer-name))
 	    doc-view-cache-directory))
 	  (t buffer-file-name)))
     (when (not (string= doc-view-buffer-file-name buffer-file-name))





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

* bug#5102: 23.1; doc-view on a buffer not linked to a file
  2009-12-07  2:38           ` Stefan Monnier
@ 2009-12-07 17:51             ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2009-12-07 17:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Tassilo Horn, 5102

>>>> No, it cannot handle non-file buffers, because ghostscript and friends
>>>> only handle input files and don't support piping in the output.  So the
>>> It already has special code for Tramp and jka-compr files, where it
>>> saves the buffer's content to a temp file.
>>> Harven(?), does the patch below help?
>> Mails to Harven bounce back with the error:
>>   <harven@free.fr>: host mx1.free.fr said: 550 5.2.1 This mailbox
>>     has been blocked due to inactivity (in reply to RCPT TO command)
>> So I tried out your patch and it fails with:
>>   Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>>     file-name-nondirectory(nil)
>>     doc-view-mode()
>>     doc-view-toggle-display()
>>     call-interactively(doc-view-toggle-display nil nil)
>> I don't understand how do you expect it to work.
>
> Witha bit more help.  I've installed the patch below which seems to work
> for me,

It works for me too.  I'm not sure if we have to wait Harven's
confirmation to close this bug because his mails unfortunately
bounce back.

-- 
Juri Linkov
http://www.jurta.org/emacs/





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

* bug#5102: marked as done (23.1; doc-view on a buffer not linked to a file)
  2009-12-02 12:17 ` bug#5102: 23.1; doc-view on a buffer not linked to a file harven
  2009-12-04 21:50   ` Juri Linkov
@ 2009-12-07 19:30   ` Emacs bug Tracking System
  1 sibling, 0 replies; 10+ messages in thread
From: Emacs bug Tracking System @ 2009-12-07 19:30 UTC (permalink / raw)
  To: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

Your message dated Mon, 07 Dec 2009 14:24:36 -0500
with message-id <jwv638i610l.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: bug#5102: 23.1; doc-view on a buffer not linked to a file
has caused the Emacs bug report #5102,
regarding 23.1; doc-view on a buffer not linked to a file
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
5102: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=5102
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 5051 bytes --]

From: harven <harven@free.fr>
To: bug-gnu-emacs@gnu.org
Cc: 
Subject: 23.1; doc-view on a buffer not linked to a file
Date: Wed, 02 Dec 2009 13:17:50 +0100
Message-ID: <87ljhlbmdt.fsf@ergodik.univ-brest.fr>

There is a problem when trying to display postscript code in a ps-mode buffer
if the buffer is not linked to a file.

Starting with emacs -Q,
- open a new buffer, 
- insert in that buffer the content of a postscript file,
- start ps-mode. 
Now if we type C-c C-c to view the postscript, we are prompted whether
we want to save the content of the buffer. If we answer "no", we get the error

Wrong type argument: stringp, nil

Message buffer reports that this was issued by doc-view-mode.

In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: 1
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
M-x r e p o r t - b u f <backspace> g <return>

Recent messages:
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50festival.el (source)...done
Enriched: decoding document...
Indenting...
For information about GNU Emacs and the GNU system, type C-h C-a.



[-- Attachment #3: Type: message/rfc822, Size: 2116 bytes --]

From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Juri Linkov <juri@jurta.org>
Cc: Tassilo Horn <tassilo@member.fsf.org>
Subject: Re: bug#5102: 23.1; doc-view on a buffer not linked to a file
Date: Mon, 07 Dec 2009 14:24:36 -0500
Message-ID: <jwv638i610l.fsf-monnier+emacsbugreports@gnu.org>

>> Witha bit more help.  I've installed the patch below which seems to work
>> for me,
> It works for me too.  I'm not sure if we have to wait Harven's
> confirmation to close this bug because his mails unfortunately
> bounce back.

Indeed,


        Stefan

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

end of thread, other threads:[~2009-12-07 19:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <jwv638i610l.fsf-monnier+emacsbugreports@gnu.org>
2009-12-02 12:17 ` bug#5102: 23.1; doc-view on a buffer not linked to a file harven
2009-12-04 21:50   ` Juri Linkov
2009-12-04 22:43     ` Tassilo Horn
2009-12-04 23:18       ` Drew Adams
2009-12-05 10:12         ` Tassilo Horn
2009-12-05 18:49       ` Stefan Monnier
2009-12-05 23:23         ` Juri Linkov
2009-12-07  2:38           ` Stefan Monnier
2009-12-07 17:51             ` Juri Linkov
2009-12-07 19:30   ` bug#5102: marked as done (23.1; doc-view on a buffer not linked to a file) Emacs bug Tracking System

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.