New answers tagged

3

I recommend reading the Emacs Lisp manual instead of Emacswiki. Here's some of it on backslash sequences in regular expressions: ‘\sCODE’ matches any character whose syntax is CODE. Here CODE is a character that represents a syntax code: thus, ‘w’ for word constituent, ‘-’ for whitespace, ‘(’ for open parenthesis, etc. To represent ...


3

No, regplace-regexp-in-string does not magically substitute the buffer string into the STRING argument. It is a function but not a command (does not have an interactive specification). The command you are actually looking for is query-replace-regexp which can be used interactively and is bound to C-M-%. Use: C-M-% [0-9] RET \,(string (+ (string-to-char \&...


2

? is the zero-or-one quantifier: \\(...\\)? says the group may or may not match anything. Make it non-capturing if you don't care about backreferences to that group: \\(?:...\\)? I tried this but it doesn't work, the \n literals prevent the following ^ from being detected. ^ only has its special meaning in certain positions; You can't put it anywhere ...


2

. matches any single character except a newline, so ^.*( matches from line beginning till (, thus all lines besides the empty line matches. Don't forget the first line contains (: Exercise 2.32. ... For example, if the set is (1 2 3), ... You should change . into \s- (it matches any whitespace character, you can also just use space character). However, I ...


2

The character class name should be enclosed between [: and :](see emacs manual), the correct pattern is ^\([[:digit:]]\) Since you have a single group you can skip the parentheses and refer to the whole match with \&, e.g: ^[[:digit:]] → ** \&


1

The following elisp code defines a new minor mode web-hide-attr-mode. It is hooked to web-mode. So it is already active if you open a document in web-mode. You can toggle it by M-x web-hide-attr-mode. It works by adding an entry to font-lock-keywords that puts the invisible property web-hide-attr on the html attributes and by adding web-hide-attr to the ...


Top 50 recent answers are included