Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [symbols]

The tag has no usage guidance.

0
votes
0answers
20 views

Representation of text as unicode symbols for differential equations in code

I'm running the Ubuntu Mate LTS version of emacs "GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-09-20 on lcy01-07, modified by Debian" I've been working with matlab-mode on ...
0
votes
0answers
21 views

cl-loop for loop variable outside of scope [duplicate]

I wrote the code below to set the right font for my emacs based on the fonts that exist already. (cl-loop with preferred-fonts = (list "Noto Mono" "Source Code Pro" ...
6
votes
2answers
140 views

How to make (make-symbol “foo”) (make-symbol “foo”) equal?

I'm curious why: (equal (make-symbol "foo") (make-symbol "foo")) ends up beeing nil. While (equal 'foo 'foo) is t. Do i have a misconception of symbols? Aren't they just strings without double-...
0
votes
1answer
65 views

Why would `symbol-name' return a fontified string?

I've got a weird bug in a GraphQL encoder I'm writing that I've tracked down to one form: (symbol-name 'world) ;; yields #("world" 0 5 (fontified t)) I can reproduce the issue in a *scratch* ...
1
vote
1answer
43 views

practical relevance of storing value and function into one symbol

With Emacs Lisp it is possible to store a value and a function within the same symbol. (setq foo 6) (defun foo () (message "blah %d" foo))) Then you can do: (symbol-function 'foo) which returns the ...
2
votes
2answers
47 views

What's the most reliable way to get the start and end positions of current symbol under cursor?

What's the most reliable way to get the start and end positions of the symbol at the cursor location (point)?
1
vote
1answer
55 views

How to use defvar with the symbol name in another variable?

I am trying to create a global variable which name is contained in another variable, using defvar: (let ((var-name "my-test-var")) ;;(defvar (intern var-name) "some value") (defvar (make-symbol ...
1
vote
1answer
72 views

major-mode as argument to string-match vs string-equal

Why is (string-match "lisp" major-mode) not working, while (string-equal "lisp-interaction-mode" major-mode) is working? string-match results in debugger message: (wrong-type-argument stringp lisp-...
0
votes
0answers
33 views

Is there a canonical way to convert a keyword to a symbol with no :?

I want to convert keywords, e.g. :some-key to a plain symbol like some-key. I currently do this with: (intern-soft (substring (symbol-name :some-key) 1)) Is there a better way?
1
vote
1answer
55 views

How can I set the global value of a symbol created from a string?

I'm trying to make this little convenience function work: (defun my-make-hook (when procedure) (let ((hook-symbol (intern (concat (substring (symbol-name when) 1)...
0
votes
2answers
302 views

how to correctly pass around function as parameters?

I have a working snippet that advices both kill-buffer and kill-this-buffer to not kill the scratch buffer: (defun ninrod/scratch-bodyguard (buffer-assassin &rest arguments) (let ((buffer-...
1
vote
3answers
379 views

Is there a way to underline symbol under cursor?

I want to highlight somehow symbol under cursor, is there a way to customize font for that current symbol? Ideally I want to add underline with some color to it, or maybe change bg color of text, is ...
1
vote
1answer
20 views

Display abbreviated form of a function name?

I've seen videos where someone an elisp function call like (so-and-so/do-stuff) But were able to shorted the displayed function name to something like (so/do-stuff) How do they do that? I'd like ...
0
votes
1answer
51 views

If a function is passed as an argument to another function, is the first function's name accessible?

I have some code that takes as an argument a function: (defun message-name (fn) ) I would like to be able to, if the function has a name, message it. For example, if called this way: (message-...
0
votes
1answer
509 views

Symbol's function definition is void on built-in variables?

For some reason I am getting errors for built-in variables that are available in the documentation. For instance, evaluating in the scratch buffer the following all return: Symbol's function ...
1
vote
1answer
93 views

How to fix Warning: assignment to free (local) variable in lambda function

The byte compiler just gave me this message 1103:24:Warning: assignment to free variable `orig-win-config on this bit of code: ;; create window config store and restore functions ;; credit to @...
2
votes
0answers
265 views

In Emacs Lisp, how to convert roman numerals to an integer?

In Emacs Lisp, how to write an Emacs Lisp function to convert a natural number from roman numerals representation to the equivalent Emacs Lisp integer value? The Emacs Lisp function should be callable ...
1
vote
1answer
35 views

Modify face by its string name

In my config file i have the following lines to fix faces for Scala-mode: (make-face-bold scala-font-lock:lazy-face) (make-face-bold scala-font-lock:final-face) (make-face-bold scala-font-lock:...
1
vote
2answers
85 views

Deleting whole variable name on M-backspace

Is there a way to configure emacs, so that when I hit M-backspace it would actually remove the whole variable? If I have a variable like my_dummy_variable I need to hit M-backspace three times in ...
12
votes
3answers
2k views

Exporting unicode characters to pdf using latex from org mode

Hello Good people of Emacs! I'm having trouble exporting unicode math symbols from buffer (org-mode) to pdf file. 1. Problem Description: Symbols are inserted to the buffer as unicode characters (...
7
votes
1answer
162 views

Understanding uninterned symbols and macro expansion?

I want to demonstrate my lack of knowledge with an example. Using the following two macro defintions, (defmacro for (var from init to final do &rest body) "Execute a simple for loop: (for i ...
6
votes
1answer
789 views

Function naming with forward slash?

I see this elisp code (Bernt Hansen): (defun bh/hide-other () (interactive) (save-excursion (org-back-to-heading 'invisible-ok) (hide-other) (org-cycle) (org-cycle) (org-cycle)...
4
votes
1answer
53 views

Why requiring fails with dynamic symbols?

I just encountered this behavior of Emacs. This works: (require 'test) But this doesn't (require (make-symbol "test")) Why is that and can I workaround it somehow?
2
votes
1answer
152 views

Mode local variables

I frequently use file-local variables, but after writing some minor modes I find the need to implement mode-based behavior. Let's say I want to define a variable errors-list-regexp that varies ...
5
votes
2answers
1k views

Naming convention for variable and function names

When programming in Emacs Lisp, should variable and function names always be lower case? According to The Emacs Lisp Style Guide they should use "lisp-case", but what is that? In Emacs Lisp manual the ...
12
votes
4answers
2k views

What does `symbol-value` do?

The docs made me no wiser: This function returns the value stored in symbol's value cell. This is where the variable's current (dynamic) value is stored. If the variable has no local binding, ...
15
votes
3answers
1k views

How to create :keywords?

Q: How does one create and use :keywords? Consider a (naive, apparently) attempt to access the following toy alist: (setf alist '((:key-1 "Key no. 1") (:key-2 "Key no. 2"))) (assq :...
1
vote
1answer
924 views

How to match the function name in a function call?

I am trying to extract the function name from a function call. For example: (let ((str "(test-func")) (if (string-match "^(\\s_+" str) (message "ok") (message "no match"))) But this ...
7
votes
2answers
169 views

When to use symbol properties?

Let's say I need to associate symbols with directories, and this will only need to be done for a small number of boundp symbols. The way I see it, there are two easy ways to do that: Store this ...
4
votes
1answer
118 views

Certain symbols resulting in really tall line (and cursor)

This one is honestly a bit of a mystery for me. The strange behavior is caused by the lambda symbol: the line goes to normal height if I remove the lambda. How can I get Emacs to display such ...