elisp

Emacs — creating a custom highlight parentheses function

时光毁灭记忆、已成空白 提交于 2019-12-02 00:25:45
I'm looking for some assistance, please, further modifying the following already modified excerpt from the highlight-parentheses library: https://github.com/nschum/highlight-parentheses.el [Fn 1.] GOAL : The goal is to use something like mapcar or dolist to automatically replace INSERT-FACE-HERE with a different face from the variable my-parens-faces each time while does a loop . The visual effect will be a rainbow coloring of parentheses based on the level of nesting. I am removing the overlays with a post-command-hook and a function similar to remove-overlays , and then subsequently adding

elisp how to check if Shift key is pressed

孤街醉人 提交于 2019-12-01 23:23:23
问题 I need to check if Shift key is pressed. More exactly I would like to set dired switches depending on whether Shift is pressed. (defadvice find-file-noselect (around find-file-noselect-set-switches activate) (let ((switches dired-listing-switches)) ;; check if shift is pressed and set or not an "R" switch (setq dired-listing-switches "-lhRA") ad-do-it (setq dired-listing-switches switches))) Of course, I can have different shortcuts for different dired switches, but I would like to change my

Emacs: bulletproof up-list?

老子叫甜甜 提交于 2019-12-01 22:29:26
I'm getting up-list: Scan error: "Unbalanced parentheses" from this position: (foo "bar|") Snippet from up-list doc: This command assumes point is not in a string or comment. So this is the expected behavior. But I don't care. I just want to go upwards from a list. Could someone suggest an up-list clone that does the proper thing? I'm looking for something better than this naive code: (defun up-list-naive () (interactive) (while (not (ignore-errors (up-list) t)) (forward-char))) Tyler EDIT: incorporated Andreas Rohler's suggestion: This works for me in your test case: (defun my-up-list ()

elisp how to check if Shift key is pressed

耗尽温柔 提交于 2019-12-01 22:17:17
I need to check if Shift key is pressed. More exactly I would like to set dired switches depending on whether Shift is pressed. (defadvice find-file-noselect (around find-file-noselect-set-switches activate) (let ((switches dired-listing-switches)) ;; check if shift is pressed and set or not an "R" switch (setq dired-listing-switches "-lhRA") ad-do-it (setq dired-listing-switches switches))) Of course, I can have different shortcuts for different dired switches, but I would like to change my switches dynamically during choosing a directory for dired. Trey Jackson Duplicate question (ignoring

Emacs / Magit — how to create and delete repositories on Github

寵の児 提交于 2019-12-01 22:01:26
I am having trouble in Magit with step number 5 and step number 7 to create a new repository. If they exist, what are the interactive function equivalents (please) for steps 5 and 7? If there are no interactive equivalents, I guess I will need to write my own shell command functions -- unless, of course, someone would like to take a stab at them first. :) CREATE -- COMMAND-LINE RECIPE 1. $ touch README.md 2. $ /usr/local/git/bin/git init 3. $ /usr/local/git/bin/git add . 4. $ /usr/local/git/bin/git commit -m "First commit." 5. $ curl -u 'USERNAME' https://api.github.com/user/repos -d '{"name":

Emacs quicker bookmark-jump?

女生的网名这么多〃 提交于 2019-12-01 21:29:50
问题 I have most of my bookmarks prefixed by a letter in a way that the first letter almost always uniquely determines the bookmark. This way I can, for instance, jump to my source folder (bookmarked as "s: source") with M-x bookmark-jump RET s RET . I have it on a shortcut, so it's actually ~ s RET . I'd like to get rid of RET in the end, i.e. get M-x bookmark-quick-jump RET s or ~ s to do the aforementioned job. I'd also like it to fall back to the default behavior: to show me all bookmarks that

Lexical eval in emacs24

China☆狼群 提交于 2019-12-01 20:25:51
问题 Can anybody explain me how eval works with emacs24? From eval description: eval is a built-in function in `C source code'. (eval FORM &optional LEXICAL) Evaluate FORM and return its value. If LEXICAL is t, evaluate using lexical scoping. Does that mean, that something like this should work? (setq lexical-binding t) (let ((myvarr 42)) (eval 'myvarr t)) ; (void-variable myvarr) Update: (setq lexical-binding nil) ;; => nil (let ((myvarr 42)) (eval 'myvarr)) ;; => 42 (#o52, #x2a, ?*) (setq

Lexical eval in emacs24

痴心易碎 提交于 2019-12-01 18:42:41
Can anybody explain me how eval works with emacs24? From eval description: eval is a built-in function in `C source code'. (eval FORM &optional LEXICAL) Evaluate FORM and return its value. If LEXICAL is t, evaluate using lexical scoping. Does that mean, that something like this should work? (setq lexical-binding t) (let ((myvarr 42)) (eval 'myvarr t)) ; (void-variable myvarr) Update: (setq lexical-binding nil) ;; => nil (let ((myvarr 42)) (eval 'myvarr)) ;; => 42 (#o52, #x2a, ?*) (setq lexical-binding t) ;; => t (let ((myvarr 42)) (eval 'myvarr)) ;; Debugger entered--Lisp error: (void-variable

Can't call functions defined in macro with names generated by make-symbol

牧云@^-^@ 提交于 2019-12-01 17:39:01
问题 I'm trying to write an ELisp macro to generate a multiple functions based on some common data. For example, when I want to compute the fn names I write something like (I'm ignoring hygiene for the moment, I'm passing a symbol literal into the macro so evaluation shouldn't matter): (cl-defmacro def-fns (sym) "SYM." (let ((s1 (make-symbol (concat (symbol-name sym) "-1"))) (s2 (make-symbol (concat (symbol-name sym) "-2")))) `(progn (defun ,s1 () (+ 1 2 3)) (defun ,s2 () "six")))) which I expect

Algorithms for moving the cursor to a date on a 12 month rotating calendar in Emacs

蹲街弑〆低调 提交于 2019-12-01 17:26:22
GOAL : The goal of this thread is to create two (2) mathematical formulas to replace the long-hand solution by @lawlist in the function lawlist-calendar-cursor-to-visible-date (below). STORY PROBLEM There now exists a 12-month calendar in Emacs that scrolls forwards and backwards one month (or more) at a time. The function lawlist-calendar-cursor-to-visible-date is used to mark dates with overlays for designated events (e.g., birthdays, holidays, appointments, etc.); or, to simply move the cursor to a particular date. @lawlist has devised a solution by long-hand, which does not entirely use