[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Image autodetection
From: |
Stefan Monnier |
Subject: |
Re: Image autodetection |
Date: |
Tue, 30 Jan 2007 10:24:38 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) |
>> 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel
- Image autodetection, Chong Yidong, 2007/01/29
- Re: Image autodetection, Juanma Barranquero, 2007/01/29
- Re: Image autodetection, Jason Rumney, 2007/01/30
- Re: Image autodetection, Juanma Barranquero, 2007/01/30
- Re: Image autodetection, Juanma Barranquero, 2007/01/30
- Re: Image autodetection,
Stefan Monnier <=
- Re: Image autodetection, Juanma Barranquero, 2007/01/30
- Re: Image autodetection, Jason Rumney, 2007/01/30
- Re: Image autodetection, Juanma Barranquero, 2007/01/30
- Re: Image autodetection, Chong Yidong, 2007/01/30
Re: Image autodetection, Richard Stallman, 2007/01/29
Re: Image autodetection, Miles Bader, 2007/01/29