elisp

How to display numbers in different bases under elisp?

六月ゝ 毕业季﹏ 提交于 2019-12-01 17:01:51
As we know, elisp supports number in different bases, e.g. #20r1j equals to 39 in base-10. I want to display #20r1j as #20r1j . But (format "%d" #20r1j) gives me 39 . How to keep the number in its original base? As a format string, you are quite limited in the bases you can display: %d means print as number in decimal (%o octal, %x hex). %X is like %x, but uses upper case. You can use the calc library to manage this for you, however: (require 'calc-bin) (let ((calc-number-radix 20)) (math-format-radix 39)) "1J" (let ((calc-number-radix 20)) (math-format-radix #20r1j)) "1J" As with the read

bignum in emacs/elisp

时光总嘲笑我的痴心妄想 提交于 2019-12-01 16:27:34
Does emacs have support for big numbers that don't fit in integers? If it does, how do I use them? Török Gábor Emacs Lispers frustrated by Emacs’s lack of bignum handling: calc.el provides very good bignum capabilities.— EmacsWiki calc.el is part of the GNU Emacs distribution. See its source code for available functions. You can immediately start playing with it by typing M-x quick-calc . You may also want to check bigint.el package , that is a non-standard, lightweight implementation for handling bignums. 来源: https://stackoverflow.com/questions/1371638/bignum-in-emacs-elisp

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

 ̄綄美尐妖づ 提交于 2019-12-01 15:57:59
问题 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

How to display numbers in different bases under elisp?

为君一笑 提交于 2019-12-01 15:02:34
问题 As we know, elisp supports number in different bases, e.g. #20r1j equals to 39 in base-10. I want to display #20r1j as #20r1j . But (format "%d" #20r1j) gives me 39 . How to keep the number in its original base? 回答1: As a format string, you are quite limited in the bases you can display: %d means print as number in decimal (%o octal, %x hex). %X is like %x, but uses upper case. You can use the calc library to manage this for you, however: (require 'calc-bin) (let ((calc-number-radix 20))

bignum in emacs/elisp

ぃ、小莉子 提交于 2019-12-01 14:18:44
问题 Does emacs have support for big numbers that don't fit in integers? If it does, how do I use them? 回答1: Emacs Lispers frustrated by Emacs’s lack of bignum handling: calc.el provides very good bignum capabilities.— EmacsWiki calc.el is part of the GNU Emacs distribution. See its source code for available functions. You can immediately start playing with it by typing M-x quick-calc . You may also want to check bigint.el package, that is a non-standard, lightweight implementation for handling

How do I handle password prompts when calling elisp from the terminal

落爺英雄遲暮 提交于 2019-12-01 13:25:31
I'm trying to use elisp as a shell script language. I'm writing a script where I need access to a file encrypted with gpg. I'm not sure how to handle the password prompt. In the examples below, he program is called from the command line (bash). First try: #!/usr/bin/emacs --script (setq passwd-file "~/password.gpg") (save-excursion (let ((passwd-buffer (find-file passwd-file))) (switch-to-buffer passwd-buffer) (princ (buffer-substring 1 30)))) This lets me enter the password in the terminal, but the password is shown in plaintext. Second try #!/usr/bin/emacs --script (setq passwd-file "~

How to add a tool-bar button in emacs?

你离开我真会死。 提交于 2019-12-01 11:05:08
I try to add a button in the tool-bar but that doesn't works. how to do that, i check in Emacs wiki and i find nothing. I used emacs 24.3.1. The toolsbar are displayed but not my new item. I can run it with eval-buffer but not with my .emacs or find another solution to resolve that. When i add it with eval-buffer my button leave my toolbar after a scroll. (defun omar-hotel () "another nonce menu function" (interactive) (message "hotel, motel, holiday inn")) (define-key global-map [tool-bar omar-button] '(menu-item "Hotel" omar-hotel :image (image :type xpm :file "/usr/share/emacs/24.3/etc

How to type a dynamic file entry for org capture

雨燕双飞 提交于 2019-12-01 10:38:08
I'm trying to figure out if there is some way to create a dynamic file name for capture in emacs org-mode. ("z" "test" entry (file+headline ***A date specific headline*** "Notes")) "** %^{prompt}") Is there some simple way to pass a date and year to the file part, so that I can have a file dynamically created for each month. What I'd like is something like this: (concat "/home/me/file/report_notes_" (format-time-string "%m_%Y") ".org") Edit - I've finally got it working, using backquoting: `(("z" "test" entry (file+headline ,(capture-report-date-file "/path/path/name_") "Notes") "** %^{prompt}

How to set emacsclient background as Emacs background?

匆匆过客 提交于 2019-12-01 08:37:40
I've got (in my .emacs) (set-background-color "#101416") (set-foreground-color "#f6f3e8") And I've got 2 bindings: alias ex='emacsclient -nw' alias ec='emacsclient -c -a ""' ex works fine to open client in terminal but when I want to open it as a frame I've got white background :( Why and how can I use my dark background there? set-background-color and set-foreground-color only affect the current frame, and your .emacs file is not executed when running emacsclient . Try setting the variable default-frame-alist ("Alist of default values for frame creation") instead: (setq default-frame-alist '(

How to use hl-line-mode to highlight just one (1) line when visual-line-mode is enabled

℡╲_俬逩灬. 提交于 2019-12-01 08:26:31
Does anyone have an alternative to, or a modification of, hl-line-mode so that just one (1) horizontal line will be highlighted when visual-line-mode is enabled? Presently, the entire word-wrapped line gets highlighted, even though it may span several horizontal lines. I'm using a fairly recent version of Emacs Trunk. You should be able to control this using hl-line-range-function , giving it code that stops at the position used by end-of-visual-line . (100% untested -- just checked the source code a bit. And no, I do not use visual-line-mode .) 来源: https://stackoverflow.com/questions/20275596