Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve a name of the frame in Emacs?

Tags:

emacs

elisp

I'd like to retrieve a name of the current frame using elisp. I have discovered that name is a part of frame's properties. The properties is an associated list. I do the following:

(cdr (assoc 'name (frame-parameters)))

But instead of the expected name I receive a mixed list of the name and some properties:

#("main-1" 0 5 (face nil) 5 6 (face nil))

How can I extract "main-1" from this?

like image 529
zweibaranov Avatar asked Jan 17 '26 00:01

zweibaranov


1 Answers

There are text properties on that string. You can use substring-no-properties to extract the plain string.

(substring-no-properties
 (cdr (assoc 'name (frame-parameters))))

Note that you may not need to do this. The propertized string is still a string, and equal to its no-properties version.

See also: C-hig (elisp) Text Props and Strings RET

like image 88
phils Avatar answered Jan 19 '26 17:01

phils



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!