Getting start with js2-mode in Emacs
The js2-mode is a javascript mode that actually works.
Get the latest js2, put it in your load-path, the configuration
Store customization file in separate file in Emacs
The built-in customization UI in Emacs is an unorganized mess of elisp code that is appended at the bottom of your init file.
By setting the custom-file variable, you can keep those automatically generated customizations in a separate file. Put this in your Emacs init:
How to Define Emacs Custom Faces for text highlighting
more fine-grained control to highlighting, you need to define custom faces.
[Define Custom Faces ... Major Mode]
Let's drive a major mode from fundamental-mode and apply our custom faces to text ...
Emacs already provided a set of faces, you can find them in font-lock.el. Most faces ... ]
The following code defines three custom faces.
(defvar highlight 'highlight "Face name to use
How to override global keybinding for a specific file in Emacs
it for a particular file but wouldn't affect other buffers with the same major mode.
To target a specific file ... we should use the find-file-hook, we will match the file name in the hook function. To override ...
When editing a large text file, harmless things in regular file can be disastrous ... if the text file is big enough.
There is no reason to launch the dangerous command in any situation
Emacs defvar doesn't take effect
One of the common problem an Emacs newbie would commit is take defvar literally ... . The defvar can associate a non-nil value with an variable only once.
ELISP> (defvar aa 3)
aa
ELISP> aa ...
3 (#o3, #x3, ?\C-c)
ELISP> (defvar aa 4)
aa
ELISP> aa
3 (#o3, #x3, ?\C-c)
ELISP> (setq aa 4 ... )
4 (#o4, #x4, ?\C-d)
ELISP> aa
4 (#o4, #x4, ?\C-d)
The story always goes this way: you use defvar
Emacs Font Lock How to highlight multiline text
text matching]
By default, Font Lock only process line of text, to support multiline text, we have ... ))))
;; this is a multiline regexp match
;; (setq font-lock-multiline t)
(put-text-property ... )
'font-lock-multiline t))
;; Apply each highlight to this instance of `matcher', which may ... fatigue sometimes.
I would like to let Emacs to highlight the comment text block so I
How to save HTML table as pure text with format retained
, you just want a pure text file, no HTML structure, no CSS styles, no need to use it in a browser ... and it has built-in text browser which render html table in text mode but keep the rows and columns ...
Sometimes you may want to save a web page as text if you don't want the style and images ... but a simple text editor. But you can not ingore the table, tables sometimes are very useful, but copy
Emacs multi-occur Search All Occurrences and List Search Results
several buffers and files, list all occurrences for later inspection. You can also call it batched ... we want to do the same thing in Emacs. And Emacs provides a lot of choices for us.
[multi-occur ... all buffers is ".", you execute M-x multi-occur-in-matching-buffers and input "." and then input query ... .
[The *Occur* buffer]
By default, the search results are displayed in a new buffer with name
Warning: Desktop file appears to be in use by PID how to disable
In desktop-save-mode, every time Emacs recover from exceptional quit or crash, I ...
Search the substring for example "be in use" you will find it
This is one among the three ... get this warning.
Every time I just answer yes and it looks everything are normal. So I don't know what's ... the reason to answer no.
But it gets annoying when there are lot of buffers needs