emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Teika Kazura <teika@gmx.com>
To: emacs-orgmode@gnu.org
Subject: I'm not subscriber, but want to send a code.
Date: Sun, 04 Feb 2024 08:59:14 +0900 (JST)	[thread overview]
Message-ID: <20240204.085914.1326911395214617651.teika@gmx.com> (raw)

Hi, list moderators.

I'd like to submit a code to this mailing list without subscribing it.

Or, if you can forward the following to the list.

Thanks a lot for keeping this list.
------------------------------------------------------------------------
[Wishitem] Show the current node name in the header line (w/ sample implementation)
-----------------------------------------------------------------------
Hi. The following code shows the current "node name" (outline header
name) in the emacs header line:
------------------------------------------------------------------------
(defun org-mode-show-node-in-header ()
  (setq header-line-format
        '(:eval
          (org-compute-node-name-for-header))))

(defun org-compute-node-name-for-header ()
  (let ((level 0)
        cur
        (str "")
        (nodes (org-get-outline-path t)))
    (while nodes
      (unless (eq level 0)
        (setq str (concat str " ")))
      (setq cur (car nodes))
      (put-text-property 0 (length cur) 'face (nth level org-level-faces) cur)
      (setq str (concat str cur))
      (setq level (1+ level))
      (setq nodes (cdr nodes)))
    str
    ))

(add-hook 'org-mode-hook #'org-mode-show-node-in-header)
------------------------------------------------------------------------
If you like, adopt it for org-mode. Feel free to modify.

Several things have to be considered.

1. It does not seem there's a fixed word for "node name" (outline
headers). I know there's the function "org-get-outline-path". OTOH the
info does never use the word "path" for this purpose. Nor does
outline-mode (of Emacs.)

2. It's better to implement it as a minor mode.

3. In the header line, my code shows the node names concatenated by
" " (a single space), but it can be turned into an option. Some people
may prefer e.g. " > ".

4. I use org-level-faces. I think it's ok. If users don't like it,
they can hack the code.

5. Maybe you want to ask emacs upstream to enable multiple headers /
multiple-line header. (I'm sure then you'll throw yourself into a
tough situation.)

Sorry that I can't help with none of these issues.

I got an inspiration of this post from
https://emacs.stackexchange.com/a/30901 , but I wrote the code on my
own, so there is no copyright problem. Still you may want to check other
answers there to improve this.

Please cc: to me. I'm not subscribing the org mailing list.

I'm so grateful for your work in org-mode.

Best regards,
Teika


             reply	other threads:[~2024-02-04  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-03 23:59 Teika Kazura [this message]
2024-02-04 16:43 ` I'm not subscriber, but want to send a code Ihor Radchenko
2024-02-05  5:12   ` Teika Kazura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240204.085914.1326911395214617651.teika@gmx.com \
    --to=teika@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).