polymode / poly-org

Polymode for org-mode
57 stars 13 forks source link

Wrong org-ellipsis in poly-org with point in a source block #1

Closed yantar92 closed 5 years ago

yantar92 commented 6 years ago

Poly-org changes non-default symbol used to indicate folding in org mode (" ⤵") by its default value ("..."), while it should not be the case.

The issue can be reproduced with the following config for emacs -Q.

  1. Load the config
  2. Open an org file with source blocks
  3. Move the point in to and out from a source block
  4. Observe repetitive changes between " ⤵" and "..."
    
    (require 'package)
    (setq package-archives '(("MELPA" . "https://melpa.org/packages/") ("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") ("org" . "http://orgmode.org/elpa/"))
    load-prefer-newer t
    package-user-dir "~/.emacs.d/elpa/"
    package--init-file-ensured t
    package-enable-at-startup nil)
    (unless (file-directory-p package-user-dir)
    (make-directory package-user-dir t))
    (setq load-path (append '("~/.emacs.d/site-lisp/") load-path))
    (setq load-path (append (directory-files "~/.emacs.d/site-lisp/" t "^[^.]" t) load-path))
    (setq load-path (append (directory-files package-user-dir t "^[^.]" t) load-path))
    (add-hook 'after-init-hook #'package-initialize)
    (package-initialize 'NO-ACTIVATE)
    ;; Package management & configuration:2 ends here

;; [[id:4c0a06f9-9e69-4ead-b570-e3143fa0d61d][Package management & configuration:3]] (require 'use-package) (use-package diminish :ensure t) (require 'bind-key) ;; Package management & configuration:3 ends here (setq org-ellipsis " ⤵") (use-package polymode :ensure t :init (use-package poly-org :ensure t :config (setq poly-lock-allow-fontification nil) (defun org-source-block-major-mode () "Return the name of major mode for the org source block at point." (when (re-search-forward "#\+begin_src +\([^ \t\n]+\)") (if (string-match "\(bash\|sh\|shell\)" (match-string 1)) "sh" (format "%s" (match-string 1))))) (setq pm-inner/org (pm-inner-auto-chunkmode :name "org" :mode 'host :head-mode 'host :tail-mode 'host :head-matcher "^[ \t]#\+begin_src .\n" :tail-matcher "^[ \t]*#\+end_src" :head-adjust-face nil :mode-matcher #'org-source-block-major-mode :indent-offset org-edit-src-content-indentation)) ))