How to get rid of Big yellow exclamation mark in Emacs - emacs

I downloaded a modified Emacs from vgoulet.act.ulaval.ca/en/emacs/, I'm not sure if it is that to be blame, but every time when input error or scroll to the last in emacs, it shows a yellow big exclamation mark like this. How to get ride of this? Thank you so much.
screenshot of this mark

Try setting the visible-bell variable to nil or the ring-bell-function variable to 'ignore. E.g.,
;; you really only need one of these
(setq visible-bell nil)
(setq ring-bell-function 'ignore)

Related

How to disable Emacs highlighting whitespace in parenthesis?

In the above screenshot, it can be seen that Emacs highlights the whitespace between parentheses, unless I move my cursor one place to either side.
I have smartparens enabled in my emacs config, but even if I disable them, this problem still persists.
I also don't have whitespace-mode enabled.
Any idea what may be causing this?
The relevant part of my config:
(require 'smartparens-config)
(smartparens-global-mode t)
(show-smartparens-global-mode t)
Thanks.
Unfortunately the solution given by Ignacy Moryc, didn't help me, but this one helped:
(setq sp-highlight-pair-overlay nil)
This looks like show-paren-mode
If you have (show-paren-mode t) anywhere in your config file, you might want to remove it. Or you can change the show-paren-style variable value to parenthesis
(setq show-paren-style 'parenthesis)

emacs: How to use the mark-ring?

When I do a C-u C-SPC, emacs takes me to "where I was before". Subsequent C-u C-SPC presses go back up previous places.
That is damn great, and I use it a lot.
But something always bugged me : The only mark missing from the mark-ring is where-I-invoked-this-in-the-1st-place! It's like leaving bread crumbs behind you, and then go "whoops, I may be lost, imma go back and check", then going back without leaving a bread crumb where you are right now!
I tried advising the function, but I can't for the life of me programmatically simulate a C-SPC C-SPC.
how can I "see" (echo, message, trace, etc) what a key combination does, like "C-h k" but
for repeated key sequences, like C-SPC C-SPC ? Here is what the manual says of the latter (emphasis mine)
C-SPC runs the command set-mark-command, which is an interactive
compiled Lisp function in `simple.el'.
It is bound to C-#, C-SPC.
(set-mark-command ARG)
Set the mark where point is, or jump to the mark. Setting the mark
also alters the region, which is the text between point and mark; this
is the closest equivalent in Emacs to what some editors call the
"selection".
With no prefix argument, set the mark at point, and push the old mark
position on local mark ring. Also push the old mark on global mark
ring, if the previous mark was set in another buffer.
But when I try to use it (non-interactively) "With no prefix argument" in order to "set the mark at point" I get a debugger error "wrong-number-of-arguments"..? (I realize the difference between an argument and a prefix argument).
I would be okay even with a philosophical, non-practical answer. I just want to understand what the idea is here.
(push-mark) seems to be doing what you want.
OK, here is what I did
(defun px-push-mark-once-and-back ()
"Mark current point (`push-mark') and `set-mark-command' (C-u C-SPC) away."
(interactive)
(let ((current-prefix-arg '(4))) ; C-u
(if (not (eq last-command 'px-push-mark-once-and-back))
(progn
(push-mark)
(call-interactively 'set-mark-command))
(call-interactively 'set-mark-command))))
(global-set-key (kbd "<s-left>") 'px-push-mark-once-and-back)
Ok, I bundled up two relevant answers from this question into a small package here.
It allows you to use C-- C-SPC to move forward in mark-ring.
You probably shouldn't be using set-mark or set-mark-command non-interactively. Within elisp, just save point (or whatever location) in a variable with a good name.
Also, C-h i m emacs m mark.
I'm no emacs guru wrt mark movement, I barely use it. I know I've seen the behavior you want before though.

fix an auto-complete-mode and linum-mode annoyance

I'm using auto-complete-mode which I think is totally fantastic. I'm also a big fan of linum-mode but I've got a very irritating issue when the two are used together, especially when I'm working in a new buffer (or a buffer with very few lines).
Basically the buffer is 'x' lines long but when auto-complete kicks in it "adds" lines to the buffer, so linum-mode keeps switching, for example, between displaying line numbers on one column or two columns, depending on whether auto-complete is suggesting a completion or not.
So you type a sentence and you see your buffer's content frantically shifting from left to right at every keypress. It is really annoying.
I take it the solution involves configuring the linum-format variable but I don't know how.
Ideally it would be great if my linum-format was:
dynamic
right-aligned
considering there are 'y' more lines to the buffer than what the buffer actually has
My rationale being that auto-complete shall not suggest more than 'y' suggestion and that, hence, the two shall start playing nicely together.
For example, if 'y' is set to 20 and my buffer has 75 lines, then linum should use two columns: because no matter where I am auto-complete shall not make the buffer 'bigger' than 99 lines.
On the contrary, if 'y' is still set to 20 and my buffer has 95 lines, then linum should use three columns because otherwise if I'm near the end of the buffer and auto-complete kicks in my buffer shall start "wobbling" left and right when I type.
I'd rather not hardcode "3 columns wide" for linum.
I guess using "dynamic but always at least two columns" would somehow fix most annoyances but still something as I described would be great.
P.S: I realize that my 'fix' would imply that linum would always display on at least two columns, and I'm fine with that... As long as it stays right-aligned and use 2, 3 or 4 columns depending on the need.
Simply put the following line in .emacs which resolves this issue. It is in auto-complete.el.
(ac-linum-workaround)
I've written a couple of previous answers on modifying the linum-mode output, which you could probably adapt to your purposes.
Relative Line Numbers In Emacs
Colorize current line number
Edit: Here's the most basic version of that code (also on EmacsWiki, albeit somewhat buried), which doesn't modify the default output at all, but uses the techniques from those other answers to be more efficient than the default code. That's probably a more useful starting point for you.
(defvar my-linum-format-string "%4d")
(add-hook 'linum-before-numbering-hook 'my-linum-get-format-string)
(defun my-linum-get-format-string ()
(let* ((width (length (number-to-string
(count-lines (point-min) (point-max)))))
(format (concat "%" (number-to-string width) "d")))
(setq my-linum-format-string format)))
(setq linum-format 'my-linum-format)
(defun my-linum-format (line-number)
(propertize (format my-linum-format-string line-number) 'face 'linum))
Just have the same problem, after seeing 'patching the source' I believe it could be done with advice. Here is what I come up with
(defadvice linum-update
(around tung/suppress-linum-update-when-popup activate)
(unless (ac-menu-live-p)
ad-do-it))
I would like to use popup-live-p as mentioned but unfortunately it requires the variable for the popup, which we couldn't know in advance.
Update:
I ended up patching the source for linum.el. I added an extra hook that runs before updates.
Here's the patched file: linum.el (github)
Here's the code I have in my init.el:
;; Load custom linum.
(load-file "~/.emacs.d/linum.el")
;; Suppress line number updates while auto-complete window
;; is displayed.
(add-hook 'linum-before-update-hook
'(lambda ()
(when auto-complete-mode
(if (ac-menu-live-p)
(setq linum-suppress-updates t)
(setq linum-suppress-updates nil)))))
Hope it helps!

Emacs: Turn off indentation when doing a paragraph fill in LaTeX mode

When I am using emacs to edit a latex document the paragraph fill (Esc-q) does not do what I want. For example, something like:
The component \vn{%vec} is not similar to
When I use fill I get:
The component \vn{%vec} is not
% similar to
That is, emacs is taking "%" to be a comment character and filling the paragraph accordingly. However, "\vn" is a macro of mine that sets text in texttt mode and here "%" is simply a regular printable character so the paragraph fill has done things incorrectly.
So what I want is for paragraph fill to be the same it is as in text-mode. That is, no indentation and no adding extra characters. But I don't want to have to toggle between text-mode and latex-mode every time I want to paragraph fill. Is there any way to do this?
Thanks for the help. -- David
PS: Yes, I do know that if there are real comments at the end of lines then the test-mode fill will not do things correctly. But I never put comments at the end of lines so this will never bother me.
I found the solution. I put this in my init.el file:
(add-hook 'latex-mode-hook '(lambda() (setq comment-start nil)))
(add-hook 'tex-mode-hook '(lambda() (setq comment-start nil)))
(add-hook 'latex-mode-hook '(lambda() (setq fill-indent-according-to-mode nil)))
(add-hook 'tex-mode-hook '(lambda() (setq fill-indent-according-to-mode nil)))
I love emacs but the documentation (or lack thereof) can sometimes drive me crazy... :).
You can try:
(setq comment-start nil)
to handle this specific case.
What you're trying to fix is a symptom of the real problem -- latex-mode is
naively marking code after "%" as comment.
Does installing auctex-mode fix your problem?

How to make light cursor in auto-complete in emacsClient

mode is here : http://emacswiki.org/emacs/AutoComplete
and in the bottom:
I have a black background and when I use auto-complete, as soon as I
type something my cursor turns black, so now I can’t see it. Help! How
am I going to fix this problem?
Ok nevermind, fixed it. Just added (set-cursor-color “white”) to my
.emacs file after loading the auto-complete package.
So I just made it too. even (set-cursor-color “#ffffff”) but it doesn't help me. How can I solve this problem?
Correction: it works for emacs but doesn't work for emacsclient
Maybe I must to add some hook? But I need to make a proper hook then, not to add all my mess where I'm trying to solve the trouble setting everything foreground light background dark...
also here is off-topic question: why most of professional emacs users use light themes?
config:
(require 'auto-complete-config)
(ac-config-default)
(set-face-background 'ac-completion-face "darkgray")
(set-face-underline 'ac-completion-face "lightgray")
(set-face-background 'ac-yasnippet-candidate-face "black")
(set-face-underline 'ac-yasnippet-candidate-face "sandybrown")
(set-face-background 'ac-candidate-face "darkgray")
(set-face-underline 'ac-candidate-face "lightgray")
(set-face-background 'ac-selection-face "steelblue")
(set-cursor-color "#ffffff")
(provide 'auto-complete-settings)
Answers for comments:
(frame-parameter (selected-frame) 'cursor-color)
"black"
-- before autocomplete (when cursor light) and after when cursor goes dark.
The three faces which autocomplete uses are ac-candidate-face, ac-completion-face and ac-selection-face. Customising them should take care of your problem.
I'm not using autocomplete, but I can't reproduce this behaviour for the default face.
In 23.1.1 I can set the background colour of the default face using the same function you've specified, and it applies the change and sets it as the default value for all subsequent frames, including those from emacsclients.
Can you confirm that you're definitely talking to a server to which your changes have been made?
Here is what works for me:
(defun frame-bg (frame)
"Custom behaviours for new frames."
(with-selected-frame frame
(set-cursor-color "#ffffff")
))
(frame-bg (selected-frame))
(add-hook 'after-make-frame-functions 'frame-bg)
I agree that Heather's answer will work, but I found that all I needed to solve this problem was to put the following into my .emacs file (after enabling auto-complete-mode):
(set-cursor-color “white”)