So firs of all
ELISP> (version)
"Aquamacs 3.2 GNU Emacs 24.4.51.2\n(x86_64-apple-darwin14.0.0, NS apple-appkit-1343.14)\n of 2014-11-07 (Aquamacs-3.2) on watson.local"
Then I create a solid green image
$ convert -size 100x100 "xc:#009900" /tmp/whatever.png
Then I open it in emacs (aquamacs) C-x C-f /tmp/whatever.png and it is indeed green.
Then M-: (clear-image-cache).
Then run on a shell.
$ convert -size 100x100 "xc:#990000" /tmp/whatever.png
Check that the image with an external program and it is indeed red now.
I M-x revert-buffer on the emacs buffer but the image is still green...
I tried closing the buffer and find-file again and still green.
Restart Aquamacs and the image is now red as it should. Am I missing something?
i ran into the same issue (in babel) and solved it by clearing the image cache and toggling display:
(defun redisplay-images ()
(clear-image-cache)
(org-redisplay-inline-images))
(add-hook 'org-babel-after-execute-hook 'redisplay-images)
hope it works for you
Related
Using,
EMACS 24.5.1 (encoding: UTF-8 (dos/unix))
OS: Windows 8
Terminal: mintty with UTF-8 under Cygwin
Problem:
Any existing text file that I open in EMACS does not hold its indentation (text is shifted either left or right of its original position). The same text file if I open it in VIM in the same terminal session, seems to be have the correct alignment.
This happens to every text file that I open in EMACS.
I assumed the problem might be with encoding or EOL. So I tried changing the encoding of the terminal output in EMACS(using C-x RET r RET | C-x RET t RET) but that did not help.
I have been reading the official manual but can't seem to solve this issue.
Has anybody got any suggestion of how I should correct this indentation/alignment/EOL problem?
Thanks in advance.
P.S. I saw some similar emacs encoding problems on here but none of them seemed to have helped.
The problem was with the tab size and nothing to do with the encoding.
Emacs is actually pretty awesome in detecting the encoding.
The tab size = 8 white space character in Emacs by default. All my other editors I had set to 4 white space characters hence they all seem to be shifted or lost their indentation when opened in Emacs.
I have used the below configuration in my .emacs file to correct this to tabs = 4 white space char.
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
Thanks again Chris for the solution
Sometimes if I'm working in either a shell or eshell buffer with ansi-color-for-comint-mode on, and running a program which gives colourized output and then crashes while printing coloured text, the colour gets "stuck" and all subsequent text in that buffer is in that colour. The only way I've been able to fix it is to either turn ansi-color-for-comint-modeoff, or kill the shell buffer.
Is there a nicer way to tell a comint-derived shell buffer to "reset" the ansi colour codes?
It's not the prettiest solution, but this function works - it just sends the right color code to reset the colors
(defun unstick-ansi-color-codes ()
(interactive)
(end-of-buffer)
(insert "echo -e \"\033[m\"")
(comint-send-input nil t))
I am running GNU Emacs 24.3.1 on Windows 8. I put the following 2 lines in my .emacs file to specify the height and width I want for the editor window:
(add-to-list 'default-frame-alist (cons 'height 63))
(add-to-list 'default-frame-alist (cons 'width 125))
That works fine. When I open another window from the main editor window using C-x 5 2, it starts up with the same width, but for some reason the height is 66, not 63.
Does anyone have thoughts on why this would happen?
How are you determining the actual size of the resulting (new) frame? If you are using function frame-parameters then that's the right approach.
Are you starting from emacs -Q, so that you are sure that you are not loading some code from your init file that might interfere?
If so, and if you see a discrepancy between what default-frame-alist says a new frame should be like and what the new frame is actually like, then this is most likely a bug. You can report it, giving your recipe starting with emacs -Q, by doing M-x report-emacs-bug.
I use ansi-term for my normal terminal sessions. I tend to use unicode characters in my prompt to do things like set the trailing character based on the type of source control I'm using.
I use the character "±" as my prompt for git repositories.
In Emacs' ansi-term, my prompt isn't rendered as unicode, and shows as "\302\261". Displaying the current coding system shows that it defaults to utf-8-unix for input to the process, but I get raw binary as the decoding output. I can hit C-c RET p to change the encoding and decoding coding systems. I'm drawing a blank as to how to set this automatically when I start a terminal? I've tried adding to term-mode-hook to set the buffer's coding system to no avail. I think I've found what I'm looking for in term.el, but I don't care to tweak the distribution elisp, and it appears the raw binary was added to fix a bug somewhere else.
EDIT: This was unclear originally. I'm having issues setting the default process coding system for ansi-term running under Cocoa-ized Emacs 23.3 on MacOS. Emacs itself isn't running in a terminal, my terminal is running in Emacs.
The following worked for me:
(add-hook 'term-exec-hook
(function
(lambda ()
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))))
ansi-term seems to ignore the default-process-coding-system variable, so I had to set it buffer-locally after it executes my shell.
After getting a better understanding of term.el, the following works:
(defadvice ansi-term (after advise-ansi-term-coding-system)
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'ansi-term)
Trying this with term-mode-hook is broken because in term.el, term-mode-hook is called before switching to the terminal buffer, so set-buffer-process-coding-system breaks due to the lack of a process associated with the buffer.
Try
(set-terminal-coding-system 'utf-8-unix)
That's C-x RET t not C-x RET p.
So C-x RET p helps?
Unless C-h v default-process-coding-system is (utf-8-unix . utf-8-unix) try
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
I use ansi-term for my normal terminal sessions. I tend to use unicode characters in my prompt to do things like set the trailing character based on the type of source control I'm using.
I use the character "±" as my prompt for git repositories.
In Emacs' ansi-term, my prompt isn't rendered as unicode, and shows as "\302\261". Displaying the current coding system shows that it defaults to utf-8-unix for input to the process, but I get raw binary as the decoding output. I can hit C-c RET p to change the encoding and decoding coding systems. I'm drawing a blank as to how to set this automatically when I start a terminal? I've tried adding to term-mode-hook to set the buffer's coding system to no avail. I think I've found what I'm looking for in term.el, but I don't care to tweak the distribution elisp, and it appears the raw binary was added to fix a bug somewhere else.
EDIT: This was unclear originally. I'm having issues setting the default process coding system for ansi-term running under Cocoa-ized Emacs 23.3 on MacOS. Emacs itself isn't running in a terminal, my terminal is running in Emacs.
The following worked for me:
(add-hook 'term-exec-hook
(function
(lambda ()
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))))
ansi-term seems to ignore the default-process-coding-system variable, so I had to set it buffer-locally after it executes my shell.
After getting a better understanding of term.el, the following works:
(defadvice ansi-term (after advise-ansi-term-coding-system)
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'ansi-term)
Trying this with term-mode-hook is broken because in term.el, term-mode-hook is called before switching to the terminal buffer, so set-buffer-process-coding-system breaks due to the lack of a process associated with the buffer.
Try
(set-terminal-coding-system 'utf-8-unix)
That's C-x RET t not C-x RET p.
So C-x RET p helps?
Unless C-h v default-process-coding-system is (utf-8-unix . utf-8-unix) try
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))