20

Is it possible to replace '\emsp' with just plain spaces?

I.e, In Clock reports, there are a lot of these '\emsp's. (See example below.)

I'm able to get rid of them by setting ':indent nil'. But this removes all indent altogether, which is undersirable. I can also get rid of them if I export things. But in the Agenda view I don't export reports and the \emsp's are just a visual distraction.

So far I was able to remove 'TODO' keywords via formatter as described here. But the formatter doesn't seem to see the '\emsp' and can't remove them. It kinda seems like they are added after.

|-----------+-------------------------------------------------------------------+---------+------|
| dev.org   | *File time*                                                       | *9:54*  |      |
|           | Dev                                                               | 9:54    |      |
|           | \emsp Configure VMs for testing [[elisp:(my/goto-parent)][parent]]                            |         | 5:03 |
|           | \emsp test if DND works in outline view in Mars (4.5) Build id: I20150217-0800 has outline view fixed (RHBZ#1012336). |         | 0:16 |
|           | \emsp GtkMenuItem directly instead of GtkImageMenuItem            |         | 1:28 |
|           | \emsp Bug 459487 - [GTK] Replace deprecated gtk_arrow_* with gtk_image |         | 1:31 |
|           | \emsp General                                                     |         | 1:36 |
Leo Ufimtsev
  • 4,488
  • 3
  • 22
  • 45
  • Boutros' answer is correct, just be sure not to put it in a file called `org-table.el`, or your tables will explode. – Dr Bombay Jun 05 '15 at 19:02

2 Answers2

27

This is a bug, IMO. Someone complained that the old indentation markers upset table layout in latex output so someone replaced them with these latex instruction. Now of course it is a mess on screen.

I thought the new prettify-symbols-mode might be a handy way to switch out the \emsp for something else, but that can only replace with a single character and it upsets the layout of the table due to the changing width.

So there's nothing for it but to redefine the indentation code:

(defun my-org-clocktable-indent-string (level)
  (if (= level 1)
      ""
    (let ((str "^"))
      (while (> level 2)
        (setq level (1- level)
              str (concat str "--")))
      (concat str "-> "))))

(advice-add 'org-clocktable-indent-string :override #'my-org-clocktable-indent-string)

Change the indent markers to taste.

  • Too bad about the inconsitencies. It would be nice to have it fixed someday. The function above does fix things for me, thank you for posting. – Leo Ufimtsev Feb 24 '15 at 20:14
  • It looks like I need emacs 24.4 to get this working. Le me upgrading from Fedora 20 to 21. – Leo Ufimtsev Feb 25 '15 at 04:52
  • Works in Emacs 24.4 – Leo Ufimtsev Feb 26 '15 at 15:26
  • 1
    this is basically fixed in org-mode 8.3, so you can reuse that function instead: http://orgmode.org/cgit.cgi/org-mode.git/tree/lisp/org-clock.el#n2685 – anarcat May 05 '16 at 01:03
  • I’m using this with ╰ as initial marker and ─ instead of dashes (M-x insert-char BOX DRAWINGS LIGHT ARC UP AND RIGHT and BOX DRAWINGS LIGHT HORIZONTAL). It looks pretty good - thank you! `╰─> E-Mails lesen` – Arne Babenhauserheide Dec 21 '17 at 13:59
4

The manual on Special Symbols says

If you would like to see entities displayed as UTF-8 characters, use the following command:

C-c C-x \

Toggle display of entities as UTF-8 characters. This does not change the buffer content which remains plain ASCII, but it overlays the UTF-8 character for display purposes only.

You can turn this on by default by setting the variable org-pretty-entities, or on a per-file base with the option #+STARTUP: entitiespretty.

Bae
  • 212
  • 1
  • 10