emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* I'm not subscriber, but want to send a code.
@ 2024-02-03 23:59 Teika Kazura
  2024-02-04 16:43 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Teika Kazura @ 2024-02-03 23:59 UTC (permalink / raw)
  To: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: I'm not subscriber, but want to send a code.
  2024-02-03 23:59 I'm not subscriber, but want to send a code Teika Kazura
@ 2024-02-04 16:43 ` Ihor Radchenko
  2024-02-05  5:12   ` Teika Kazura
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-02-04 16:43 UTC (permalink / raw)
  To: Teika Kazura; +Cc: emacs-orgmode

Teika Kazura <teika@gmx.com> writes:

> ------------------------------------------------------------------------
> [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:
> ...

Thanks for the suggestion!
Have you seen org-eldoc.el library (a part of org-contrib)?
It provides a similar functionality using eldoc-mode.

By default, eldoc-mode uses echo area to display the breadcrumbs.
However, you may customize `eldoc-display-functions' to display the
breadcrumbs in header line.

eldoc-mode allows multiline messages.

> If you like, adopt it for org-mode. Feel free to modify.

You might also be interested in https://github.com/joaotavora/breadcrumb

I believe that the proposed functionality is already covered by either
org-eldoc.el or breadcrumb.el. So, we do not need to re-implement it
within Org mode.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: I'm not subscriber, but want to send a code.
  2024-02-04 16:43 ` Ihor Radchenko
@ 2024-02-05  5:12   ` Teika Kazura
  0 siblings, 0 replies; 3+ messages in thread
From: Teika Kazura @ 2024-02-05  5:12 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Ihor. (... мабуть привіт or привет?)

Thanks a lot for your kind, detailed reply. Yep, you've convinced me
totally!

There's an (old) question about this in emacs.stackexchange:
https://emacs.stackexchange.com/q/30894
Now I posted a summary of your reply. :)

All the best,
Teika

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-05  5:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-03 23:59 I'm not subscriber, but want to send a code Teika Kazura
2024-02-04 16:43 ` Ihor Radchenko
2024-02-05  5:12   ` Teika Kazura

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).