Giter Site home page Giter Site logo

org-modern's Introduction

Modern Org Style

GNU Emacs GNU ELPA GNU-devel ELPA MELPA MELPA Stable

Introduction

This package implements a modern style for your Org buffers using font locking and text properties. The package styles headlines, keywords, tables and source blocks. The styling is configurable, you can enable, disable or modify the style of each syntax element individually via the org-modern customization group.

https://github.com/minad/org-modern/blob/screenshots/example.gif?raw=true

The screenshots shows example.org with org-modern-mode turned on and off. The elegant theme featured in the screenshot is modus-operandi.

Since this package adjusts text styling, it depends on your font settings. You should ensure that your variable-pitch and fixed-pitch fonts combine harmonically and have approximately the same height. As default font, I recommend variants of the Iosevka font, e.g., Iosevka Term Curly. org-modern-mode tries to adjust the tag label display based on the value of line-spacing. This looks best if line-spacing has a value between 0.1 and 0.4 in the Org buffer.

Configuration

The package is available on GNU ELPA and MELPA. You can install the package with package-install. Then org-modern can be enabled manually in an Org buffer by invoking M-x org-modern-mode. In order to enable org-modern for all your Org buffers, add org-modern-mode to the Org mode hooks.

;; Option 1: Per buffer
(add-hook 'org-mode-hook #'org-modern-mode)
(add-hook 'org-agenda-finalize-hook #'org-modern-agenda)

