Skip to main content

Questions tagged [string]

A string is a sequence of characters, which can be user data or used internally in Emacs. For example, string to search, replace, save in a register and so on, file name, etc.

Filter by
Sorted by
Tagged with
1 vote
1 answer
73 views

What's the difference between these two? (setq foo "bar") (setq foo 'bar)
Microsoft Linux TM's user avatar
0 votes
1 answer
32 views

I'm trying to setup a common lisp environment because I wanted to start learning it but been having some trouble setting it up. I noticed that spaces were the problem when I used debug-on-error and ...
The Programming M16A4's user avatar
1 vote
1 answer
112 views

I am using Doom Emacs on Windows. I prepare documents in LaTeX and have AUCTeX installed. I am using the minted package and would like doom emacs to simply insert a simple double quote to denote ...
1028's user avatar
  • 125
0 votes
0 answers
35 views

In programming modes anything between quotation marks can be made to use a specific face by a simple switch. (global-font-lock-mode t) This is so nice to have that I'd like to duplicate it in org-...
Sam7919's user avatar
  • 451
0 votes
2 answers
97 views

I have a string that can contain trailing spaces. For instance hello, I have spaces I wrote the following function to remove said spaces: (defun filter-last-spaces (text) (let* ( ...
Peter Petigru's user avatar
0 votes
1 answer
45 views

When I try to use a mapcar to extract the strings like (mapcar 'car evil-ex-history) it creates an error because of the # character preceding the list. Copying the expression, deleting the # character ...
vfclists's user avatar
  • 1,511
0 votes
1 answer
246 views

Windows 7, emacs 29.1 Is there a way to tell emacs to test for a null without entering a null in elisp? Putting a null anywhere in my elisp produces "Error: End of file during parsing". ...
punchcard's user avatar
1 vote
1 answer
333 views

Basically what the title says, I'm looking for the best way to remove all emojis from a string.
thanosapollo's user avatar
4 votes
2 answers
609 views

If I have a list, (“apple” “pear” “grape” “apricot”) how do I create a new list with elements starting with the letter “a”? The new list will be: (“apple” “apricot”).
zeynel's user avatar
  • 417
0 votes
0 answers
28 views

How can I programmatically set the same argument (e.g., --gpg-sign=abc123) for multiple transient-values? If I try the following, it seems that the value of adamliter/my-gpg-key-sign-git-arg does not ...
Adam Liter's user avatar
3 votes
1 answer
115 views

I noticed a rather peculiar behavior when using the display property (using emacs 28.2). I tried to boil things down to a minimal example: The code (defun finsert () (insert (propertize ".&...
dmw64's user avatar
  • 219
1 vote
2 answers
304 views

I'm looking for a function that can replace the nth-match in a string. Here's an example. 2 is the index of the nth-match, [0-9]+ is the regular expression to search. foo is the replacement and "...
Rodrigo Morales's user avatar
1 vote
0 answers
64 views

I hope "*ielm*"/eval-print-last-sexp print "\x80", but the result is ELISP> "😅\x80" "😅\200" ; Unicode characters should be displayed normally. My current ...
shynur's user avatar
  • 6,200
1 vote
1 answer
158 views

When using the propertize function alone on an entire string, it works. How to return a string, after changing its different sections separately with add-face-text-property (probably later repeatedly ...
Herman's user avatar
  • 77
0 votes
1 answer
150 views

The function looking-at matches a regex, in some cases however I want to match against a literal string. While (looking-at (regexp-quote text)) works, it seems like there might be a way to do this ...
ideasman42's user avatar
  • 9,513
2 votes
2 answers
248 views

Following this answer, I put the following lines in a .dir-locals.el file: ((latex-mode (TeX-engine . default) (mode . latex ) (TeX-master . "main") (ispell-buffer-session-localwords ...
tigerjack's user avatar
  • 175
0 votes
0 answers
44 views

I have following config for my org-roam: (use-package org-roam :ensure t :init (setq org-roam-v2-ack t) :custom (org-roam-directory "~/roamnotes") (org-roam-completion-everywhere ...
Garid's user avatar
  • 864
3 votes
1 answer
174 views

A string may hold a nil or default face text property, or its face text property is simply unspecified. E.g., #("void nil default" 0 4 ; unspecified () 5 8 ; nil face (...
shynur's user avatar
  • 6,200
-1 votes
1 answer
66 views

I want to insert this template: << prints("on_%s.gd:"%name, "msg: %s"%msg); >> How to convince emacs it's a string?
VanDeiMin's user avatar
1 vote
1 answer
52 views

In the GNU Emacs Lisp Reference Manual, 6.2 Arrays: In practice, we always choose strings for such applications, for four reasons: They occupy one-fourth the space of a vector of the same elements. ...
shynur's user avatar
  • 6,200
0 votes
1 answer
75 views

I want to be able to change a global keybinding by calling an Emacs function. The command in question is: gsettings set org.gnome.desktop.wm.keybindings switch-applications "['<Super>Tab']&...
Orixi's user avatar
  • 5
1 vote
1 answer
236 views

The "Advanced Search" Org mode tutorial on Worg provides the following example to find all entries with either "Walter" or "Evensong" in the author field: BIB_TITLE={...
Snelephant's user avatar
0 votes
1 answer
102 views

I want to understand why (when (string= issue "") (error "Issue number missing")) doesn't throw an error when issue is empty, but (when (= (length issue) 0) (error "...
Reverent Lapwing's user avatar
4 votes
3 answers
1k views

I want to check whether the string variable s is a number (integer or float) formatted as a string. I thought it could be done using string-to-number like this (defun string-number-base-p (s) (...
orgtre's user avatar
  • 1,170
0 votes
1 answer
99 views

I'm relatively new to Elisp and I'm trying to figure out a bug in my code, but I have no idea what to search or read in order to get an idea about it. The bug is in this code: (defvar some-variable &...
user5954246's user avatar
2 votes
1 answer
557 views

I want to generate very simple filenames from complex strings during a org-capture. For instance the string "Une idée nouvelle pour calculer $\\int_0^{\\infty} e^{-t^2} \\dd t$" Should be ...
B. Pillet's user avatar
1 vote
1 answer
126 views

I want to write a function that copies the current line from a buffer, but transforms it before in certain way. Specifically, I need to generate file names depending from lines of code. For example, ...
Alessandro Bertulli's user avatar
0 votes
1 answer
209 views

In a few functions I've written logic that does the following: (defun replace-in-region (str beg end) "Replace the region between BEG & END with STR." (save-excursion (goto-char ...
ideasman42's user avatar
  • 9,513
0 votes
2 answers
102 views

I want a function that can take a utf hexcode from the user, and use it to change the glasses-separator in glasses-mode. When I use completing-read using a list of hexcodes things for well and the ...
Dilna's user avatar
  • 1,473
5 votes
2 answers
3k views

I've seen the following warning from the Emacs 29 compiler: In s-format: s.el:614:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting) I haven't been ...
ocodo's user avatar
  • 1,297
2 votes
1 answer
97 views

I'm using read-string to read a string from the minibuffer, with an initial input. How can I highlight the initial input, so that I can start replacing it with one key stroke? IOW, given (read-string &...
Arch Stanton's user avatar
  • 1,856
0 votes
1 answer
413 views

I somewhat routinely need to convert an arbitrarily long string to hex, usually encoded as ascii or unicode. Is there a way to quickly and easily do this using vanilla Emacs? If not, is there a go to ...
holocronweaver's user avatar
0 votes
1 answer
40 views

The following code selects a string with two delimiters from the predefined list stored in delimiter-strings. The first delimiter being the opening bracketing mark, the second delimiter being the ...
Dilna's user avatar
  • 1,473
0 votes
1 answer
87 views

Would like to have a function that selects a string (from a list or from a user-defined string, using the mini-buffer) and a selected region. User would input (), [], {} specifying the opening and ...
Dilna's user avatar
  • 1,473
2 votes
1 answer
138 views

Does Emacs have an API for creating a character translation table which can then be efficiently applied to strings? A data structure for example that can be created using a set of source & ...
ideasman42's user avatar
  • 9,513
0 votes
1 answer
210 views

I am struggling to come up with a universal regexp that will remove/isolate all leading/trailing garbage from a multi-line string, leaving only the JSON. Without opening up a temporary buffer to re-...
lawlist's user avatar
  • 19.7k
2 votes
2 answers
408 views

I am working on a package that makes an API call and gets strings with improperly oriented curly quotes, e. g., The word ’syneresis’ comes from Greek roots meaning ’take’ and ’together’. Is there a ...
scribe's user avatar
  • 1,160
2 votes
1 answer
456 views

Here is what I want: (fill-string ";; This is a long string to be inserted into a buffer somewhere. Okay that's it.") This should insert line breaks according to the fill-column. Something ...
scribe's user avatar
  • 1,160
0 votes
1 answer
293 views

I'm learning writing Elisp functions to perform small tasks and get to a place where executing a function on the region will replace it with the value returned by the function. Below is a short ...
linuxfan's user avatar
  • 209
0 votes
0 answers
41 views

I'm trying to understand why text properties are overridden when creating a list inside a function. I'm wondering if it is expected or a bug. For example, if I create a list of fruits like this, each ...
Kafey's user avatar
  • 1
0 votes
1 answer
256 views

I am new to Emacs and I am reading Elisp guide inside Emacs. I am at the Args as Variable or list chapter. There is listed below code- (concat "The " (number-to-string (+ 2 value)) "...
deepanshu's user avatar
  • 141
0 votes
2 answers
82 views

I wanted to define a function that removes all spaces from a given string: (defun remove-whitespace (raw-string) (cl-reduce (lambda (acc char) (if (equal " " (char-to-string ...
Namudon'tdie's user avatar
0 votes
1 answer
714 views

I'm really confused about this issue since it should be doable, but i fail to understand it. I have some file with broken encoding (a pdf file, actually), which I copy some text from. When I paste ...
heinwol's user avatar
  • 101
0 votes
1 answer
106 views

I want to pass a buffer's content into a list. I figured out how to read the content of the buffer I want to use but cannot figure out how to correctly capture the content and then use it as a list. ...
Guillaume's user avatar
  • 209
6 votes
1 answer
2k views

I would like to convert these two strings "(a b c)" "(9 . 3)" to these (a b c) (9 . 3) I'd had some luck with the first one evaluating this, (mapcar 'intern (split-string (string-...
C11g's user avatar
  • 343
1 vote
1 answer
344 views

What is the "standard" way to store some text obtained from a buffer into a variable? The only way I could think of was to use something along the lines of (let ((beg (point))) (end-of-line) ...
Florian's user avatar
  • 271
2 votes
2 answers
522 views

The following function fails to return "16": (string-to-number "bm16") It seems to get tripped up if the first characters of a string aren't numbers. Is there a way to construct ...
George's user avatar
  • 969
0 votes
1 answer
170 views

What are best practices for handling long string literals in Emacs Lisp? E.g. (... stuff that causes indentation ... (error "`my-config-alist' mapped command `%s' to `%S' ...
kdb's user avatar
  • 1,591
2 votes
1 answer
146 views

I am trying to modify the string that is to yanked My goal is to modify certains paths before yanking, in order to transform them in relative to path actual buffer file. Following this post, I tried ...
user1683620's user avatar
1 vote
2 answers
250 views

The mode-line-format can be a list of strings, but it can also include un-evaluated blocks, e.g: (setq mode-line-format (list "Hello" '(:eval (my-function-call)) "There&...
ideasman42's user avatar
  • 9,513