io12 / org-fragtog

Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them
MIT License
405 stars 14 forks source link

it all breakt idk i fiel dump #49

Closed lolcklol2 closed 1 year ago

lolcklol2 commented 1 year ago

I gat this error wan ever a auto preview gets generatet the preview still gets product put i dont anderstand the problem shod i just

  1. disable errors and ignor it her is the error:

    
    ■  Warning (org-element-cache): org-element--cache: Org parser error in 20230908094329-orglatexmath.org::89. Resetting.
    The error was: (error "Invalid search bound (wrong side of point)")
    Backtrace:
    "  backtrace-to-string(nil)
    org-element-at-point()
    org--collect-keywords-1((\"SETUPFILE\" \"LATEX_CLASS\" \"LATEX_CLASS_OPTIONS\" \"LATEX_HEADER\" \"LATEX_HEADER_EXTRA\" \"DESCRIPTION\" \"KEYWORDS\" \"SUBTITLE\" \"LATEX_ENGRAVED_THEME\" \"LATEX_COMPILER\" \"DATE\" \"TITLE\" \"DATE\" \"AUTHOR\" \"EMAIL\" \"LANGUAGE\" \"SELECT_TAGS\" \"EXCLUDE_TAGS\" \"CREATOR\" \"CITE_EXPORT\" \"FILETAGS\" \"OPTIONS\") nil nil (\"/home/ck/org/Nots/20230908094329-orglatexmath.org\") nil)
    org-collect-keywords((\"LATEX_CLASS\" \"LATEX_CLASS_OPTIONS\" \"LATEX_HEADER\" \"LATEX_HEADER_EXTRA\" \"DESCRIPTION\" \"KEYWORDS\" \"SUBTITLE\" \"LATEX_ENGRAVED_THEME\" \"LATEX_COMPILER\" \"DATE\" \"TITLE\" \"DATE\" \"AUTHOR\" \"EMAIL\" \"LANGUAGE\" \"SELECT_TAGS\" \"EXCLUDE_TAGS\" \"CREATOR\" \"CITE_EXPORT\" \"FILETAGS\" \"OPTIONS\"))
    org-export--get-inbuffer-options(#s(org-export-backend :name latex :parent nil :transcoders ((bold . org-latex-bold) (center-block . org-latex-center-block) (clock . org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) (dynamic-block . org-latex-dynamic-block) (entity . org-latex-entity) (example-block . org-latex-example-block) (export-block . org-latex-export-block) (export-snippet . org-latex-export-snippet) (fixed-width . org-latex-fixed-width) (footnote-definition . org-latex-footnote-definition) (footnote-reference . org-latex-footnote-reference) (headline . org-latex-headline) (horizontal-rule . org-latex-horizontal-rule) (inline-src-block . org-latex-inline-src-block) (inlinetask . org-latex-inlinetask) (italic . org-latex-italic) (item . org-latex-item) (keyword . org-latex-keyword) (latex-environment . org-latex-latex-environment) (latex-fragment . org-latex-latex-fragment) (line-break . org-latex-line-break) (link . org-latex-link) (node-property . org-latex-node-property) (paragraph . org-latex-paragraph) (plain-list . org-latex-plain-list) (plain-text . org-latex-plain-text) (planning . org-latex-planning) (property-drawer . org-latex-property-drawer) (quote-block . org-latex-quote-block) (radio-target . org-latex-radio-target) (section . org-latex-section) (special-block . org-latex-special-block) (src-block . org-latex-src-block) (statistics-cookie . org-latex-statistics-cookie) (strike-through . org-latex-strike-through) (subscript . org-latex-subscript) ...) :options ((:latex-class \"LATEX_CLASS\" nil org-latex-default-class t) (:latex-class-options \"LATEX_CLASS_OPTIONS\" nil nil t) (:latex-header \"LATEX_HEADER\" nil nil newline) (:latex-header-extra \"LATEX_HEADER_EXTRA\" nil nil newline) (:description \"DESCRIPTION\" nil nil parse) (:keywords \"KEYWORDS\" nil nil parse) (:subtitle \"SUBTITLE\" nil nil parse) (:latex-active-timestamp-format nil nil org-latex-active-timestamp-format) (:latex-caption-above nil nil org-latex-caption-above) (:latex-classes nil nil org-latex-classes) (:latex-default-figure-position nil nil org-latex-default-figure-position) (:latex-default-table-environment nil nil org-latex-default-table-environment) (:latex-default-quote-environment nil nil org-latex-default-quote-environment) (:latex-default-table-mode nil nil org-latex-default-table-mode) (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format) (:latex-engraved-options nil nil org-latex-engraved-options) (:latex-engraved-preamble nil nil org-latex-engraved-preamble) (:latex-engraved-theme \"LATEX_ENGRAVED_THEME\" nil org-latex-engraved-theme) (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format) (:latex-footnote-separator nil nil org-latex-footnote-separator) (:latex-format-drawer-function nil nil org-latex-format-drawer-function) (:latex-format-headline-function nil nil org-latex-format-headline-function) (:latex-format-inlinetask-function nil nil org-latex-format-inlinetask-function) (:latex-hyperref-template nil nil org-latex-hyperref-template t) (:latex-image-default-scale nil nil org-latex-image-default-scale) (:latex-image-default-height nil nil org-latex-image-default-height) (:latex-image-default-option nil nil org-latex-image-default-option) (:latex-image-default-width nil nil org-latex-image-default-width) (:latex-images-centered nil nil org-latex-images-centered) (:latex-inactive-timestamp-format nil nil org-latex-inactive-timestamp-format) (:latex-inline-image-rules nil nil org-latex-inline-image-rules) (:latex-link-with-unknown-path-format nil nil org-latex-link-with-unknown-path-format) (:latex-src-block-backend nil nil org-latex-src-block-backend) (:latex-listings-langs nil nil org-latex-listings-langs) (:latex-listings-options nil nil org-latex-listings-options) (:latex-minted-langs nil nil org-latex-minted-langs) (:latex-minted-options nil nil org-latex-minted-options) (:latex-prefer-user-labels nil nil org-latex-prefer-user-labels) ...) :filters ((:filter-options . org-latex-math-block-options-filter) (:filter-paragraph . org-latex-clean-invalid-line-breaks) (:filter-parse-tree org-latex-math-block-tree-filter org-latex-matrices-tree-filter org-latex-image-link-filter) (:filter-verse-block . org-latex-clean-invalid-line-breaks)) :blocks nil :menu (108 \"Export to LaTeX\" ((76 \"As LaTeX buffer\" org-latex-export-as-latex) (108 \"As LaTeX file\" org-latex-export-to-latex) (112 \"As PDF file\" org-latex-export-to-pdf) (111 \"As PDF file and open\" (lambda ... ...))))))
    org-export-get-environment(#s(org-export-backend :name latex :parent nil :transcoders ((bold . org-latex-bold) (center-block . org-latex-center-block) (clock . org-latex-clock) (code . org-latex-code) (drawer . org-latex-drawer) (dynamic-block . org-latex-dynamic-block) (entity . org-latex-entity) (example-block . org-latex-example-block) (export-block . org-latex-export-block) (export-snippet . org-latex-export-snippet) (fixed-width . org-latex-fixed-width) (footnote-definition . org-latex-footnote-definition) (footnote-reference . org-latex-footnote-reference) (headline . org-latex-headline) (horizontal-rule . org-latex-horizontal-rule) (inline-src-block . org-latex-inline-src-block) (inlinetask . org-latex-inlinetask) (italic . org-latex-italic) (item . org-latex-item) (keyword . org-latex-keyword) (latex-environment . org-latex-latex-environment) (latex-fragment . org-latex-latex-fragment) (line-break . org-latex-line-break) (link . org-latex-link) (node-property . org-latex-node-property) (paragraph . org-latex-paragraph) (plain-list . org-latex-plain-list) (plain-text . org-latex-plain-text) (planning . org-latex-planning) (property-drawer . org-latex-property-drawer) (quote-block . org-latex-quote-block) (radio-target . org-latex-radio-target) (section . org-latex-section) (special-block . org-latex-special-block) (src-block . org-latex-src-block) (statistics-cookie . org-latex-statistics-cookie) (strike-through . org-latex-strike-through) (subscript . org-latex-subscript) ...) :options ((:latex-class \"LATEX_CLASS\" nil org-latex-default-class t) (:latex-class-options \"LATEX_CLASS_OPTIONS\" nil nil t) (:latex-header \"LATEX_HEADER\" nil nil newline) (:latex-header-extra \"LATEX_HEADER_EXTRA\" nil nil newline) (:description \"DESCRIPTION\" nil nil parse) (:keywords \"KEYWORDS\" nil nil parse) (:subtitle \"SUBTITLE\" nil nil parse) (:latex-active-timestamp-format nil nil org-latex-active-timestamp-format) (:latex-caption-above nil nil org-latex-caption-above) (:latex-classes nil nil org-latex-classes) (:latex-default-figure-position nil nil org-latex-default-figure-position) (:latex-default-table-environment nil nil org-latex-default-table-environment) (:latex-default-quote-environment nil nil org-latex-default-quote-environment) (:latex-default-table-mode nil nil org-latex-default-table-mode) (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format) (:latex-engraved-options nil nil org-latex-engraved-options) (:latex-engraved-preamble nil nil org-latex-engraved-preamble) (:latex-engraved-theme \"LATEX_ENGRAVED_THEME\" nil org-latex-engraved-theme) (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format) (:latex-footnote-separator nil nil org-latex-footnote-separator) (:latex-format-drawer-function nil nil org-latex-format-drawer-function) (:latex-format-headline-function nil nil org-latex-format-headline-function) (:latex-format-inlinetask-function nil nil org-latex-format-inlinetask-function) (:latex-hyperref-template nil nil org-latex-hyperref-template t) (:latex-image-default-scale nil nil org-latex-image-default-scale) (:latex-image-default-height nil nil org-latex-image-default-height) (:latex-image-default-option nil nil org-latex-image-default-option) (:latex-image-default-width nil nil org-latex-image-default-width) (:latex-images-centered nil nil org-latex-images-centered) (:latex-inactive-timestamp-format nil nil org-latex-inactive-timestamp-format) (:latex-inline-image-rules nil nil org-latex-inline-image-rules) (:latex-link-with-unknown-path-format nil nil org-latex-link-with-unknown-path-format) (:latex-src-block-backend nil nil org-latex-src-block-backend) (:latex-listings-langs nil nil org-latex-listings-langs) (:latex-listings-options nil nil org-latex-listings-options) (:latex-minted-langs nil nil org-latex-minted-langs) (:latex-minted-options nil nil org-latex-minted-options) (:latex-prefer-user-labels nil nil org-latex-prefer-user-labels) ...) :filters ((:filter-options . org-latex-math-block-options-filter) (:filter-paragraph . org-latex-clean-invalid-line-breaks) (:filter-parse-tree org-latex-math-block-tree-filter org-latex-matrices-tree-filter org-latex-image-link-filter) (:filter-verse-block . org-latex-clean-invalid-line-breaks)) :blocks nil :menu (108 \"Export to LaTeX\" ((76 \"As LaTeX buffer\" org-latex-export-as-latex) (108 \"As LaTeX file\" org-latex-export-to-latex) (112 \"As PDF file\" org-latex-export-to-pdf) (111 \"As PDF file and open\" (lambda ... ...))))))
    org-create-formula-image(\"$1 - 3 = -1$\" \"/home/ck/org/Nots/ltximg/org-ltximg_7fc39c2dc1a834...\" (:foreground \"#bbc2cf\" :background \"#282c34\" :scale 2 :html-foreground \"Black\" :html-background \"Transparent\" :html-scale 1.0 :matchers (\"begin\" \"$1\" \"$\" \"$$\" \"\\\\(\" \"\\\\[\")) forbuffer imagemagick)
    org-format-latex(\"ltximg/org-ltximg\" 101 113 \"/home/ck/org/Nots/\" overlays nil forbuffer imagemagick)
    org--latex-preview-region(101 113)
    org-latex-preview()
    org-fragtog--enable-frag((latex-fragment (:value \"$1 - 3 = -1$\" :begin 101 :end 113 :post-blank 0 :parent (paragraph (:begin 90 :end 113 :contents-begin 90 :contents-end 113 :post-blank 0 :post-affiliated 90 :mode nil :granularity element :cached nil :parent (section (:begin 1 :end 113 :contents-begin 1 :contents-end 113 :robust-begin 1 :robust-end 111 :post-blank 0 :post-affiliated 1 :mode first-section :granularity element :cached nil :parent (org-data ...) :org-element--cache-sync-key (12 . 0))) :org-element--cache-sync-key (12 . 90))))))
    org-fragtog--post-cmd()
    "
    Please report this to Org mode mailing list (M-x org-submit-bug-report).
    ■  Warning (org-element-cache): org-element--cache: Org parser error in 20230908094329-orglatexmath.org::14. Resetting.
    The error was: (error "org-element--cache: Emergency exit")
    Backtrace:
    "  backtrace-to-string(nil)
    org-element-at-point()
    org-back-to-heading(t)
    org-up-heading-safe()
    org-entry-get-with-inheritance(\"LOG_INTO_DRAWER\" t)
    org-entry-get(nil \"LOG_INTO_DRAWER\" inherit t)
    org-log-into-drawer()
    org-mode-flyspell-verify()
    flyspell-word()
    flyspell-post-command-hook()
    "
    Please report this to Org mode mailing list (M-x org-submit-bug-report).
1. and her is may init.el:

(defun efs/org-babel-tangle-config () (when (string-equal (buffer-file-name) (expand-file-name "/home/ck/org/Nots/20230823070942-init.org")) ;; Dynamic scoping to the rescue (let ((org-confirm-babel-evaluate nil)) (org-babel-tangle))))

(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))

(use-package dashboard :ensure t :config (dashboard-setup-startup-hook))

(setq initial-buffer-choice (lambda () (get-buffer "dashboard")))

;;test23 (setq custom-file (locate-user-emacs-file "evars.el")) (load custom-file 'noerror 'nomessage)

;; Minimize garbage collection during startup (setq gc-cons-threshold most-positive-fixnum)

;; Lower threshold back to 8 MiB (default is 800kB) (add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold (expt 2 23)))) (defun loadup-gen () "Generate the lines to include in the lisp/loadup.el file to place all of the libraries that are loaded by your InitFile into the main dumped emacs" (interactive) (defun get-loads-from-Messages () (save-excursion (let ((retval ())) (set-buffer "Messages") (beginning-of-buffer) (while (search-forward-regexp "^Loading " nil t) (let ((start (point))) (search-forward "…") (backward-char 3) (setq retval (cons (buffer-substring-no-properties start (point)) retval)))) retval))) (map 'list (lambda (file) (princ (format "(load \"%s\")\n" file))) (get-loads-from-Messages))) ;; time the loading of the .emacs ;; keep this on top of your .emacs (defvar emacs-load-start (current-time)) (defun anarcat/time-to-ms (time) (+ ( (+ ( (car time) (expt 2 16)) (car (cdr time))) 1000000) (car (cdr (cdr time))))) (defun anarcat/display-timing () (message ".emacs loaded in %fms" (/ (- (anarcat/time-to-ms (current-time)) (anarcat/time-to-ms emacs-load-start)) 1000000.0))) (add-hook 'after-init-hook 'anarcat/display-timing t)

(require 'package)

(setq package-archives '(("melpa" . "https://melpa.org/packages/") ("elpa" . "https://elpa.gnu.org/packages/")))

(unless package-archive-contents (package-refresh-contents))

;; Initialize use-package on non-Linux platforms (unless (package-installed-p 'use-package) (package-install 'use-package))

(require 'use-package) (setq use-package-always-ensure t)

(org-babel-do-load-languages 'org-babel-load-languages '( (emacs-lisp . t) (python . t) ))

(use-package org-auto-tangle :hook (org-mode . org-auto-tangle-mode))

(define-key org-mode-map (kbd "C-c C-r") 'org-mode-restart)

(setq org-agenda-include-diary t)

(use-package sudo-edit) (define-key org-mode-map (kbd "C-c e") 'sudo-edit)

(setq org-agenda-start-with-log-mode t) (setq org-log-done 'time) (setq org-log-into-drawer t) (setq org-agenda-files '("~/org/Nots"))

(setq calendar-week-start-day 1

      calendar-day-name-array ["Sonntag" "Montag" "Dienstag" "Mittwoch"
                   "Donnerstag" "Freitag" "Samstag"]
      calendar-month-name-array ["Januar" "Februar" "März" "April" "Mai"
                     "Juni" "Juli" "August" "September" "Oktober" "November" "Dezember"])
(setq solar-n-hemi-seasons '())
(setq holiday-general-holidays '())

(setq holiday-christian-holidays '())

(defun holiday-add-Block (start-date end-date list mark) "Add fixed holidays with MARK for all dates between START-DATE and END-DATE." (let* ((start-time (encode-time 0 0 0 (nth 1 start-date) (nth 0 start-date) 2023)) (end-time (encode-time 0 0 0 (nth 1 end-date) (nth 0 end-date) 2023)) (current-time start-time)) (while (> (float-time (time-subtract end-time current-time)) 1) ;; Print the values of current-time and end-time (message "current-time: %s" current-time) (message "end-time: %s" end-time)

  (let ((date-list (decode-time current-time)))
(add-to-list list
         `(holiday-fixed ,(nth 4 date-list) ; month
                 ,(nth 3 date-list) ; day
                 ,mark)))
  (setq current-time (time-add current-time (* 60 60 24))))
;; Add the end-date to the list of holidays
(let ((date-list (decode-time end-time)))
  (add-to-list list
       `(holiday-fixed ,(nth 4 date-list) ; month
               ,(nth 3 date-list) ; day
               ,mark)))))

(holiday-add-Block '(1 1) '(1 5) 'holiday-general-holidays "Weihnachtsferien") (holiday-add-Block '(7 13) '(8 25) 'holiday-general-holidays "Sommerferien") (holiday-add-Block '(2 5) '(2 10) 'holiday-general-holidays "Winterferien") (holiday-add-Block '(3 25) '(4 5) 'holiday-general-holidays "Osterferien") (holiday-add-Block '(12 23) '(12 31) 'holiday-general-holidays "Weihnachtsferien")

(global-set-key (kbd "C-c a") 'org-agenda)

(use-package org-super-agenda) (setq org-habit-following-days 7) (setq org-habit-graph-column 51) (setq habit-preceding-days 20) (setq org-habit-show-habits t) (setq org-habit-show-habits-only-for-today t)

(require 'org-tempo) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("py" . "src python")) (add-to-list 'org-structure-template-alist '("ja" . "src java"))

(use-package ya-org-capture :after yankpad :load-path "~/.emacs.d/lisp" :config (ya-org-capture/setup))

(use-package org-roam :ensure t :init (setq org-roam-v2-ack t) :custom (org-roam-directory "~/org/Nots") (org-roam-completion-everywhere t) (org-roam-capture-templates '(("d" "default" plain "%?" :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n") :unnarrowed t)

  ("p" "Protokoll" plain
   ":Schule: \n* Versuchsziel \n* Chemikalien \n* Theoretische Grundlagen des Versuches\n* [[id:c9b2830f-54e4-4545-a723-da2f60d3fb9a][MA]][[id:c9b2830f-54e4-4545-a723-da2f60d3fb9a][MA]]Durchführung und Beobachtungen\n* Messdaten\n* Berechnungen\n* Auswertung/Bewertung\n* Entsorgung\n* Angaben zur Arbeitssicherheit"
   :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
   :unnarrowed t)

  ("f" "Schuhl Fach" plain
   ":Schule: \n* Lehrer \n** Name \n** Kürzel \n** Publikationen / Leben \n* Fach \n** Inhalte\n** Glossa\n|||\n** Aufgaben\n** Hausaufgaben"
   :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
   :unnarrowed t)

   ("v" "Vormel" plain
   "\n* Vormel\n\n\n* Beispiel"
   :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
   :unnarrowed t)))

:bind (("C-c n l" . org-roam-buffer-toggle) ("C-c n f" . org-roam-node-find) ("C-c n i" . org-roam-node-insert) :map org-mode-map ("C-M-i" . completion-at-point) :map org-roam-dailies-map ("Y" . org-roam-dailies-capture-yesterday) ("T" . org-roam-dailies-capture-tomorrow)) :bind-keymap ("C-c n d" . org-roam-dailies-map) :config (require 'org-roam-dailies) ;; Ensure the keymap is available (org-roam-db-autosync-mode))

(use-package org-roam-ui :bind ( ("C-c n u" . org-roam-ui-mode)) :config (setq org-roam-ui-sync-theme t org-roam-ui-follow t org-roam-ui-update-on-save t org-roam-ui-open-on-start t))

(defvar centered-visual-fill--original-org-faces nil "List of original org face attributes")

(define-minor-mode centered-visual-fill-mode "Center text, enable visual-fill-column-mode, and change org header font" :init-value nil :lighter " Centered" (if centered-visual-fill-mode (progn (setq-local visual-fill-column-center-text t) (visual-fill-column-mode 1) (set-face-attribute (car face) nil :font "Menlo" :weight 'regular :height (cdr face)))) (kill-local-variable 'visual-fill-column-center-text) (visual-fill-column-mode -1) (dolist (face centered-visual-fill--original-org-faces) (apply #'set-face-attribute `(,(car face) nil ,@(cdr face)))) (setq centered-visual-fill--original-org-faces nil))

(use-package org-fragtog) (use-package xenops) (setq org-latex-inputenc-alist '(("utf8" . "utf8x" ))) (setq org-format-latex-options (plist-put org-format-latex-options :scale 2)) (global-auto-revert-mode -1) (require 'ox-latex) (setq org-startup-with-latex-preview t) (add-hook 'org-mode-hook 'org-fragtog-mode)

(with-eval-after-load 'org
  (add-to-list 'org-latex-packages-alist '("" "tikz" t))
  (add-to-list 'org-latex-packages-alist '("" "chemfig" t))
  (add-to-list 'org-latex-packages-alist '("" "circuitikz" t))
)
(setq org-preview-latex-default-process 'imagemagick)

(use-package forge) (setq org-startup-numerated t)

(defun efs/org-mode-setup () (org-indent-mode) (variable-pitch-mode 1) (visual-line-mode 1)) ;; Org Mode Configuration ------------------------------------------------------ (customize-set-variable 'org-blank-before-new-entry'((heading . auto)(plain-list-item . auto))) (setq org-cycle-separator-lines 3) (defun efs/org-font-setup () ;; Replace list hyphen with dot (font-lock-add-keywords 'org-mode '(("^ *\([-]\) " (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))

;; Set faces for heading levels (dolist (face '((org-level-1 . 1.4) (org-level-2 . 1.3) (org-level-3 . 1.05) (org-level-4 . 1.0) (org-level-5 . 1.1) (org-level-6 . 1.1) (org-level-7 . 1.1) (org-level-8 . 1.1))) (set-face-attribute (car face) nil :font "CMU Serif" :weight 'Bold :height (cdr face)))

;; Ensure that anything that should be fixed-pitch in Org files appears that way (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch) (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch)) (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))

(use-package org ;; :hook (org-mode . efs/org-mode-setup) :config (setq org-ellipsis "▾" org-hide-emphasis-markers t)

(setq org-agenda-start-with-log-mode 1) (setq org-log-done 'time) (setq org-log-into-drawer t)

(efs/org-font-setup))

(use-package org-bullets :after org :hook (org-mode . org-bullets-mode) :custom (org-bullets-bullet-list '(" " " " " " " " " " " " " "))) (require 'org-tempo) (set-face-attribute 'org-level-1 nil :height 250 ) (set-face-attribute 'org-level-2 nil :height 200 ) (set-face-attribute 'org-level-3 nil :height 150 ) (set-face-attribute 'org-level-4 nil :height 150 )

(defun my-org-depth () (org-content 1)) (add-hook 'org-mode-hook 'my-org-depth)

(define-key global-map "\C-cc"'org-capture) (setq org-capture-templates '( ("t" "TODO" entry (file+headline "~/org/agenda/Calendar.org" "Tasks") " TODO %?\n %i\n") ("p" "profile" entry (file+headline "~/org/agenda/Calendar.org" "Profile") " %^{Name}\n** Geburtstag%?") ))

(require 'org-habit)

(setq org-startup-with-inline-images t) (use-package org-inline-pdf)

(setq org-image-actual-width 400) (add-hook 'org-mode-hook #'org-inline-pdf-mode)

(setq bookmark-save-flag 0)

(setq org-agenda-custom-commands '(("w" "Agenda for next 2 weeks" ((agenda "" ((org-agenda-span 14)))) ((org-agenda-write-buffer-name "Agenda for next 2 weeks") (org-agenda-write-to-absolute-file "~/agenda.txt")))))

(use-package mu4e :ensure nil ;; :load-path "/usr/share/emacs/site-lisp/mu4e/" ;; :defer 20 ; Wait until 20 seconds after startup :config

(setq mu4e-change-filenames-when-moving t)

;; Refresh mail using isync every 10 minutes (setq mu4e-update-interval (* 10 60)) (setq mu4e-get-mail-command "mbsync -a") (setq mu4e-maildir "~/Mail")

(setq mu4e-drafts-folder "/[Gmail]/Drafts") (setq mu4e-sent-folder "/[Gmail]/Sent Mail") (setq mu4e-refile-folder "/[Gmail]/All Mail") (setq mu4e-trash-folder "/[Gmail]/Trash")

(setq mu4e-maildir-shortcuts '(("/Inbox" . ?i) ("/[Gmail]/Sent Mail" . ?s) ("/[Gmail]/Trash" . ?t) ("/[Gmail]/Drafts" . ?d) ("/[Gmail]/All Mail" . ?a)))) (global-set-key (kbd "C-c k") 'mu4e)

(setq evil-want-keybinding nil) (use-package evil :config (evil-mode 1))

(use-package evil-collection :after evil :ensure t :config (evil-collection-init))

(global-set-key (kbd "") 'keyboard-escape-quit) (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)

(use-package evil-org :ensure t :after org :hook (org-mode . (lambda () evil-org-mode)) :config (require 'evil-org-agenda) (evil-org-agenda-set-keys))

(defun efs/org-babel-tangle-config () (when (string-equal (buffer-file-name) (expand-file-name "/home/ck/org/Nots/20230823070942-init.org")) ;; Dynamic scoping to the rescue (let ((org-confirm-babel-evaluate nil)) (org-babel-tangle))))

(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))

(org-babel-do-load-languages 'org-babel-load-languages '( (emacs-lisp . t) (python . t) )) ;;tes

;;test (use-package no-littering) (setq no-littering-etc-directory (expand-file-name "~/.emacs.d/etclit" user-emacs-directory)) (setq no-littering-var-directory (expand-file-name "~/.emacs.d/datalit" user-emacs-directory)) (setq auto-save-file-name-transforms `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))

(require 'no-littering)

(use-package ivy :demand :diminish :bind (("C-s" . swiper) :map ivy-minibuffer-map ("TAB" . ivy-alt-done) ("C-l" . ivy-alt-done) ("C-j" . ivy-next-line) ("C-k" . ivy-previous-line) :map ivy-switch-buffer-map ("C-k" . ivy-previous-line) ("C-l" . ivy-done) ("C-d" . ivy-switch-buffer-kill) :map ivy-reverse-i-search-map ("C-k" . ivy-previous-line) ("C-d" . ivy-reverse-i-search-kill)) :config (ivy-mode 1))

(set-face-attribute 'default nil :height 150)

(global-display-line-numbers-mode)

(setq inhibit-startup-message t use-dialog-box nil) (setq display-line-numbers-type 'visual) (set-fringe-mode 10) (menu-bar-mode -1) (scroll-bar-mode -1) (tool-bar-mode -1) (global-auto-revert-mode 1)

(use-package all-the-icons :ensure t)

(use-package doom-themes :ensure t :config (load-theme 'doom-one)) (use-package doom-modeline :ensure t :hook (after-init . doom-modeline-mode))

(use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) (use-package highlight-indentation :ensure t) (use-package sage-shell-mode :ensure t :init (progn (use-package auto-complete :init (progn (setq ac-delay 0.3 ac-auto-start 2)))

(eval-after-load "auto-complete" '(setq ac-modes (append '(sage-shell-mode sage-shell:sage-mode) ac-modes))) (add-hook 'sage-shell:sage-mode-hook 'ac-sage-setup) (add-hook 'sage-shell:sage-mode-hook 'auto-complete-mode) (add-hook 'sage-shell-mode-hook 'ac-sage-setup) (add-hook 'sage-shell-mode-hook 'auto-complete-mode) (setq ac-sage-show-quick-help t)))

(setq display-time-interval 60) (setq display-time-format "%H:%M | %m.%d.%y") (display-time-mode) (display-battery-mode)

(use-package company-tabnine :ensure t) (require 'company-tabnine) (nconc company-backends '(company-tabnine))

(use-package quickrun ) (require 'quickrun) (with-eval-after-load 'lsp-mode (define-key lsp-mode-map (kbd "C-c C-c") 'quickrun))

;;test (use-package undo-tree :defer t :diminish undo-tree-mode :init (global-undo-tree-mode) :custom (undo-tree-visualizer-diff t) (undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))) (undo-tree-visualizer-timestamps t)) (require 'undo-tree) (global-undo-tree-mode) (setq undo-tree-show-help-in-visualize-buffer t) (setq undo-tree-show-minibuffer-help t) (setq undo-tree-minibuffer-help-dynamic t) (setq undo-tree-auto-save-history t)

(use-package quickrun) (require 'quickrun)

(use-package flex-autopair) (require 'flex-autopair) (flex-autopair-mode 1)

(use-package projectile) (use-package flycheck) (use-package lsp-mode :hook ((lsp-mode . lsp-enable-which-key-integration))) (use-package hydra) (use-package company) (use-package lsp-ui) (use-package which-key :config (which-key-mode)) (use-package lsp-java :config (add-hook 'java-mode-hook 'lsp)) (use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode)) (use-package dap-java :ensure nil) (use-package helm-lsp) (use-package helm :config (helm-mode)) (use-package lsp-treemacs)

(use-package python-mode :ensure t :hook (python-mode . lsp-deferred) :custom ;; NOTE: Set these if Python 3 is called "python3" on your system! ;; (python-shell-interpreter "python3") ;; (dap-python-executable "python3") (dap-python-debugger 'debugpy) :config (require 'dap-python))

(use-package pyvenv :config (pyvenv-mode 1))

(use-package typescript-mode :mode "\.ts\'" :hook (typescript-mode . lsp-deferred) :config (setq typescript-indent-level 2))

(use-package lsp-mode :init ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") (setq lsp-keymap-prefix "C-c l") :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) (XXX-mode . lsp) ;; if you want which-key integration (lsp-mode . lsp-enable-which-key-integration)) :commands lsp)

(use-package lsp-ui :hook (lsp-mode . lsp-ui-mode) :custom (lsp-ui-doc-position 'bottom))

(use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode))

(defun efs/lsp-mode-setup () (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)) (lsp-headerline-breadcrumb-mode))

(use-package helm-lsp) (use-package helm :config (helm-mode))

(use-package projectile :diminish projectile-mode :config (projectile-mode) :custom ((projectile-completion-system 'ivy)) :bind-keymap ("C-c p" . projectile-command-map) :init ;; NOTE: Set this to the folder where you keep your Git repos! (when (file-directory-p "~/Projects/Code") (setq projectile-project-search-path '("~/Projects/Code"))) (setq projectile-switch-project-action #'projectile-dired))

(use-package company :ensure t :init (add-hook 'after-init-hook 'global-company-mode)) (setq company-idle-delay 0)

(use-package company-anaconda :ensure t)

(use-package company-math :ensure t)

(use-package company-auctex :ensure t)

(use-package company-box :hook (company-mode . company-box-mode))

(use-package mmm-mode :ensure t :init (progn (setq mmm-global-mode 'maybe)) :config (progn (mmm-add-classes '((python-rst :submode rst-mode :front "^ [ru]?\"\"\"[^\"]$" :back "^ *\"\"\"" :include-front t :include-back t :end-not-begin t))) (mmm-add-mode-ext-class 'python-mode nil 'python-rst) (mmm-add-mode-ext-class 'sage-shell:sage-mode nil 'python-rst) ))

(use-package cython-mode :ensure t :mode (("\.pyx\'" . cython-mode) ("\.spyx\'" . cython-mode) ("\.pxd\'" . cython-mode) ("\.pxi\'" . cython-mode)))

(use-package python-mode :init (progn (add-hook 'python-mode-hook 'highlight-indentation-mode) (add-hook 'python-mode-hook 'anaconda-mode) (add-hook 'python-mode-hook 'eldoc-mode) (add-hook 'python-mode-hook 'sphinx-doc-mode))

:config (progn (setq-default python-indent 4) (setq python-fill-docstring-style 'onetwo)

      (when (executable-find "ipython")
        (setq
         python-shell-interpreter "ipython"
         python-shell-interpreter-args ""
         python-shell-prompt-regexp "In \\[[0-9]+\\]: "
         python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
         python-shell-completion-setup-code
         "from IPython.core.completerlib import module_completion"
         python-shell-completion-module-string-code
         "';'.join(module_completion('''%s'''))\n"
         python-shell-completion-string-code
         "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))))

(use-package which-key :init (which-key-mode) :diminish which-key-mode :config (setq which-key-idle-delay 0))

(use-package counsel :bind (("M-x" . counsel-M-x) ("C-x b" . counsel-ibuffer)) :config)

(use-package helpful :custom (counsel-describe-function-function #'helpful-callable) (counsel-describe-variable-function #'helpful-variable) :bind ([remap describe-function] . counsel-describe-function) ([remap describe-command] . helpful-command) ([remap describe-variable] . counsel-describe-variable) ([remap describe-key] . helpful-key)) (with-eval-after-load 'counsel (recentf-mode))

(use-package eglot-java)

(use-package pdf-tools :ensure t :config (add-hook 'pdf-view-mode-hook 'pdf-view-midnight-minor-mode) ) (pdf-tools-install) (use-package saveplace-pdf-view)

(require 'saveplace-pdf-view) (save-place-mode 1)

(defun my-render-org-table-at-point () (interactive) (save-excursion (beginning-of-line) (if (overlays-at (point)) ;; this is a rough solution, because there can ;; be other overlays at point (delete-overlay (car (overlays-at (point))))

(let* ((element-type (org-element-type (org-element-at-point))))
  (if (and (not (eq element-type 'table))
           (not (eq element-type 'table-row)))
      (error "not at an org table")

    (while (not (eq 'table (org-element-type (org-element-at-point))))
      (forward-line -1))

    (my-render-org-table (org-element-at-point)))))))

(use-package systemd)

(setq initial-scratch-message "") (setq initial-major-mode 'org-mode)

(use-package speed-type)

(recentf-mode 1) (setq recentf-max-menu-items 25) (setq recentf-max-saved-items 25) (global-set-key (kbd "C-x e") 'recentf-open-files)

(setq split-width-threshold 0) (setq split-height-threshold 100)

(use-package yasnippet :config (setq yas-snippet-dirs '("~/.emacs.d/snippets")) (yas-global-mode 1))

(use-package flycheck :ensure t :hook (org-mode . flyspell-mode) :hook (org-mode . flyspell-buffer) );;:init (global-flycheck-mode))

(with-eval-after-load "ispell" ;; Configure LANG, otherwise ispell.el cannot find a 'default ;; dictionary' even though multiple dictionaries will be configured ;; in next line. (setenv "LANG" "en_US.UTF-8") (setq ispell-program-name "hunspell") ;; Configure German, Swiss German, and two variants of English. (setq ispell-dictionary "de_DE,de_CH,en_GB,en_US") ;; ispell-set-spellchecker-params has to be called ;; before ispell-hunspell-add-multi-dic will work (ispell-set-spellchecker-params) (ispell-hunspell-add-multi-dic "de_DE,de_CH,en_GB,en_US") ;; For saving words to the personal dictionary, don't infer it from ;; the locale, otherwise it would save to ~/.hunspell_de_DE. (setq ispell-personal-dictionary "~/.hunspell_personal"))

;; The personal dictionary file has to exist, otherwise hunspell will ;; silently not use it. (unless (file-exists-p ispell-personal-dictionary) (write-region "" nil ispell-personal-dictionary nil 0))

ayorgo commented 1 year ago

This doesn't seem to be the org-fragtog's fault:

  1. Turn off org-fragtog
  2. Put the cursor onto a LaTeX fragment
  3. M-x org-latex-preview
  4. The same error appears

Seems like the bug isn't reproducible on a clean installation with just org-moge so something else may be at play here. I commented out my entire config.el but it didn't help. I use Doom however so maybe that's what it is (in my case at least).

Please refer to this thread for details.