;; Option 2: Globally
(with-eval-after-load 'org (global-org-modern-mode))

Try the following more extensive setup in emacs -Q to reproduce the looks of the screenshot above.

;; Minimal UI
(package-initialize)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(modus-themes-load-operandi)

;; Choose some fonts
;; (set-face-attribute 'default nil :family "Iosevka")
;; (set-face-attribute 'variable-pitch nil :family "Iosevka Aile")
;; (set-face-attribute 'org-modern-symbol nil :family "Iosevka")

;; Add frame borders and window dividers
(modify-all-frames-parameters
 '((right-divider-width . 40)
   (internal-border-width . 40)))
(dolist (face '(window-divider
                window-divider-first-pixel
                window-divider-last-pixel))
  (face-spec-reset-face face)
  (set-face-foreground face (face-attribute 'default :background)))
(set-face-background 'fringe (face-attribute 'default :background))

(setq
 ;; Edit settings
 org-auto-align-tags nil
 org-tags-column 0
 org-catch-invisible-edits 'show-and-error
 org-special-ctrl-a/e t
 org-insert-heading-respect-content t

 ;; Org styling, hide markup etc.
 org-hide-emphasis-markers t
 org-pretty-entities t

 ;; Agenda styling
 org-agenda-tags-column 0
 org-agenda-block-separator ?─
 org-agenda-time-grid
 '((daily today require-timed)
   (800 1000 1200 1400 1600 1800 2000)
   " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄")
 org-agenda-current-time-string
 "◀── now ─────────────────────────────────────────────────")

;; Ellipsis styling
(setq org-ellipsis "")
(set-face-attribute 'org-ellipsis nil :inherit 'default :box nil)

(global-org-modern-mode)

Alternatives

The tag style of org-modern is inspired by Nicholas Rougier’s beautiful svg-tag-mode. In contrast to svg-tag-mode, this package avoids images and uses cheap and fast Emacs box text properties. By only styling the text via text properties, the styled text, e.g., dates or tags stay editable and are easy to interact with.

The approach restricts our flexibility and may lead to font-dependent issues. We do our best, but for example there is no way we can get round corners. Combining org-modern-mode with svg-tag-mode is possible. You can use SVG tags and use the table and block styling from org-modern. If you are interested in further tweaks, Emacs comes with the builtin prettify-symbols-mode which can be used for individual styling of custom keywords.

Popular alternatives are the older org-superstar and org-bullets packages, which have are more limited and mainly adjust headlines and lists. org-superstar relies on character composition, while org-modern uses text properties, which are considered more future-proof. Note that org-modern is a full replacement for both org-superstar and org-bullets. You can easily disable styling of certain elements, e.g., org-modern-timestamp, if you only want to use a subset of org-modern.

Contributions

Since this package is part of GNU ELPA contributions require a copyright assignment to the FSF.

org-modern's People

Contributors

9viz avatar alphapapa avatar minad avatar roygbyte avatar shouya avatar tecosaur avatar vladontheroad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

org-modern's Issues

org-modern-agenda does not find all keywords in custom agenda views

Hello Daniel!

On my end (Emacs 29) the org-modern-agenda does not work as intended
for entries in the org-agenda-custom-commands. You can try it with
the default C-c a n sequence (agenda and all TODOs).

The problem is that the org-done-keywords-for-agenda and
org-todo-keywords-for-agenda are not set properly. For my custom
views, both remain nil. For C-c a n only the org-done-keywords
captures the relevant words.

Invisible horizontal rule

I'm on the latest revision of the emacs and for some reason, the horizontal rule is not visible. Here is how I did configure the package.

I can confirm that I don't see a horizontal rule even when using the minimal config listed in the README.md.

Config

(use-package! org-modern
  :custom
  (org-modern-horizontal-rule t)
  (org-modern-keyword ">")
  (org-modern-table-vertical 1.0)
  (org-modern-star ["I" "II" "III" "IV" "V" "VI" "VII" "VIII"])
  (org-modern-todo-faces
   '(("DOING" :background "orange"))))

(defadvice! org-modern--update-label-face-override ()
  :override #'org-modern--update-label-face
  (set-face-attribute 'org-modern-symbol nil :family "Iosevka")
  (set-face-attribute org-modern-variable-pitch nil :family "Iosevka Aile")
  (set-face-attribute 'org-modern-horizontal-rule nil :inherit 'italic :box 1)
  (set-face-attribute 'org-modern-tag nil :inherit 'italic :box 1)
  (set-face-attribute
   'org-modern-label nil
   :inherit org-modern-variable-pitch
   :box (list :color (face-attribute 'default :background nil t)
              :line-width -3)))

(add-hook! org-mode org-modern-mode)

Demonstration

MyScreenCast.mp4

Additional info

generated    Jun 05, 2022 12:07:43
system       Pop!_OS 22.04 LTS Linux 5.17.5-76051705-generic x86_64 x
emacs        29.0.50 master e74652386 ~/.emacs.d/ -> ~/.emacs.d/
doom         3.0.0-dev grafted, HEAD -> master, origin/master, origin/HEAD bea3cc1 2022-06-04 15:02:06 +0200 ~/.doom.d/ -> ~/.doom.d/
shell        /bin/zsh
features     CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ IMAGEMAGICK JPEG JSON LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
traits       gui server-running envvar-file custom-file
custom       connection-local-profile-alist connection-local-criteria-alist package-selected-packages
modules      :completion (ivy +icons +prescient) company :ui deft doom doom-quit (emoji +unicode) hl-todo ophints (popup +defaults) vc-gutter workspaces ligatures :editor (evil +everywhere) fold multiple-cursors snippets :emacs (dired +icons) electric ibuffer undo vc :term vterm :checkers syntax :tools direnv editorconfig (eval +overlay) gist (lookup +dictionary +docsets) lsp (magit +forge) make rgb upload :os tty :lang (clojure +lsp) data emacs-lisp json (javascript +lsp) markdown nix (latex +latexmk +cdlatex +fold) (org +dragndrop +gnuplot +pomodoro +roam2) (sh +zsh) (web +css +html) (yaml +lsp) :config (default +bindings +smartparens)
packages     (hl-line :disable t) (websocket) (mermaid-mode) (posframe) (org-roam-ui :recipe (:host github :repo org-roam/org-roam-ui :files (*.el out))) (org-modern :recipe (:host github :repo minad/org-modern)) (org-ref) (ob-mermaid) (yaml-mode) (polish-holidays :recipe (:host github :repo mikolajb/emacs-polish-holidays))

Issue when narrowing is in effect

Consider this buffer:

** A
^L
** B

Then, at the beginning of buffer, type

  • C-x n p (narrow to page)
  • M-x org-modern-mode (to activate)
  • C-u 1 C-x n p (narrow to next page)
  • M-x org-modern-mode (to deactivate)
  • C-x n w (widen)

Then the headline B will not be styled when org-modern-mode is activated and headline A will not be destyled when org-modern-mode is deactivated.

emacs -Q example doesn't run

If I start emacs with emacs -Q, and then run the code in the emacs -Q example, I get the error:

eval-buffer: Symbol’s function definition is void: modus-themes-load-operandi

Someone new to emacs will be confused by that.

Tables' cells not aligned

I am getting wrong formatting on the tables, the lines are not aligned, looks pretty ugly. Any idea how to fix it?

Bullet points

I think an en-dash looks better than the box drawing character as a replacement for hypen-minus in org-modern-list.

How to increase the size of timestamps and tags?

Hi!

I have this config in doom

(setq doom-font (font-spec :family "Hack" :size 13)
      doom-variable-pitch-font (font-spec :family "Roboto" :size 13)
      doom-unicode-font (font-spec :family "Hack")
      doom-big-font (font-spec :family "Hack"))

When I load org-modern all the timestamps and tags look extremely small which is hard to see.

image

This is the normal state for comparison
image

How could I increase the font size in the “modernized” parts?

Thanks.

temporary outdent of previous line when editing

I'm seeing a weird display artifact when I edit the bottom line (item two) in the below example:

* header
*** item one
*** item two

In this case, after every single edit of the "item two" line, the indent for item one vanishes (i.e. the whole line shifts left), and then is restored to the correct position about one second later.

Some stylistic tweaks

Good day Daniel!

Some ideas for this package after a few days of using it with its
current defaults:

  • Make variable-pitch optional.
  • Apply a bespoke face to priorities (even if you keep it empty). I would
    personally add a faint warm background to contrast both with the TODO
    and the tags.
  • The default values for org-modern-priority do not work well with all
    fonts. In my config I switched them to Greek letters. The extra face
    would allow me to visualise them as "buttons" like the other elements.

No table styling in example blocks?

Hi,

As far as I understand, literal example blocks in org-mode (#+begin_example) are meant for text that does not receive any markup. However, org-modern renders a "column" of pipes like

  |
  |
  |

as if it was part of a table (i.e. with a solid vertical line), even in literal example blocks. Is this the intended behavior?
Thanks for the great package(s)!

Scope of org dynamic block "columnview" is not being taken into account when org-modern-mode is enabled

Hello!

When I update my columnview dblock with org-modern enabled, it doesn't take into account the :id local option, so it inputs all the headings in the whole file. Deactivating org-modern-mode makes :id local work again.

Steps to reproduce

  1. Add a columnview dblock under a headline that has items underneath. Mine is:
    #+BEGIN: columnview :format "%TODO %ITEM %CLOCKSUM{:} %EFFORT{:}" :id local
    #+END: columnview
  2. Update it at point (C-c C-x C-u)
  3. Deactivate org-modern-mode and update it again.

Thanks!

keep spaces before code block first and last line with "#+"

Hi, thanks for this package. I have been using this for quite a well and it proved stable and beautiful.
However, when inserting source block below a plain list item, I noticed that the spaces before the displayed "src" are made invisible.
In my opinion, spaces should be kept to maintain indentation consistency.

To reproduce

- item
  #+begin_src python
    print("hello")
  #+end_src

Put this in an org file and activate org-modern-mode to see that spaces before #+ disappear and space before the code stays.

Error when running org-todo

When I type C-c C-t to run org-todo, in order to add TODO to a header, I get the following error:

org-entry-get-with-inheritance: Symbol’s value as variable is void: org-property-separators

This works fine when org-modern is not loaded.

global-hl-line-mode on obscures hour and minute part of the timestamps

Hello @minad,
Thank you for such a wonderful package. Org does look great with your package! Kudos to you!

One minor niggle I faced was with the global-hl-line-mode set to t.

image

When I take the cursor to the line with the timestamps
image

I work with modus-operandi as my theme. AFAIK, I have customized the variable-pitch faces.

Please let me know if you need any other info from me to help solve this for us.

Thanks and have a nice day!
Bala

cannot change timestamps after creation

The nicely rendered date+timestamp blocks now act as a single character that the cursor jumps over, so I can no longer shift + up arrow to increment the hours/minutes/day anymore. Is there a way to still allow this while rendering it nicely? Or otherwise disable the fancy rendering temporarily when point is on it, like what org-appear does?

Missing ends on top and bottom of src block brackets

In the introduction screenshot on the readme.org page, the bracket next to src blocks looks like a tall [ character with corners on the top and bottom. However, I'm seeing this rendered without the corners on the top and bottom: more like a tall | character.

I tried looking for a way to customize this without success. So I next tried running the provided emacs -Q minimum setup code to reproduce this kind of image, and found the same problem: with these brackets still looking like | rather than [.

I'm using GNU Emacs 28.1 on a Mac... and will be interested to hear if there are other variables that might account for this difference. Or if there is anything that I can try doing to change these |s into [s, I'll be interested to hear. Thanks.

use org-todo-keywords-faces

org-mode already has a variable to define the color of the TODO keywords faces: org-todo-keywords-faces; it would be nice to use that if org-modern-todo-faces is nil

Fonts known to work

Reading through the documentation, it seems font choice is important. Might be nice to add section to read me or a wiki page of fonts known to work well.

Just a thought. Have not tried out the package myself.

Pixel-alignment of Org tables

Hello Daniel!

There is an issue with aligning tables when a cell includes a time
stamp. This is particularly common with clock tables. Those basically
are what you get when you keep track of how much time you spend on a
task.

2022-02-23_21:38:46_576x576

2022-02-23_21:38:59_576x576

Here is a demo file with such a report:

* DONE Testing the thing
CLOSED: [2022-02-23 Mon 18:10] SCHEDULED: <2022-02-23 Mon 17:22>
:LOGBOOK:
- State "DONE"       from "TODO"       [2022-02-23 Mon 18:10]
CLOCK: [2022-02-23 Mon 17:23]--[2022-02-23 Mon 18:10] =>  0:47
:END:

* DONE Another test
CLOSED: [2022-02-23 Mon 15:03] SCHEDULED: <2022-02-23 Mon 14:41>
:LOGBOOK:
- State "DONE"       from "TODO"       [2022-02-23 Mon 15:03]
CLOCK: [2022-02-23 Mon 15:03]--[2022-02-23 Mon 16:08] =>  1:05
:END:



#+BEGIN: clocktable :formula % :timestamp t :sort (1 . ?a) :link t :tstart "<-1m>" :tend "<now>" :scope nil
#+CAPTION: Clock summary at [2022-02-23 Wed 21:37]
| Timestamp              | Headline          |   Time |     % |
|------------------------+-------------------+--------+-------|
|                        | *Total time*      | *1:52* | 100.0 |
|------------------------+-------------------+--------+-------|
| <2022-02-23 Mon 14:41> | [[file:/home/prot/testing.org::*Another test][Another test]]      |   1:05 |  58.0 |
| <2022-02-23 Mon 17:22> | [[file:/home/prot/testing.org::*Testing the thing][Testing the thing]] |   0:47 |  42.0 |
#+END:

[ There is also the double hyphen between timestamps, but we can check
that separately. ]

[FEATURE REQUEST] Keep the space before styled source blocks

When without org-modern, the source blocks which has spaces ahead, it shows the indentation. it looks likes this:

image

But after enabled org-modern-mode, the indentation spaces are gone.

image

Hope org-modern can keep the indentation spaces.

I really like org-modern, really awesome work. Thanks very much. @minad

[SOLVED] Keep a little org heading indentation

I suggest to keep a little indentation space before org heading stars.

(defun org-modern--star ()
  "Prettify headline stars."
  (let ((level (- (match-end 1) (match-beginning 1))))
    (put-text-property
     (match-beginning 2)
     (match-end 2)
     'display
     (concat (make-string level ?\ )
             (aref org-modern-star (min (1- (length org-modern-star)) level))))))

Here is it looks like:

image

Breaks org-table-toggle-coordinate-overlays

The command org-table-toggle-coordinate-overlays (accessible from C-c }) doesn't work well with org-modern.

If we start from this table:
2022-04-20-133147

and activate the coordinate overlays, we get:

2022-04-20-133134

As you can see:

  1. columns don't display their coordinates ($1, $2 and $3)
  2. the horizontal rule doesn't display its coordinate (I*1)
  3. the horizontal rule has moved to a weird place

Here is the result without org-modern:

2022-04-20-133203

Share theme and frame/font configuration in README

The example GIF looks to beautiful to be true :) When I turn on org-modern-mode, I don't get as nice source block highlights and my variable pitch font doesn't play as nicely with the "pills" for TODO states and dates etc.

@minad Could you share the relevant config to replicate your GIF's look in an additional .el file or in the README?

Fixed pitch for labels

Hi, thanks for this package, makes life much beautiful! :)

What is the best way to disable the use of variable pitch for modern style labels? My variable pitch font (ETBembo) is too convoluted for labels, and I'd like labels to stay fixed width...

Can't install

Hello.

I was trying to install org-modern via use-package (as well as the emacs' package-install), but got an error message:

Debugger entered--Lisp error: (file-error "http://melpa.org/packages/org-modern-20220325.1506..." "Not found")

Is this package still available?

EDIT: the error I got when tried package-install
image

Question on your org mode config

I have a little question that has little to do with the package:
In your gif example, there is a character that is at the beggining and end of the content of the buffer:
pic

What package or piece of code do you use for that? It looks cool, I would be happy to add that to me config.

org-modern-priority: Use different characters by default? (NEGATIVE CIRCLED LATIN CAPITAL LETTERS are not widely supported)

The variable Org Modern Priority prints garbage, maybe because my machine lacks a necessary fonts, but which?

C-h v org-modern-priority, customize:

Hide Org Modern Priority:

Alist:

INS DEL Character: A String: 🅐

INS DEL Character: B String: 🅑

INS DEL Character: C String: 🅒

INS

State : STANDARD. List of priority label replacements. Hide Set to nil to disable styling priorities. Groups: Org Modern

I've seen that your example uses letters in a circle for priorities, but how to get them?

Pixel Perfect Alignment on roadmap?

In the System Crafters video about your packages you mentioned maybe implementing pixel perfect alignment. I was curious so I came here to search for an issue and found you mentioned it in #5, but there's no issue for it alone.

So I'm creating this issue to ask for myself and any future interested parties. It's fine if the answer is "no, this is wayyy to difficult and not worth it", thanks for this awesome package.

aside: I was trying to create something similar using the nano icons that came out and I stopped because of how much of a pain handling all the cases were, so I very much appreciate such a simple package that improves QoL so much 😄

org-modern-mode breaks org-indent-mode

Hi, first of all, thanks for the great package.

I found that the org-modern-mode breaks the org-indent-mode. Here is a screenshot of an org-mode buffer with org-indent-mode being t and org-modern-mode being nil.

image

Then if I set org-modern-mode to t, it becomes this. Note that the indentation disappeared (org-indent-mode is still t).

image

More strangely, when I edit the buffer, the indentation got on and off unpredictably.

image

Is this a bug?

line-spacing is not restored

Hello Daniel. Congratulations for doing this and thanks for sharing!

Basically what the title says: org-modern-mode does not restore the line-spacing after it is disabled.

Issue with additional components of deadline date display

Org datestamps can include components that control when an item appears on the agenda, such as DEADLINE: <2022-03-07 Mon -0d> (which says that the item should not appear until the very day it's due). org-modern seems to get tripped up by such things. At least, the display doesn't treat that component the way I would have expected (probably just with one styling for the entire datestamp). See screenshot.

Screen Shot 2022-03-05 at 08 25 25

"Left-over" text with "timed" timestamps when using custom format

Good day, Daniel.

Org-modern seems to have trouble fontifying "timed" dates with a
non-default org-time-stamp-custom-formats when in the Tamil locale
environment. To reproduce,

  1. emacs -Q
  2. M-: (setq org-time-stamp-custom-formats '("<%A, %d %B, %Y>" . "<%A, %d %B, %Y %H:%M>") org-display-custom-times t)
  3. C-x b org RET M-x org-mode RET
  4. <visit org-modern.el and M-x eval-buffer, switch to org buffer>
  5. M-x set-locale-environment RET ta_IN.utf8 RET
  6. C-c ! 7pm RET and see the rightly shaped text
  7. M-x org-modern-mode

After step 7, the timestamp has a diacritic character left over in the
light grey box so there's an off-by-one error somewhere? See
screenshot at http://0x0.st/oNgk.png

The diacritic character is always from the first letter; in the
screenshot, it is: பு (ப + ு).

The default timestamp format has no such problems.

EDIT: The problem has nothing to do with the locale. If I use the en_GB.utf8 locale, the "left-over" text is "d", and the left-over text always seems to be the third character of the weekday.

add other org-modern styles to org-agenda?

Currently it seems that only the todo-keywords (TODO, NEXT, etc.) and progress indicators ([4/6]) are styled when I look at the org-agenda, while the priority cookies ([#A], [#B], etc.) and the tags (e.g. :Work:@computer:) are not.

Did I miss any user options or make some other mistake? My config is basically:

  (use-package org-modern
    :after org
    :config (global-org-modern-mode))

;; with some of this
(defface org-todo-next
    ;; face config
    )

;; and then this
(setq org-modern-todo-faces
  '(("NEXT" . org-todo-next)
    ("WAIT" . org-todo-wait)
    ; ...
   ))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.