Questions tagged [format]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Printing formatted args in a buffer

I have the following function that prints some text in a buffer. But it is not very flexible because it does not accept a format string as message does. How can I change it so that one can use a ...
Dilna's user avatar
  • 1
0 votes
0 answers
204 views

Doom Emacs AsciiDoc syntax highlighting?

I want to write AsciiDoc documents in Emacs (more specifically Doom Emacs) with syntax highlighting. I've tried: Adding (package! adoc-mode) to the bottom of ~/.doom.d/packages.el . Adding adoc-mode ...
01AutoMonkey's user avatar
2 votes
1 answer
298 views

How can I construct a bash-safe filename from a string?

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
2 votes
0 answers
135 views

Emacs how to hide globally the mode line

I try to find a way to hide or disable globally the kind of status bar displayed below each window (called mode line). I use hide-mode-line package to hide the mode line in some major modes like prog-...
Michel Lecomte's user avatar
0 votes
1 answer
29 views

Print the contents of a list next to each other

I want to print the contents of a list and I am doing (message "%S" mylist) The result is (#("/home/hagbard/ergomax.org" 0 7 (fontified t)) #("/home/hagbard/wordy-english.org&...
Dilna's user avatar
  • 1
0 votes
2 answers
293 views

Output the VAR name and its VALUE

I defined these variables/functions: (defvar FirstVar-p nil "DOCSTRING") (defun toggle-first-var () "DOCSTRING" (interactive) (setq FirstVar-p (not FirstVar-p))) (defvar ...
Gabriele's user avatar
  • 1,554
0 votes
0 answers
544 views

Changing dimensions of plot in orgmode: #+attr_org: :width 160px

When wanting to change a plot in Orgmode with #+attr_org: :width 160px. Is there a way to individually specify height as well such as #+attr_org: :weight 160px :height: 300px? This does not set the ...
Emmanuel Goldstein's user avatar
0 votes
1 answer
196 views

How to insert the result of evaluating a sexp in a string?

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
1 vote
1 answer
289 views

Percentage sign in `print` and `message`

I am trying to output Humidity: 42% using both functions print and message. While print has no problem with the literal percentage sign, message throws a "Format string ends in middle of format ...
foobar's user avatar
  • 31
3 votes
2 answers
300 views

how to turn off all the formatting and all?

When I load some log files (50mb) When it has long json contents, emacs becomes unbearably slow. Note the log file is simply text file which happened to have json content. So json mode is not on. Is ...
eugene's user avatar
  • 489
0 votes
0 answers
24 views

Output formatting of system call

Playing around with some uuid generation code, I found this (defun get-random-uuid () (interactive) (with-temp-buffer (call-process "uuidgen" nil t nil) (buffer-substring-no-...
147pm's user avatar
  • 2,969
2 votes
2 answers
320 views

Representing leading zeroes in a list

I would like to have this table #+NAME: addition-table | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |---+----+----+----+----+----+----+----+----+----+----| | 0 | 00 | 01 | 02 | 03 | 04 | ...
147pm's user avatar
  • 2,969
1 vote
1 answer
350 views

european-calendar-style not working

I have the following in my init.el file: (setq org-agenda-span 36) (setq org-agenda-start-on-weekday 1) (setq european-calendar-style t) However, diary blocks are still interpreted as month first, ...
Zelphir Kaltstahl's user avatar
0 votes
1 answer
1k views

clang-format malfunctioning(?) Or am I not fully understanding how clang-format works?

I installed the clang-format package from melpa. I then added the following lines to my init file: (require 'clang-format) I then created a test directory, cpp-proj with one file, main.cpp. main....
John DeBord's user avatar
2 votes
1 answer
120 views

Why does (format "%x" some-large-number) produces incorrect results?

I wanted the hexadecimal string for a large integer such as below: (format "%x" 2738188573457603759) This returns 2600000000f95c00 which is incorrect, it should be 2600000000f95caf. The value of ...
David Sitsky's user avatar
1 vote
3 answers
134 views

How can I convert a list of integers to a string?

Let's say I have a list of integers, representing year, month, day for a date: (2017 8 21) and I want to format the list in one function call, as in (format "%04d-%02d-%02d" 2017 8 21) Is there an ...
Niclas Börlin's user avatar
1 vote
2 answers
800 views

Emacs lisp format doesn't print to *scratch*?

I've got this function (defun mt () (dotimes (x 20) (dotimes (y 20) (format "%3d " (* (1+ x) (1+ y)))) (format "\n"))) in my *scratch*. a Ctr-= prints back mt. But then ...
147pm's user avatar
  • 2,969
2 votes
1 answer
2k views

Percentage "%" in format string

(format "Hard-coded value is 100\% and the variable is %s" "50\\%") Returns Debugger entered--Lisp error: (error "Invalid format operation %a") format("Hard-coded value is 100% and the variable is ...
yPhil's user avatar
  • 983
0 votes
1 answer
3k views

Auto format messy code

I am currently learning C++ and I am in the process of configuring Emacs as my C++ IDE. I am reading a PDF guide and copying code into my Emacs buffer. However upon pasting the code the formatting is ...
Us3rname's user avatar
1 vote
0 answers
213 views

Better display of local time in message-insert-formatted-citation-line?

The default behavior in emacs-25 for the following code is for message citation lines to display the time in UTC, even if (current-time-zone) returns a local time zone such as (-18000 "EST"), and even ...
HippoMan's user avatar
  • 616
2 votes
1 answer
102 views

How to escape % in emacs

I'm trying to add a search engine in emacs-w3m and use duckduckgo to search emacswiki (eval-after-load "w3m-search" '(progn (setq w3m-search-engine-alist (append '( ...
DJJ's user avatar
  • 762
1 vote
1 answer
507 views

How to format (print) output of the shell-command function

I have this (defun insert-dateutc () (interactive) (shell-command "printf %s $(date +\"%Y-%m-%dT%H:%M:%S\")" t)) which I want to use in this (defun foo1 () (format "this is the date-time %s" (...
147pm's user avatar
  • 2,969
1 vote
2 answers
3k views

customize the clang format

I know I can create a .clang-format file, and use this per project, but what I'd really like is a way to set the default clang-format style to one of the available formats, so I can experiment with ...
Spacemoose's user avatar
15 votes
5 answers
2k views

Named string substitution?

I often have to make several substitution of the same string: (format "%s %s %s" "a" "a" "a") ;; gives: "a a a" (it's just a dummy example, in this case it's better to glue "a" with a whitespace, ...
Adobe's user avatar
  • 1,869