org-mode export 代码缩进问题

我用org-mode 导出成html,但是org file中的文件代码缩进失效了,变成了这样


不清楚怎么回事,可能跟你的代码本身缩进有关系,比如同时 TAB 和 Space 缩进的话,可能只有在 Emacs 里看正常的。你可以把你的 Org 文件的相关部分贴出来瞧一瞧。

(use-package org
  :ensure t
  :mode ("\\.org\\'" . org-mode)
  :init (progn
	  (add-hook 'org-src-mode-hook 'samray/disable-flycheck-in-org-src-block)
          (setq org-todo-keyword-faces
                  ("PROCESSING" . (:foreground "gold" :weight bold))
          (setq org-todo-keywords
                '((sequence "TODO" "PROCESSING" "DONE")))
          (setq org-priority-faces '((?A . (:foreground "red" :weight 'bold))
                                     (?B . (:foreground "blue"))
                                     (?C . (:foreground "green"))))
          (defun samray/org-skip-subtree-if-priority (priority)
            "Skip an agenda subtree if it has a priority of PRIORITY.
PRIORITY may be one of the characters ?A, ?B, or ?C."
            (let ((subtree-end (save-excursion (org-end-of-subtree t)))
                  (pri-value (* 1000 (- org-lowest-priority priority)))
                  (pri-current (org-get-priority (thing-at-point 'line t))))
              (if (= pri-value pri-current)
	   (with-eval-after-load 'org
             (require 'ob-python)
              '((clojure . t)
                (lisp . t)
                (org . t)
                (js . t)
                (latex . t)
                (ruby . t)
                (shell . t)
                (python . t)
                (emacs-lisp . t)
                (awk . t)
                (sql . t)
                (sqlite . t)))
	     (setq org-agenda-files '("~/SyncDirectory/Org/" "~/SyncDirectory/Org/"))
	     (setq org-agenda-custom-commands
		   '(("c" "agenda view with alltodo sorted by priorities"
		      ((tags "PRIORITY=\"A\""
			     ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
			      (org-agenda-overriding-header "High-priority unfinished tasks:")))
		       (agenda "")
		       (alltodo ""
				  '(or (samray/org-skip-subtree-if-priority ?A)
				       (org-agenda-skip-if nil '(scheduled deadline))))))))))
	     ;;each time you turn an entry from a TODO (not-done) state
	     ;;into any of the DONE states, a line ‘CLOSED: [timestamp]’ will
	     ;;be inserted just after the headline
	     (setq org-log-done 'time)
	     (setq org-capture-templates
		   '(("a" "Agenda" entry (file  "~/SyncDirectory/Org/" "Agenda")
		      "* TODO %?\n:PROPERTIES:\n\n:END:\nDEADLINE: %^T \n %i\n")
		     ("n" "Note" entry (file+headline "~/SyncDirectory/Org/" "Notes")
		      "* Note %?\n%T")
		     ("l" "Link" entry (file+headline "~/SyncDirectory/Org/" "Links")
		      "* %? %^L %^g \n%T" :prepend t)
		     ("b" "Blog idea" entry (file+headline "~/SyncDirectory/Org/" "Blog Topics:")
		      "* %?\n%T" :prepend t)
		     ("t" "To Do Item" entry (file+headline "~/SyncDirectory/Org/" "To Do Items")
		      "* TODO  %?\n  %i\n" :prepend t)
		     ("j" "Journal" entry (file+datetree "~/SyncDirectory/Org/")
		      "* %?\nEntered on %U\n  %i\n  %a")
	     ;;GUI Emacs could display image.But if the image is too large,
	     ;;it works so weird
	     (setq org-image-actual-width '(500))
	     ;; make sure org-mode syntax highlight source code
	     ;; Make TAB act as if it were issued in a buffer of the
	     ;;language’s major mode.
	     (setq org-src-fontify-natively t
		   org-src-tab-acts-natively t)
             ;; When editing a code snippet,use the current window rather than
	     ;; popping open a new one
	     (setq org-src-window-setup 'current-window)
	     ;; I like seeing a little downward-pointing arrow instead of the
	     ;;usual ellipsis (...) that org displays when there’s stuff under
	     ;; a header.
             (setq org-ellipsis "⤵")
             ;;Its default value is (ascii html icalendar latex)
             (setq org-export-backends '(latex icalendar))
             ;; Show org-edit-special in the other-window
             (setq org-src-window-setup 'other-window)
             ;; use minted to highlight code in latex
             (add-to-list 'org-latex-packages-alist '("" "minted"))
             (setq org-latex-listings 'minted)
             ;; execute code without confirm
             (setq org-confirm-babel-evaluate nil)
             ;; set latex to xelatex
             ;; org-mode 8.0
             (setq org-latex-pdf-process '("xelatex -interaction nonstopmode %f"
                                           "xelatex -interaction nonstopmode %f"))
             ;; export cn character
             (setf org-latex-default-packages-alist
                   (remove '("AUTO" "inputenc" t) org-latex-default-packages-alist))
	     (require 'ox-md nil t)
             (require 'ox-latex )


我的意思是 Org 文档本身,因为首先需要知道怎么重现。


   例如shell在底下弹出,或者是关闭,然后找到了[[][Shell-pop]] 这package,就可以用回
   Spacemacs的shell使用习惯。然后我觉得,Ipython shell也可以这样配置,只不过
   我没有发现类似的package,又因为Emacs Lisp的强大,所以我自己写了一段小函数实现
   shell-pop 的功能
   #+BEGIN_SRC emacs-lisp

     (defun samray/python-pop ()
       "Run python and switch to the python buffer.
     similar to shell-pop"
       (if (get-buffer "*Python*")
           (if (string= (buffer-name) "*Python*")
               (if (not (one-window-p))
                   (progn (bury-buffer)
             (progn (switch-to-buffer-other-window "*Python*")
           (switch-to-buffer-other-window "*Python*")