I frequently work with Protein Data Bank files. These are text files that contain atomic level structure information of molecules. They can be recognized by their '.pdb' extension.
Whenever editing them in Emacs (GNU Emacs 24.3.1), in the main buffer I see a small box in the top left corner and the minibuffer has the instructions, "Type C-c C-c
to view the image as text." In the bar between the minibuffer and the main buffer, it list that the mode is (Image[imagemagick])
. After pressing C-c C-c
, this mode changes to (Fundamental Image[imagemagick])
. It has got to the point where I quickly type C-c C-c almost without thinking about it to view and edit the text file but I would rather not have to. How do I make it default to the (Fundamental Image[imagemagick])
mode? I would think I could add some hook to my init.el file but I am not sure what.
Here is an example of text that when saved as test.pdb
produces the behavior described:
ATOM 1 O5' CYT X 1 32.071 -1.490 114.864 1.00 0.00 DNA1 O
ATOM 2 C5' CYT X 1 30.711 -1.577 114.398 1.00 0.00 DNA1 C
ATOM 3 C4' CYT X 1 30.171 -0.188 114.035 1.00 0.00 DNA1 C
ATOM 4 O4' CYT X 1 30.040 0.620 115.241 0.00 0.00 DNA1 O
ATOM 5 C1' CYT X 1 30.111 1.904 114.881 0.00 0.00 DNA1 C
ATOM 6 C2' CYT X 1 31.383 1.832 114.043 0.00 0.00 DNA1 C
ATOM 7 C3' CYT X 1 31.091 0.649 113.121 1.00 0.00 DNA1 C
ATOM 8 O3' CYT X 1 30.453 0.939 111.890 1.00 0.00 DNA1 O
ATOM 9 P THY X 2 29.768 2.098 111.098 1.00 0.00 DNA1 P
I noticed that when opening files in a terminal using the 'no window' option, emacs -nw test.pdb
, it opens using (Fundamental Image)
mode, without the [imagemagick]
part. I am not sure the difference but if I would be happy if I could get that behavior in the windowed version (I do not intend to only edit within the terminal).
I do wonder why Emacs tries to render the file as an image. It is clearly related to having ImageMagick installed but I am not sure the specifics. Does anyone know if it actually can correctly read and render the molecule/s contained in pdb files?
Searching Google for a solution, I see several hit regarding python interactive debugger, the pdb package, and using that from Emacs. Obviously that is not what I am looking for.
This behavior has been consistent over multiple Emacs updates for the past several years on several computers but the specific version info for the Emacs I am currently using is the following: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07 on lamiak, modified by Debian.
If you have recommendations of better Tags which will help this get seen by people that would have input, please let me know.