unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Juanma Barranquero" <lekktu@gmail.com>
Cc: Chong Yidong <cyd@stupidchicken.com>,
	emacs-devel@gnu.org, Jason Rumney <jasonr@gnu.org>
Subject: Re: Image autodetection
Date: Tue, 30 Jan 2007 10:24:38 -0500	[thread overview]
Message-ID: <jwvbqkgbl4n.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <f7ccd24b0701300411n3a943f1ehe59ca3a8646a33a8@mail.gmail.com> (Juanma Barranquero's message of "Tue\, 30 Jan 2007 13\:11\:55 +0100")

>> The other changes proposed in that thread, such as using
>> image-minor-mode by default, are probably unnecessary.

> The only advantage of the image-minor-mode method is that users would
> receive a security warning when they first run image-toggle-display

Actually, the way I see it the only real advantage of image-minor-mode is
that if a C file gets wrongly detected as a GIF file, it doesn't really
matter because the C mode is still activated and you just get a bunch of
spurious extra commands to display the "image".


        Stefan


>> so I like Richard's idea of bypassing #1 of Chong's
>> proposals (no more options, please!) and just implementing #2 (with
>> image-toggle-display disabled, as you note).

> Something like the attached patch, which couldn't be simpler.

Looks good to me.

> Index: lisp/image-mode.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/image-mode.el,v
> retrieving revision 1.16
> diff -u -2 -r1.16 image-mode.el
> --- lisp/image-mode.el	21 Jan 2007 03:53:11 -0000	1.16
> +++ lisp/image-mode.el	30 Jan 2007 12:03:44 -0000
> @@ -61,10 +61,5 @@
>   (use-local-map image-mode-map)
>   (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
> -  (if (and (display-images-p)
> -	   (not (get-text-property (point-min) 'display)))
> -      (image-toggle-display)
> -    ;; Set next vars when image is already displayed but local
> -    ;; variables were cleared by kill-all-local-variables
> -    (setq cursor-type nil truncate-lines t))
> +  (setq cursor-type nil truncate-lines t)
>   (run-mode-hooks 'image-mode-hook)
>   (if (display-images-p)
> @@ -180,4 +175,10 @@
> 	  (message "Repeat this command to go back to displaying the file as
> text")))))

> +(put 'image-toggle-display 'disabled "\
> +
> +WARNING: Displaying images can be a security risk.
> +Please make sure you're using up-to-date image libraries
> +and the images displayed come from a trusted source.")
> +
> (provide 'image-mode)


> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-01-30 15:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 19:05 Image autodetection Chong Yidong
2007-01-29 19:19 ` Juanma Barranquero
2007-01-30  9:04   ` Jason Rumney
2007-01-30  9:38     ` Juanma Barranquero
2007-01-30 12:11       ` Juanma Barranquero
2007-01-30 15:24         ` Stefan Monnier [this message]
2007-01-30 15:59           ` Juanma Barranquero
2007-01-30 16:54             ` Jason Rumney
2007-01-30 17:07               ` Juanma Barranquero
2007-01-30 16:58         ` Chong Yidong
2007-01-29 23:53 ` Richard Stallman
2007-01-30  0:55 ` Miles Bader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvbqkgbl4n.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

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