Git Product home page Git Product logo

dired-auto-readme's People

Contributors

amno1 avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

akirak syohex

dired-auto-readme's Issues

Conflicts with dired-git-info

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.