简体   繁体   中英

Change default drag-and-drop behavior to open file in read-only mode

I just finished the Emacs Lisp intro and am getting my feet wet with customization. I've browsed the Emacs FAQ, the Emacs W32 FAQ, and perused the fine manual for drag and drop information. I am using GNU Emacs 24.5.1 for Windows without Cygwin (etc.).

I would like to update the default drag and drop behavior to open such files in read only mode. Through Ch f I've identified the dnd functions. In particular, dnd-open-file may be relevant. By Ch k and then dragging a file into Emacs, I've identified the function w32-drag-n-drop . Also, within the Reference Manual is a section on drag-and-drop which specifies x-dnd-types-alist .

  1. How do I identify which of these items, if any, needs to be modified?
  2. What is a safe way to modify its behavior?
  3. I cannot find documentation on x-dnd-types-alist . Is it a function? A variable?
  4. Is there a resource I've overlooked which I should be looking at?

Partial answers of a general nature - I can't help with your dnd problems, but I hope these suggestions will be of some use.

Q2. It's a good idea to have a minimal init file, containing whatever is necessary to initialize an environment for testing. You can them invoke emacs like this:

emacs -q -l /path/to/minimal/init/file

bypassing your initialization file (-q) and loading the minimal init file instead. Then if something blows up, you just kill this emacs instance, and start again (possibly with a modified init file).

Q3. It's a variable (as are all alists). An alist (short for association list) is a list of key-value pairs. You can get the docstring of any variable with

C-h v VARNAME RET

eg

C-h v x-dnd-types-alist RET

Q4. If all else fails, the source is available...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM