[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#33241: closed (image-mode in non-file buffer)

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#33241: closed (image-mode in non-file buffer)
Date: Mon, 05 Nov 2018 20:59:02 +0000

Your message dated Mon, 05 Nov 2018 22:57:25 +0200
with message-id <address@hidden>
and subject line Re: bug#33241: image-mode in non-file buffer
has caused the debbugs.gnu.org bug report #33241,
regarding image-mode in non-file buffer
to be marked as done.

(If you believe you have received this mail in error, please contact

33241: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33241
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: image-mode in non-file buffer Date: Fri, 2 Nov 2018 14:37:26 +0300
I've got problems with image-mode triggered by scad-preview, but I have tiny code example to trigger it:

     (with-current-buffer (get-buffer-create "mybuf")
       (insert-file-contents "~/pics/nav1.jpg")
       (setq major-mode 'image-mode)

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  (if (image--imagemagick-wanted-p filename) 'imagemagick (image-type file-or-data nil data-p))
  (let* ((filename (buffer-file-name)) (data-p (not (and filename (file-readable-p filename) (not (file-remote-p filename)) (not (buffer-modified-p)) (not (and (boundp ...) archive-superior-buffer)) (not (and (boundp ...) tar-superior-buffer)) (not (and (boundp ...) (local-variable-p ...)))))) (file-or-data (if data-p (let ((str (buffer-substring-no-properties ... ...))) (if enable-multibyte-characters (encode-coding-string str buffer-file-coding-system) str)) filename)) (edges (and (null image-transform-resize) (window-inside-pixel-edges (get-buffer-window (current-buffer))))) (type (if (image--imagemagick-wanted-p filename) 'imagemagick (image-type file-or-data nil data-p))) (image (if (not edges) (create-image file-or-data type data-p) (create-image file-or-data type data-p :max-width (- (nth 2 edges) (nth 0 edges)) :max-height (- (nth 3 edges) (nth 1 edges))))) (inhibit-read-only t) (buffer-undo-list t) (modified (buffer-modified-p)) props) (image-flush image) (setq image (append image (image-transform-properties image))) (setq props (cons 'display (cons image '(rear-nonsticky (display) read-only t front-sticky (read-only))))) (let ((create-lockfiles nil)) (add-text-properties (point-min) (point-max) props) (restore-buffer-modified-p modified)) (setq cursor-type nil) (setq truncate-lines t) (if (coding-system-equal (coding-system-base buffer-file-coding-system) 'no-conversion) (set (make-local-variable 'find-file-literally) t)) (set (make-local-variable 'auto-hscroll-mode) nil) (setq image-type type) (if (eq major-mode 'image-mode) (setq mode-name (format "Image[%s]" type))) (image-transform-check-size) (if (called-interactively-p 'any) (message "Repeat this command to go back to displaying the file as text")))
  (save-current-buffer (set-buffer (get-buffer-create "mybuf")) (insert-file-contents "~/pics/nav1.jpg") (major-mode-suspend) (setq major-mode 'image-mode) (image-toggle-display-image) (current-buffer))
  (pop-to-buffer (save-current-buffer (set-buffer (get-buffer-create "mybuf")) (insert-file-contents "~/pics/nav1.jpg") (major-mode-suspend) (setq major-mode 'image-mode) (image-toggle-display-image) (current-buffer)))
  eval((pop-to-buffer (save-current-buffer (set-buffer (get-buffer-create "mybuf")) (insert-file-contents "~/pics/nav1.jpg") (major-mode-suspend) (setq major-mode 'image-mode) (image-toggle-display-image) (current-buffer))) nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)

This can be fixed by this tiny patch:
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 606c661..49354a6 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -738,7 +738,7 @@ image-toggle-display-image
         (edges (and (null image-transform-resize)
                      (get-buffer-window (current-buffer)))))
-        (type (if (image--imagemagick-wanted-p filename)
+        (type (if (and filename (image--imagemagick-wanted-p filename))
                 (image-type file-or-data nil data-p)))
         (image (if (not edges)


In GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2018-07-14 built on wrt
Repository revision: 155d7303808345dd73427302d9a352ec5461c11a
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Ubuntu 16.04.1 LTS

Recent messages:
Entering debugger...
Back to top level
funcall-interactively: Buffer is read-only: #<buffer image-mode.el.gz> [4 times]
Read-Only mode disabled in current buffer
Saving file /usr/local/share/emacs/27.0.50/lisp/image-mode.el.gz...
#<buffer mybuf>
Mark set
next-line: End of buffer
Configured using:
 'configure --with-xwidgets --with-modules'

Configured features:

Important settings:
  value of $LC_MONETARY: ru_RU.UTF-8
  value of $LC_NUMERIC: ru_RU.UTF-8
  value of $LC_TIME: ru_RU.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  icomplete-mode: t
  save-place-mode: t
  diff-auto-refine-mode: t
  pyvenv-mode: t
  shell-dirtrack-mode: t
  display-time-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  cl-old-struct-compat-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Load-path shadows:
/home/lg/.emacs.d/elpa/flim-20180328.1624/hex-util hides /usr/local/share/emacs/27.0.50/lisp/hex-util
/home/lg/.emacs.d/elpa/flim-20180328.1624/md4 hides /usr/local/share/emacs/27.0.50/lisp/md4
/home/lg/.emacs.d/elpa/flim-20180328.1624/sasl hides /usr/local/share/emacs/27.0.50/lisp/net/sasl
/home/lg/.emacs.d/elpa/flim-20180328.1624/sasl-digest hides /usr/local/share/emacs/27.0.50/lisp/net/sasl-digest
/home/lg/.emacs.d/elpa/flim-20180328.1624/hmac-md5 hides /usr/local/share/emacs/27.0.50/lisp/net/hmac-md5
/home/lg/.emacs.d/elpa/flim-20180328.1624/ntlm hides /usr/local/share/emacs/27.0.50/lisp/net/ntlm
/home/lg/.emacs.d/elpa/flim-20180328.1624/hmac-def hides /usr/local/share/emacs/27.0.50/lisp/net/hmac-def
/home/lg/.emacs.d/elpa/flim-20180328.1624/sasl-ntlm hides /usr/local/share/emacs/27.0.50/lisp/net/sasl-ntlm
/home/lg/.emacs.d/elpa/flim-20180328.1624/sasl-cram hides /usr/local/share/emacs/27.0.50/lisp/net/sasl-cram

(shadow sort mail-extr emacsbug sendmail jka-compr image-mode find-func
dabbrev skeleton cl-print debug misearch multi-isearch vc-git exwm-wconf
winner exwm-misc exwm exwm-match exwm-input xcb-keysyms exwm-manage
exwm-floating xcb-cursor xcb-render exwm-layout exwm-workspace exwm-core
xcb-ewmh xcb-icccm xcb xcb-xproto xcb-types work desktop frameset
gnus-demon nntp gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc gnus-spec gnus-win nnoo gnus-int gnus-range
message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr autoinsert cal-menu calendar cal-loaddefs
icomplete saveplace cython-mode help-fns radix-tree elpy
find-file-in-project ivy delsel ivy-overlay ffap windmove diff-mode
easy-mmode elpy-shell pyvenv elpy-profile elpy-django elpy-refactor
python tramp-sh tramp trampver tramp-compat tramp-loaddefs ucs-normalize
parse-time format-spec grep files-x etags xref project cus-edit
cus-start cus-load wid-edit python-mode info-look which-func imenu shell
pcomplete hippie-exp flymake-proc flymake warnings thingatpt compile
cc-cmds cc-engine cc-vars cc-defs dot-mode server time elec-pair
google-translate google-translate-default-ui google-translate-core-ui
google-translate-core google-translate-tk url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap whitespace undo-tree diff ido comint ansi-color ring avoid
edmacro kmacro browse-kill-ring advice cl time-date mule-util gh-common
gh-profile rx s marshal eieio-compat dash info finder-inf package
let-alist derived pcase cl-extra help-mode easymenu url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq byte-opt gv bytecomp byte-compile
cconv epg epg-config subr-x cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 563189 81695)
 (symbols 48 47128 2)
 (miscs 40 153 288)
 (strings 32 109019 4813)
 (string-bytes 1 16393106)
 (vectors 16 69322)
 (vector-slots 8 1268890 24336)
 (floats 8 270 396)
 (intervals 56 1507 1235)
 (buffers 992 24)
 (heap 1024 71980 33557))


--- End Message ---
--- Begin Message --- Subject: Re: bug#33241: image-mode in non-file buffer Date: Mon, 05 Nov 2018 22:57:25 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
> I've got problems with image-mode triggered by scad-preview, but I have
> tiny code example to trigger it:
>     (pop-to-buffer
>      (with-current-buffer (get-buffer-create "mybuf")
>        (insert-file-contents "~/pics/nav1.jpg")
>        (major-mode-suspend)
>        (setq major-mode 'image-mode)
>        (image-toggle-display-image)
>        (current-buffer)))
> ===>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   file-name-nondirectory(nil)
>   file-name-extension(nil)
>   image--imagemagick-wanted-p(nil)

Thanks for the bug report, this is now fixed.

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]