all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@uva.nl>
To: Adam Porter <adam@alphapapa.net>
Cc: org-mode list <emacs-orgmode@gnu.org>
Subject: Re: ANN: org-sticky-header
Date: Wed, 19 Apr 2017 08:11:41 +0200	[thread overview]
Message-ID: <CADn3Z2J41DfJE9C-3faRvC9fz=b-0D1JNmGghq48dAo3TjbekA@mail.gmail.com> (raw)
In-Reply-To: <CADn3Z2LN4HvnnaZ2DW34Xzk1+8uBGJfm_jONi_-nn8s9+ZK4BA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1614 bytes --]

Hi Adam,

here is a new patch with does do this correctly.

Cheers

Carsten

On Wed, Apr 19, 2017 at 7:52 AM, Carsten Dominik <dominik@uva.nl> wrote:

> Hi Adam,
>
> and just after I send this, I now see that the faces of the headings
> in the path are now wrong - so you probably already had gone down
> this path.  Sorry for the noise, need to come up with something better.
>
> Carsten
>
> On Wed, Apr 19, 2017 at 7:46 AM, Carsten Dominik <dominik@uva.nl> wrote:
>
>> Hi Adam,
>>
>> thanks for adding the option to reverse the outline path.  Great thinking
>> about using a different separator for the reversed path!
>>
>> It mostly works - however, if the window is too narrow, the abbreviation
>> ellipses are now applied to the most recent heading instead of to the last
>> one shown.  It would be better to reverse the outline path before sending
>> it into org-format-outline-path, which also saves you the pain to split and
>> rejoin the path string.
>>
>> Please find attached a patch that makes this change.  It also removes the
>> dependence on the string library which is, I think, not by default
>> available in Emacs.
>>
>> Thanks
>>
>> On Wed, Apr 19, 2017 at 1:06 AM, Adam Porter <adam@alphapapa.net> wrote:
>>
>>> Carsten Dominik <dominik@uva.nl> writes:
>>>
>>> Hi Carsten,
>>>
>>> > I am wondering if you would consider the possibility to show on only
>>> > the most recent heading, but, space permitting, the outline path -
>>> > maybe in reverse order as to keep the sticky heading itself in the
>>> > left-most column.
>>>
>>> That's a great idea, I will add that.  Thanks.
>>>
>>>
>>>
>>
>

[-- Attachment #1.2: Type: text/html, Size: 2949 bytes --]

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 1766 bytes --]

--- org-sticky-header.el.orig	2017-04-19 07:33:26.000000000 +0200
+++ org-sticky-header.el	2017-04-19 08:07:41.000000000 +0200
@@ -42,7 +42,6 @@
 ;;; Code:
 
 (require 'dash)
-(require 's)
 
 (defvar org-sticky-header-old-hlf nil
   "Value of the header line when entering org-sticky-header mode.")
@@ -102,14 +101,19 @@
         ('nil (concat org-sticky-header-prefix (org-get-heading t t)))
         ('full (concat org-sticky-header-prefix (org-format-outline-path (org-get-outline-path t) (window-width) nil
                                                                          org-sticky-header-outline-path-separator)))
-        ('reversed (concat org-sticky-header-prefix
-                           ;; Using "🐱" "CAT FACE" as separator character. It needs to be a single character,
-                           ;; otherwise it could get truncated and cause splitting to fail, and the chances of this
-                           ;; character being in a heading is low enough...right?
-                           (->> (org-format-outline-path (org-get-outline-path t) (window-width) nil "🐱")
-                                (s-split "🐱")
-                                (nreverse)
-                                (s-join org-sticky-header-outline-path-reversed-separator))))))))
+        ('reversed
+	 (let ((s (mapconcat
+		   'identity
+		   (org-split-string
+		    (concat org-sticky-header-prefix
+			    (org-format-outline-path
+			     (org-get-outline-path t)
+			     1000 nil "🐱"))
+		    "🐱")
+		   org-sticky-header-outline-path-reversed-separator)))
+	   (if (> (length s) (window-width))
+	       (concat (substring s 0 (- (window-width) 2)) "..")
+	     s)))))))
 
 ;;;###autoload
 (define-minor-mode org-sticky-header-mode

  reply	other threads:[~2017-04-19  6:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17 23:41 ANN: org-sticky-header Adam Porter
2017-04-18  3:28 ` Eric Abrahamsen
2017-04-18 23:10   ` Adam Porter
2017-04-18 13:29 ` Carsten Dominik
2017-04-18 13:51   ` John Kitchin
2017-04-18 13:55     ` Carsten Dominik
     [not found]     ` <2357163c15c549d3a13e923dc7d5f6ea@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-04-18 17:22       ` Eric S Fraga
2017-04-18 19:16         ` Leslie Watter
2017-04-18 23:09         ` Adam Porter
2017-04-18 23:07     ` Adam Porter
2017-04-18 13:57   ` Kaushal Modi
2017-04-18 23:06   ` Adam Porter
2017-04-19  5:46     ` Carsten Dominik
2017-04-19  5:52       ` Carsten Dominik
2017-04-19  6:11         ` Carsten Dominik [this message]
2017-04-19 16:44           ` Adam Porter
2017-04-19 21:33             ` Adam Porter
2017-04-23  0:06               ` Charles C. Berry
2017-04-24  5:37                 ` Infinite loop with org-inlinetask and org-sticky-header [was Re: ANN: org-sticky-header] Adam Porter
2017-04-18 23:51 ` ANN: org-sticky-header Adam Porter
     [not found] <a8497792e3994095a9867e508a90bb3f@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-04-18  7:21 ` Eric S Fraga
2017-04-18 23:53   ` Adam Porter
     [not found]   ` <ea4543fad79c4e9687992e41ef77062e@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-04-19  6:07     ` Eric S Fraga
2017-04-19 15:03       ` Carsten Dominik
2017-04-19 16:40         ` Adam Porter
2017-04-19 21:33           ` Adam Porter
     [not found]           ` <7a7a9e1653114a578dcb91186e8a4cab@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-04-24  6:38             ` Eric S Fraga

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

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

  git send-email \
    --in-reply-to='CADn3Z2J41DfJE9C-3faRvC9fz=b-0D1JNmGghq48dAo3TjbekA@mail.gmail.com' \
    --to=dominik@uva.nl \
    --cc=adam@alphapapa.net \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.