cute-jumper / org-table-sticky-header Goto Github PK
View Code? Open in Web Editor NEWSticky header for org-mode tables
Sticky header for org-mode tables
Thanks for sharing this. This will be very handy when dealing with long tables. Does it support org 9.0?
Narrowed columns are respected. However, if the head-line is narrowed the layout is wrong.
* Table
| Byte | Bit | Bit-Offset | Type | Description |
| | | <4> | | |
|------+-----+------------+-------+-------------|
| 0 | 0 | 0 | DWORD | |
| 6 | 0 | 48 | DWORD | |
| 10 | 0 | 80 | BYTE | |
| 11 | 0 | 88 | BOOL | |
| 11 | 1 | 89 | BOOL | |
| 11 | 2 | 90 | BOOL | |
| 11 | 3 | 91 | BOOL | |
| 14 | 0 | 96 | DWORD | |
| 16 | 0 | 128 | BYTE | |
| 17 | 0 | 136 | BOOL | |
| 17 | 1 | 137 | BOOL | |
| 17 | 2 | 138 | BOOL | |
| 17 | 3 | 139 | BOOL | |
Hello,
I'm using your package since since several weeks, it's nice. Today I came about a problem
when using query-replace to change the content of an org-table; it throw a exception.
After digging it down I saw, that the problem occurs if the screen scrolls vertically. The match
data where lost. So it is necessary to save the match data, here is my proposal of change:
@@ -168,7 +168,8 @@ org-table-sticky-header--fetch-header
(defun org-table-sticky-header--scroll-function (win start-pos)
(unless (= org-table-sticky-header--last-win-start start-pos)
(setq org-table-sticky-header--last-win-start start-pos)
- (org-table-sticky-header--fetch-header)))
+ (save-match-data
+ (org-table-sticky-header--fetch-header))))
;;;###autoload
(define-minor-mode org-table-sticky-header-mode
With kind regards,
Stefan
The sticky header does not respect column widths (defined with <number>) as mentioned here so the header and table contents are not aligned properly and look skewed.
Hi,
This functionality is now part of the default setup using M-x org-table-electric-header-mode
which then got renamed to M-x org-table-header-line-mode
.
Source: https://mastodon.etalab.gouv.fr/@bzg/103578639383778830
You should add a prominent statement in the README and explain the differences between them both so that users are able to decide which way to go.
Bastien wrote that org-table-header-line-mode
has less code and does not use any advice. So I would interpret this as an argument to switch to org-table-header-line-mode
and stop using your code. Is this true?
Great package!!!
One thing missing: In my tables I have column width line mostly before headerline as:
| <6> | |
| Col-1 | Col-2 |
|-
| Data | |
In this case the headerline is not correctly recognized. Org-mode also allows a
table to begin with a line additionally.
With kind regards,
Stefan
Hello,
I added following functionality to change the sticky line if moving, inserting or deleting columns.
Please feel free to use the following code snippet.
With kind regards,
Stefan
modified lisp/org-table-sticky-header.el
@@ -79,6 +79,7 @@
;;; Code:
(require 'org)
+(require 'org-table)
(defvar org-table-sticky-header--last-win-start -1)
(defvar org-table-sticky-header--old-header-line-format nil)
@@ -171,6 +172,14 @@ org-table-sticky-header--scroll-function
(save-match-data
(org-table-sticky-header--fetch-header))))
+(defun org-table-sticky-header--insert-delete-column ()
+ (save-match-data
+ (org-table-sticky-header--fetch-header)))
+
+(defun org-table-sticky-header--table-move-column (&optional left)
+ (save-match-data
+ (org-table-sticky-header--fetch-header)))
+
;;;###autoload
(define-minor-mode org-table-sticky-header-mode
"Sticky header for org-mode tables."
@@ -181,10 +190,16 @@ org-table-sticky-header-mode
(setq org-table-sticky-header--old-header-line-format header-line-format)
(add-hook 'window-scroll-functions
'org-table-sticky-header--scroll-function 'append 'local)
+ (advice-add 'org-table-delete-column :after #'org-table-sticky-header--insert-delete-column)
+ (advice-add 'org-table-insert-column :after #'org-table-sticky-header--insert-delete-column)
+ (advice-add 'org-table-move-column :after #'org-table-sticky-header--table-move-column)
(setq org-table-sticky-header--last-win-start (window-start))
(org-table-sticky-header--fetch-header))
(setq org-table-sticky-header-mode nil)
(error "Not in `org-mode'"))
+ (advice-remove 'org-table-delete-column #'org-table-sticky-header--insert-delete-column)
+ (advice-remove 'org-table-insert-column #'org-table-sticky-header--insert-delete-column)
+ (advice-remove 'org-table-move-column #'org-table-sticky-header--table-move-column)
(remove-hook 'window-scroll-functions 'org-table-sticky-header--scroll-function 'local)
(setq header-line-format org-table-sticky-header--old-header-line-format)))
Great package. I deal with long tables a lot. This is a bit of a nit, but I always use org-indent-mode, so my tables are typically indented depending on where they are in the outline. Looks like the sticky header is always flush against the left side, so it is out of alignment with the table body. Would be nice to have it follow the body indent if possible.
If I have a very wide table - columns are A, B, C, D ...... Z.
Without scrolling right, I can see only up to columns A .. G. After scrolling down, such that the overlay header line is activated using org-table-sticky-header, if I scroll right to see columns H, I, ...., the header line does not scroll right.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.