amno1 / dired-auto-readme Goto Github PK
View Code? Open in Web Editor NEWAn Emacs package to automatically display a README file when one is present in a dired buffer.
License: GNU General Public License v3.0
An Emacs package to automatically display a README file when one is present in a dired buffer.
License: GNU General Public License v3.0
Any interest in finishing this off?
Has the bug mentioned in that pull request been fixed?
As discussed on reddit, when I played with it I noticed the following preserves the overlays and doesn't seem to break the dired listing highlighting:
(defun dar--insert ()
"Insert README file in the current buffer. "
(setq inhibit-read-only t)
(catch 'break
(dolist (file dired-auto-readme-files)
(when (file-exists-p file)
(save-excursion
(let (text (ext (file-name-extension file)))
(with-current-buffer (get-buffer-create file)
(insert-file-contents file)
(cond ((or (equal ext "md")
(equal ext "markdown"))
(when (require 'markdown-mode)
(call-interactively 'markdown-mode)))
((equal ext "org")
(when (require 'org)
(goto-char (point-min))
(call-interactively 'org-mode))))
(font-lock-ensure)
(goto-char (point-min))
(while (not (eobp))
(insert " ")
(forward-line 1))
(setq text (buffer-substring (point-min) (point-max)))
(kill-buffer))
(make-variable-buffer-local 'dar--orig-buff)
(setq dar--orig-buff (buffer-substring (point-min) (point-max)))
(font-lock-mode -1)
(make-variable-buffer-local 'dar--start-point)
;; (delete-region (point-min) (point-max))
;; (insert dar--orig-buff)
(goto-char (point-max))
(setq dar--start-point (point))
(newline)
(insert text)
(setq dar--inserted t)
(when (equal ext "org")
(org-toggle-link-display)
(org-toggle-link-display)
(org-toggle-pretty-entities)
(when dired-auto-readme-display-images
(org-display-inline-images t t))
(when (and dired-auto-readme-display-pretty-tables
(require 'org-pretty-table))
(org-pretty-table-mode 1)))
(font-lock-fontify-region 1 dar--start-point))
(setq inhibit-read-only nil)
(throw 'break t))))))
I tested with the following setup:
(setq dired-auto-readme-display-pretty-tables nil)
(add-hook 'dired-after-readin-hook 'dired-git-info-auto-enable)
(dired-auto-readme-mode 1)
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.