I am trying to install org-mac-link on my Mac. I have downloaded the file org-mac-link.el to .emacs.d and also customized the org group by typing M-x customize-group RET org RET, then expand the Modules section, and enabled mac-link. But when I use (require 'org-mac-link) in my init file emacs gives an error since it says it can not find org-mac-link file.

This is part of my init file:

 ;; org-mac-link
 (require 'org-mac-link)
 (add-hook 'org-mode-hook (lambda ()
   (define-key org-mode-map (kbd "C-c g") 'org-mac-grab-link)))

You need to add the directory where org-mac-link.el is located to load-path, putting something like:

(push (expand-file-name "~/.emacs.d") load-path)

in your init file before the require

| improve this answer | |
  • First I got a warning: Warning (initialization): Your ‘load-path’ seems to contain your ‘.emacs.d’ directory: /Users/sergiobacelar/.emacs.d This is likely to cause problems... Consider using a subdirectory instead, e.g.: /Users/sergiobacelar/.emacs.d/lisp. I created a lisp folder and copied org-mac-link.el to it. Now it works with the org-mac-grab-link command but when I use "C-c g" it says it is undefined. – sbac Dec 13 '18 at 12:18
  • That sounds like the org-mode-hook hasn't been run. Does this happen from a fresh Emacs as well? – rpluim Dec 13 '18 at 13:12
  • I don't know what you mean by "fresh Emacs". My Emacs version is GNU Emacs 26.1 and my Org mode version is 9.1.14. – sbac Dec 13 '18 at 15:17
  • Sorry, "C-c g" works now when I am editing an org file. – sbac Dec 13 '18 at 16:46
  • I mean exiting emacs and starting it again. If you already had a buffer in org-mode before changing org-mode-hook, then that would have run the old version, and thus the keybinding would not have been done. – rpluim Dec 13 '18 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.