From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#17985: 24.3.92; doc-view-open-text raises wrong-type-argument error Date: Thu, 10 Jul 2014 14:26:18 +0200 Message-ID: <87r41twgb9.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1404995309 30510 80.91.229.3 (10 Jul 2014 12:28:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Jul 2014 12:28:29 +0000 (UTC) To: 17985@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 10 14:28:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X5DSY-0003YX-SB for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jul 2014 14:28:23 +0200 Original-Received: from localhost ([::1]:37735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5DSY-0002RW-4l for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Jul 2014 08:28:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5DSL-0002ON-It for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:28:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5DSE-0004nZ-83 for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:28:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5DSE-0004nU-5N for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X5DSD-0000a9-Rm for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Jul 2014 12:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17985 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14049952232133 (code B ref -1); Thu, 10 Jul 2014 12:28:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Jul 2014 12:27:03 +0000 Original-Received: from localhost ([127.0.0.1]:51782 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X5DRD-0000Xr-8s for submit@debbugs.gnu.org; Thu, 10 Jul 2014 08:27:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56571) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X5DR7-0000XX-1G for submit@debbugs.gnu.org; Thu, 10 Jul 2014 08:26:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5DQu-0004GS-AK for submit@debbugs.gnu.org; Thu, 10 Jul 2014 08:26:47 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5DQu-0004GO-6v for submit@debbugs.gnu.org; Thu, 10 Jul 2014 08:26:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5DQn-00023v-4v for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:26:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5DQg-0004EX-5J for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:26:33 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:63505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5DQf-0004EK-QL for bug-gnu-emacs@gnu.org; Thu, 10 Jul 2014 08:26:26 -0400 Original-Received: from rosalinde.fritz.box ([89.245.109.192]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MLunc-1WxXOL27Ce-007iAC for ; Thu, 10 Jul 2014 14:26:21 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux) X-Provags-ID: V03:K0:SgLyFCHjLndljNMd0aNvW0TDIBZHpQoWvJWzr5ie1A++Y3Ex4CV YPWLaS/1uRhxmbvDUjiTz0qh4AtnXfMyrnZn/f6PtlxzDgBPzuJMPebUQNSiDk7ZXPs8ZGq NHxFHANAAkQlDEm38iOfSN+uNGF26aA1LXOR84M9s35WiuimCq1KO9xLRsS+bhPqDzcMulG 64lNK3+KcClXQ5cb+HYlg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91374 Archived-At: If I'm using Gnus to read mail with an attachment, I can type `c' on the attachment to view it in another buffer, and if the attachment is something that Doc View can handle, I can type `C-c C-c' in the buffer to view the rendered image of the attachment. But if I then type `C-c C-t' (doc-view-open-text) to view the ascii text of the attachment, I get this error: Debugger entered--Lisp error: (wrong-type-argument stringp nil) file-name-nondirectory(nil) doc-view-open-text() call-interactively(doc-view-open-text nil nil) command-execute(doc-view-open-text) The reason is that Doc View expects the buffer to be visiting a file. But with an mail attachment, that does not have to be the case (when I type `C-c C-c', Doc View says: "The buffer has been modified. Save the changes? (y or n)", but if I answer "n", it still renders the image). The following patch lets me view the ascii text whether or not the buffer containing the document is visiting a file. (The patch is against emacs-24; the error also happens in trunk.) Steve Berman In GNU Emacs 24.3.92.7 (x86_64-suse-linux-gnu, GTK+ Version 3.10.4) of 2014-07-10 on rosalinde Repository revision: 117368 monnier@iro.umontreal.ca-20140709185406-m0q0fjepl42pcrqx Windowing system distributor `The X.Org Foundation', version 11.0.11403901 System Description: openSUSE 13.1 (Bottle) (x86_64) Configured using: `configure --without-toolkit-scroll-bars CFLAGS=-g3' Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix === modified file 'lisp/doc-view.el' *** lisp/doc-view.el 2014-04-04 17:42:55 +0000 --- lisp/doc-view.el 2014-07-10 11:54:18 +0000 *************** *** 1402,1412 **** (interactive) (if doc-view--current-converter-processes (message "DocView: please wait till conversion finished.") ! (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))) (if (file-readable-p txt) (let ((name (concat "Text contents of " ! (file-name-nondirectory buffer-file-name))) ! (dir (file-name-directory buffer-file-name))) (with-current-buffer (find-file txt) (rename-buffer name) (setq default-directory dir))) --- 1402,1413 ---- (interactive) (if doc-view--current-converter-processes (message "DocView: please wait till conversion finished.") ! (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir))) ! (bname (or buffer-file-name (buffer-name)))) (if (file-readable-p txt) (let ((name (concat "Text contents of " ! (file-name-nondirectory bname))) ! (dir (or (file-name-directory bname) default-directory))) (with-current-buffer (find-file txt) (rename-buffer name) (setq default-directory dir)))