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.
16
questions with no upvoted or accepted answers
5
votes
0
answers
148
views
Paired string delimiters?
Red and Rebol have multiline strings that start with { and end with }. Reading through Elisp docs I don't see any simple way to define this in the syntax table. The string quotes class matches the ...
4
votes
0
answers
312
views
truncate-string-to-width doesn't pad/print the string, as documented
I am referring the documentation for truncate-string-to-width from here.
It says,
(truncate-string-to-width "\tab\t" 12 4)
will output,
ab
But what i get in my machine (emacs versioned 25.1.50.1)...
3
votes
0
answers
139
views
Calculate current-column including display properties
I am trying to calculate the width of text within either a buffer or a string after it has been displayed, i.e. after taking into account the width of any display properties, such as embedded images, ...
2
votes
2
answers
308
views
Does Emacs have a builtin way to fix curly quotes' orientation?
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 ...
2
votes
0
answers
50
views
Collapse xml-node-children from `xml.el` into a string
An API I have used for years (via an elisp package)
recently started inserting formatting tags
(particularly for <i></i> italics)
into the 'ArticleTitle' field of entries.
The assumption ...
2
votes
0
answers
635
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
1
answer
196
views
replace nth-match of a regexp in a string
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 "...
1
vote
0
answers
40
views
print hex-code in string
I hope "*ielm*"/eval-print-last-sexp print "\x80", but the result is
ELISP> "😅\x80"
"😅\200" ; Unicode characters should be displayed normally.
My current ...
1
vote
0
answers
61
views
Emacs freezes when using split-string in recursive function
I'm trying to figure out why my emacs keeps freezing when running this set of functions to split a string into a list of pairs. Is there some significant overhead happening when using string-split? Is ...
1
vote
0
answers
43
views
Cperl font lock regions in here docs
I am having a problem in cperl-mode described in this question. Basically inserting a newline at the start of a line in here doc in cperl-mode is breaking the syntax highlighting. One of the answers ...
0
votes
0
answers
9
views
Centering strings depending on the font size/face height
I'm using this function to center strings inside a window:
(defun center-string (input-string &optional center?)
"Center each line of the given INPUT-STRING in the current window width.
...
0
votes
1
answer
148
views
How to replace the region text with the text of a string, without deleting and reinserting parts that are the same
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 ...
0
votes
0
answers
34
views
Why text properties are overridden in this context?
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 ...
0
votes
0
answers
38
views
Extract year from different date strings in alist
I have a function that tries to extract the year from date strings stored in an alist below:
(setq entry
'(("date" . "1998/03")
("origdate" . "1930")))
(...
0
votes
0
answers
68
views
How can I get my target string point/marker without moving the pointer?
Lets say I have the following LaTeX code:
\ref{AAA}, \ref{BBB} ... \ref{BBB,CCC,DDD}
\begin{the bibliography}{99}
\bibitem{AAA}
\bibitem{BBB}
and I want to write a function that does:
(perform-...
0
votes
0
answers
134
views
Get emacs to read unquoted strings in json
I am trying to use emacs-lisp to interact with a MongoDB. Here is an example of a string that mongo returns, that emacs cannot read. The problem is the unquoted ObjectId and ISODate items (if I put ...