Closed llcc closed 8 years ago
I think your call to orgstruct-mode
is causing an autoload to bring in all of Org-mode. Try calling it only on the mode hooks where you'll want it, like `text-mode-hook'.
Thanks, I changed it to (add-hook 'org-mode-hook 'orgstruct-mode)
. But when I load it from start, it gave me (void-varible org-mode-map)
error. Is there any order of init
, config
and bind
?
Here is the detail of that error:
Debugger entered--Lisp error: (void-variable org-mode-map)
(or org-mode-map global-map)
(lookup-key (or org-mode-map global-map) key)
(let* ((name "M-,") (key (if (vectorp name) name (read-kbd-macro name))) (kdesc (cons (if (stringp name) name (key-description name)) (quote org-mode-map))) (binding (lookup-key (or org-mode-map global-map) key))) (add-to-list (quote personal-keybindings) (list kdesc (quote org-mark-ring-goto) (unless (numberp binding) binding))) (define-key (or org-mode-map global-map) key (quote org-mark-ring-goto)))
(bind-key "M-," (quote org-mark-ring-goto) org-mode-map)
(progn (bind-key "M-," (quote org-mark-ring-goto) org-mode-map) (bind-key "RET" (quote org-return-indent) org-mode-map))
(bind-keys :map org-mode-map ("M-," . org-mark-ring-goto) ("RET" . org-return-indent))
(ignore (bind-keys :map org-mode-map ("M-," . org-mark-ring-goto) ("RET" . org-return-indent)))
(progn (unless (fboundp (quote org-occur-in-agenda-files)) (autoload (function org-occur-in-agenda-files) "org" nil t)) (unless (fboundp (quote org)) (autoload (function org) "org" nil t)) (unless (fboundp (quote org-store-link)) (autoload (function org-store-link) "org" nil t)) (unless (fboundp (quote org-capture)) (autoload (function org-capture) "org" nil t)) (unless (fboundp (quote org-agenda)) (autoload (function org-agenda) "org" nil t)) (unless (fboundp (quote org-mark-ring-goto)) (autoload (function org-mark-ring-goto) "org" nil t)) (unless (fboundp (quote org-return-indent)) (autoload (function org-return-indent) "org" nil t)) (condition-case-unless-debug err (progn (add-hook (quote org-mode-hook) (quote visual-line-mode)) (add-hook (quote org-mode-hook) (quote orgstruct-mode))) (error (ignore (display-warning (quote use-package) (format "%s %s: %s" "org" ":init" (error-message-string err)) :error)))) (eval-after-load (quote org) (quote (let ((now (current-time))) (message "%s..." "Configuring package org") (prog1 (progn (condition-case-unless-debug err (progn ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (error ...)) (if (fboundp ...) (diminish ...)) (if (fboundp ...) (diminish ...)) (unless (fboundp ...) (autoload ... "org" nil t)) (unless (fboundp ...) (autoload ... "org" nil t)) (unless (fboundp ...) (autoload ... "org" nil t)) (unless (fboundp ...) (autoload ... "org" nil t)) (unless (fboundp ...) (autoload ... "org" nil t)) (unless (fboundp ...) (autoload ... "org" nil t)) (unless (fboundp ...) (autoload ... "org" nil t)) (ignore (bind-chords ...)) t) (let ((elapsed ...)) (if (> elapsed 0.1) (message "%s...done (%.3fs)" "Configuring package org" elapsed) (message "%s...done" "Configuring package org"))))))) (ignore (push (quote ("\\.\\(org\\|org_archive\\|txt\\)\\`" . org)) auto-mode-alist)) (ignore (bind-keys ("l" . org-store-link) ("C-c c" . org-capture) ("<f12>" . org-agenda))) (ignore (bind-keys :map org-mode-map ("M-," . org-mark-ring-goto) ("RET" . org-return-indent))))
(use-package org :mode "\\.\\(org\\|org_archive\\|txt\\)\\`" :init (add-hook (quote org-mode-hook) (quote visual-line-mode)) (add-hook (quote org-mode-hook) (quote orgstruct-mode)) :bind (("l" . org-store-link) ("C-c c" . org-capture) ("<f12>" . org-agenda)) :bind (:map org-mode-map ("M-," . org-mark-ring-goto) ("RET" . org-return-indent)) :chords (("--" . org-occur-in-agenda-files)) :diminish (orgstruct-mode visual-line-mode) :config (progn (use-package org-drill) (use-package org-mouse) (use-package ox-latex) (use-package ox-odt) (key-chord-define org-mode-map "cc" (quote org-ctrl-c-ctrl-c)) (setq org-directory "C:/Users/admin/GoogleDrive/Git/Org-mode" org-plantuml-jar-path "~/diagram/plantuml.jar" org-ditaa-jar-path "~/diagram/ditaa.jar" org-clock-sound "~/tms.wav") (setq org-use-fast-todo-selection t org-indirect-buffer-display (quote current-window)) (setq org-todo-state-tags-triggers (quote (("CANCELLED" ("CANCELLED" . t)) ("WAITING" ("WAITING" . t)) ("HOLD" ("WAITING") ("HOLD" . t)) (done ("WAITING") ("HOLD")) ("TODO" ("WAITING") ("CANCELLED") ("HOLD")) ("NEXT" ("WAITING") ("CANCELLED") ("HOLD")) ("DONE" ("WAITING") ("CANCELLED") ("HOLD"))))) (setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold) ("NEXT" :foreground "blue" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("WAITING" :foreground "orange" :weight bold) ("HOLD" :foreground "magenta" :weight bold) ("CANCELLED" :foreground "forest green" :weight bold) ("MEETING" :foreground "forest green" :weight bold) ("PHONE" :foreground "forest green" :weight bold)))) (setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00") ("STYLE_ALL" . "habit")))) (add-to-list (quote org-src-lang-modes) (quote ("plantuml" . fundamental))) (setq org-confirm-babel-evaluate nil org-src-window-setup (quote current-window) org-export-allow-bind-keywords t org-imenu-depth 3) (setq org-agenda-span 14) (setq org-babel-sh-command "cmd /k")))
eval((use-package org :mode "\\.\\(org\\|org_archive\\|txt\\)\\`" :init (add-hook (quote org-mode-hook) (quote visual-line-mode)) (add-hook (quote org-mode-hook) (quote orgstruct-mode)) :bind (("l" . org-store-link) ("C-c c" . org-capture) ("<f12>" . org-agenda)) :bind (:map org-mode-map ("M-," . org-mark-ring-goto) ("RET" . org-return-indent)) :chords (("--" . org-occur-in-agenda-files)) :diminish (orgstruct-mode visual-line-mode) :config (progn (use-package org-drill) (use-package org-mouse) (use-package ox-latex) (use-package ox-odt) (key-chord-define org-mode-map "cc" (quote org-ctrl-c-ctrl-c)) (setq org-directory "C:/Users/admin/GoogleDrive/Git/Org-mode" org-plantuml-jar-path "~/diagram/plantuml.jar" org-ditaa-jar-path "~/diagram/ditaa.jar" org-clock-sound "~/tms.wav") (setq org-use-fast-todo-selection t org-indirect-buffer-display (quote current-window)) (setq org-todo-state-tags-triggers (quote (("CANCELLED" ("CANCELLED" . t)) ("WAITING" ("WAITING" . t)) ("HOLD" ("WAITING") ("HOLD" . t)) (done ("WAITING") ("HOLD")) ("TODO" ("WAITING") ("CANCELLED") ("HOLD")) ("NEXT" ("WAITING") ("CANCELLED") ("HOLD")) ("DONE" ("WAITING") ("CANCELLED") ("HOLD"))))) (setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold) ("NEXT" :foreground "blue" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("WAITING" :foreground "orange" :weight bold) ("HOLD" :foreground "magenta" :weight bold) ("CANCELLED" :foreground "forest green" :weight bold) ("MEETING" :foreground "forest green" :weight bold) ("PHONE" :foreground "forest green" :weight bold)))) (setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00") ("STYLE_ALL" . "habit")))) (add-to-list (quote org-src-lang-modes) (quote ("plantuml" . fundamental))) (setq org-confirm-babel-evaluate nil org-src-window-setup (quote current-window) org-export-allow-bind-keywords t org-imenu-depth 3) (setq org-agenda-span 14) (setq org-babel-sh-command "cmd /k"))))
esup-child-profile-string(#("(use-package org\n:mode \"\\\\.\\\\(org\\\\|org_archive\\\\|txt\\\\)\\\\`\"\n:init\n(add-hook 'org-mode-hook 'visual-line-mode)\n(add-hook 'org-mode-hook 'orgstruct-mode)\n:bind ((\"\\C-cl\" . org-store-link)\n(\"C-c c\" . org-capture)\n(\"<f12>\" . org-agenda))\n:bind (:map org-mode-map\n(\"M-,\" . org-mark-ring-goto)\n(\"RET\" . org-return-indent))\n:chords ((\"--\" . org-occur-in-agenda-files))\n:diminish (orgstruct-mode visual-line-mode)\n:config\n(progn\n(use-package org-drill)\n(use-package org-mouse)\n;; (use-package org-habit)\n(use-package ox-latex)\n(use-package ox-odt)\n;; (use-package ox-freemind)\n\n(key-chord-define org-mode-map \"cc\" 'org-ctrl-c-ctrl-c)\n\n(setq org-directory \"C:/Users/admin/GoogleDrive/Git/Org-mode\"\norg-plantuml-jar-path \"~/diagram/plantuml.jar\"\norg-ditaa-jar-path \"~/diagram/ditaa.jar\"\norg-clock-sound \"~/tms.wav\")\n\n(setq org-use-fast-todo-selection t\norg-indirect-buffer-display 'current-window)\n\n(setq org-todo-state-tags-triggers\n(quote ((\"CANCELLED\" (\"CANCELLED\" . t))\n(\"WAITING\" (\"WAITING\" . t))\n(\"HOLD\" (\"WAITING\") (\"HOLD\" . t))\n(done (\"WAITING\") (\"HOLD\"))\n(\"TODO\" (\"WAITING\") (\"CANCELLED\") (\"HOLD\"))\n(\"NEXT\" (\"WAITING\") (\"CANCELLED\") (\"HOLD\"))\n(\"DONE\" (\"WAITING\") (\"CANCELLED\") (\"HOLD\")))))\n\n(setq org-todo-keyword-faces\n(quote ((\"TODO\" :foreground \"red\" :weight bold)\n(\"NEXT\" :foreground \"blue\" :weight bold)\n(\"DONE\" :foreground \"forest green\" :weight bold)\n(\"WAITING\" :foreground \"orange\" :weight bold)\n(\"HOLD\" :foreground \"magenta\" :weight bold)\n(\"CANCELLED\" :foreground \"forest green\" :weight bold)\n(\"MEETING\" :foreground \"forest green\" :weight bold)\n(\"PHONE\" :foreground \"forest green\" :weight bold))))\n\n(setq org-global-properties\n(quote ((\"Effort_ALL\" . \"0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00\")\n(\"STYLE_ALL\" . \"habit\"))))\n; Make babel results blocks lowercase\n(add-to-list 'org-src-lang-modes (quote (\"plantuml\" . fundamental)))\n\n(setq org-confirm-babel-evaluate nil\norg-src-window-setup 'current-window\norg-export-allow-bind-keywords t\norg-imenu-depth 3)\n\n(setq org-agenda-span 14)\n\n(setq org-babel-sh-command \"cmd /k\")))" 0 17 (fontified nil) 17 61 (fontified nil) 61 67 (fontified nil) 67 111 (fontified nil) 111 153 (fontified nil) 153 187 (fontified nil) 187 211 (fontified nil) 211 235 (fontified nil) 235 260 (fontified nil) 260 289 (fontified nil) 289 318 (fontified nil) 318 363 (fontified nil) 363 407 (fontified nil) 407 415 (fontified nil) 415 422 (fontified nil) 422 446 (fontified nil) 446 470 (fontified nil) 470 497 (fontified nil) 497 520 (fontified nil) 520 541 (fontified nil) 541 571 (fontified nil) 571 627 (fontified nil) 627 628 (fontified nil) 628 690 (fontified nil) 690 737 (fontified nil) 737 778 (fontified nil) 778 808 (fontified nil) 808 844 (fontified nil) 844 890 (fontified nil) 890 925 (fontified nil) 925 965 (fontified nil) 965 993 (fontified nil) 993 1027 (fontified nil) 1027 1055 (fontified nil) 1055 1099 (fontified nil) 1099 1143 (fontified nil) 1143 1191 (fontified nil) 1191 1220 (fontified nil) 1220 1268 (fontified nil) 1268 1309 (fontified nil) 1309 1358 (fontified nil) 1358 1404 (fontified nil) 1404 1448 (fontified nil) 1448 1502 (fontified nil) 1502 1554 (fontified nil) 1554 1607 (fontified nil) 1607 1608 (fontified nil) 1608 1636 (fontified nil) 1636 1713 (fontified nil) 1713 1740 (fontified nil) 1740 1778 (fontified nil) 1778 1848 (fontified nil) 1848 1885 (fontified nil) 1885 1922 (fontified nil) 1922 1955 (fontified nil) 1955 1975 (fontified nil) 1975 2002 (fontified nil) 2002 2040 (fontified nil)) "c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/lisp/setting.el" 50 1524 4094)
esup-child-profile-sexp(1524 4094 1)
esup-child-profile-buffer(#<buffer setting.el> 1)
esup-child-profile-file("c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/lisp/setting.el" 1)
esup-child-profile-sexp(935 989 0)
esup-child-profile-buffer(#<buffer init.el> 0)
esup-child-profile-file("c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/init.el" 0)
esup-child-run("c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/init.el" "26941")
eval((esup-child-run "c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/init.el" "26941"))
command-line-1(("-L" "c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/elpa/esup-20151227.950/" "-l" "esup-child" "--eval=(esup-child-run \"c:/Users/admin/GoogleDrive/Git/Configurations/Emacs/.emacs.d/init.el\" \"26941\")"))
command-line()
normal-top-level()
That's right, :bind (:map
does not currently lazily apply to the given map. So to make binding on that map, you'll have to use bind-keys
within the :config
section for now.
Same error occurred if I bind keys to org-mode-map in some other places(like other use-package
environment). It means that the variable of org-mode-map
is still not loaded after (use-package org-mode)
?
I exchanged the place of init and config and solved the error. But the loading time is still not normal (14s)
(use-package org
:mode "\\.\\(org\\|org_archive\\|txt\\)\\`"
:config
(add-hook 'org-mode-hook 'visual-line-mode)
(add-hook 'text-mode-hook 'orgstruct-mode)
:bind (("\C-cl" . org-store-link)
("C-c c" . org-capture)
("<f12>" . org-agenda))
:chords (("--" . org-occur-in-agenda-files))
:diminish (orgstruct-mode visual-line-mode)
:init
(progn
(use-package org-drill)
(use-package org-mouse)
;; (use-package org-habit)
(use-package ox-latex)
(use-package ox-odt)
;; (use-package ox-freemind)
(key-chord-define org-mode-map "cc" 'org-ctrl-c-ctrl-c)
(bind-keys :map org-mode-map
("M-," . org-mark-ring-goto)
("RET" . org-return-indent))
(define-key org-mode-map (kbd "<drag-n-drop>") 'my-dnd-func)
(define-key org-mode-map (kbd "<C-drag-n-drop>") 'my-dnd-func)
(define-key org-mode-map (kbd "<M-drag-n-drop>") 'my-dnd-func)
(setq org-directory "C:/Users/admin/GoogleDrive/Git/Org-mode"
org-plantuml-jar-path "~/diagram/plantuml.jar"
org-ditaa-jar-path "~/diagram/ditaa.jar"
org-clock-sound "~/tms.wav")
(setq org-use-fast-todo-selection t
org-indirect-buffer-display 'current-window)
(setq org-todo-state-tags-triggers
(quote (("CANCELLED" ("CANCELLED" . t))
("WAITING" ("WAITING" . t))
("HOLD" ("WAITING") ("HOLD" . t))
(done ("WAITING") ("HOLD"))
("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
(setq org-todo-keyword-faces
(quote (("TODO" :foreground "red" :weight bold)
("NEXT" :foreground "blue" :weight bold)
("DONE" :foreground "forest green" :weight bold)
("WAITING" :foreground "orange" :weight bold)
("HOLD" :foreground "magenta" :weight bold)
("CANCELLED" :foreground "forest green" :weight bold)
("MEETING" :foreground "forest green" :weight bold)
("PHONE" :foreground "forest green" :weight bold))))
(setq org-global-properties
(quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
("STYLE_ALL" . "habit"))))
; Make babel results blocks lowercase
(add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
(setq org-confirm-babel-evaluate nil
org-src-window-setup 'current-window
org-export-allow-bind-keywords t
org-imenu-depth 3)
(setq org-agenda-span 14)
(setq org-babel-sh-command "cmd /k")))
while you are at it trying to optimize for speed you should also move the other use-package calls from :init
to :config
so that they are not loaded until needed. You also have a key-chord-define
which also possibly references the org mode map before org is loaded.
14 seconds is a lot though.
Its very weird.
I found that even a simple (require 'sauron-elfeed)
costs 5s. Might be some problems about the emacs itself.
What about emacs -q
? Same long loading times?
@kovrik no, time is reduced to 0.3s.
@llcc So, it might be your config that causes such long loading times.
1) I'd suggest checking hooks.
2)
Also, try wrapping your init with (let ((file-name-handler-alist nil)) ... )
and try some tweaks:
(setq gc-cons-threshold 100000000)
(let ((file-name-handler-alist nil))
(require 'package)
(setq package-enable-at-startup nil)
...
** your config goes here **
...
)
(setq gc-cons-threshold (* 100 1024 1024))
(provide 'init)
;;; init.el ends here
Hi @jwiegley, thanks for your great package.
I am trying to use it to load org-mode. But it seems to take very long time to load(in this circumstance below 17.486s, measured by https://github.com/jschaf/esup.). Is there any problem about the usage of
use-package
?