diff --git a/modules/defuns/defuns-org-notebook.el b/modules/defuns/defuns-org-notebook.el
index 05fb40cce..e68a31ff0 100644
--- a/modules/defuns/defuns-org-notebook.el
+++ b/modules/defuns/defuns-org-notebook.el
@@ -50,6 +50,8 @@
;;;###autoload (autoload 'narf:org-attach "defuns-org-notebook" nil t)
(evil-define-command narf:org-attach (&optional uri)
(interactive "")
+ (unless (eq major-mode 'org-mode)
+ (user-error "Not in an org-mode buffer"))
(if uri
(let* ((rel-path (org-download--fullname uri))
(new-path (f-expand rel-path))
@@ -96,7 +98,8 @@
(let ((attachments '())
element
file)
- (when (> (length (f-glob (concat (f-slash org-attach-directory) "*"))) 0)
+ (when (and (f-dir? org-attach-directory)
+ (> (length (f-glob (concat (f-slash org-attach-directory) "*"))) 0))
(save-excursion
(goto-char (point-min))
(while (progn (org-next-link) (not org-link-search-failed))
diff --git a/modules/defuns/defuns-org.el b/modules/defuns/defuns-org.el
index bbecd73c2..f69f5314e 100644
--- a/modules/defuns/defuns-org.el
+++ b/modules/defuns/defuns-org.el
@@ -342,7 +342,10 @@ re-align the table if necessary. (Necessary because org-mode has a
;;;###autoload (autoload 'narf:org-link "defuns-org" nil t)
(evil-define-command narf:org-link (link)
+ "Add LINK to the org buffer. If a selection is active, link selection to LINK."
(interactive "")
+ (unless (eq major-mode 'org-mode)
+ (user-error "Not in an org-mode buffer"))
(let ((beg evil-visual-beginning)
(end evil-visual-end))
(org-insert-link nil link (when (and beg end) (buffer-substring-no-properties beg end)))))