emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] FW: [RFC] Link-type for attachments, more attach options


From: stardiviner
Subject: Re: [O] FW: [RFC] Link-type for attachments, more attach options
Date: Wed, 15 Jan 2020 14:20:32 +0800
User-agent: mu4e 1.3.2; emacs 27.0.50

Gustav Wikström <address@hidden> writes:

> Hi,
>
>> -----Original Message-----
>> From: Emacs-orgmode <emacs-orgmode-bounces+gustav=address@hidden> On
>> Behalf Of stardiviner
>> Sent: den 13 januari 2020 14:42
>> To: address@hidden
>> Subject: Re: [O] FW: [RFC] Link-type for attachments, more attach options
>> 
>> 
>> I found when I set option ~(setq org-attach-store-link-p t)~. Then attach
>> a file, store file link with =[C-c C-l]=. The stored link. I open this
>> link got error "No such file: ....". I tested this with minimal Emacs
>> config. confirmed this problem.
>> 
>
> I cannot reproduce this. In my try with a minimal Emacs (emacs -q) and with 
> only that single customization it works for me. I'm testing it in linux. A 
> wild guess.. Could it be that you used the move operation instead of the copy 
> operation when attaching the file?
>
> Regards
> Gustav

Did you reproduce this issue with =emacs -q= ? That is a built-in Org Mode 
version
which does not contains the latest version =org-attach.el=.

Here is my minimal Emacs config:

#+begin_src emacs-lisp :tangle "~/.config/emacs/minimal-init.el"
(package-initialize)

;;; add my init files directory

(add-to-list 'load-path "/usr/share/emacs/site-lisp/")

(add-to-list 'load-path (expand-file-name "init" user-emacs-directory))

;; recursively load init files.
(let ((default-directory (expand-file-name "init" user-emacs-directory)))
  (setq load-path
        (append
         (let ((load-path (copy-sequence load-path))) ; shadow
           (append
            (copy-sequence (normal-top-level-add-to-load-path '(".")))
            (normal-top-level-add-subdirs-to-load-path)))
         load-path)))

(setq load-prefer-newer t)

;;; [ package.el ] -- Emacs Lisp Package Archive (ELPA)

(require 'package)

(setq package-enable-at-startup nil)

(setq package-menu-async t)

(setq package-user-dir (expand-file-name "elpa" user-emacs-directory))

;;; ELPA Mirrors
;; (setq-default package-archives
;;            '(("gnu" . "https://elpa.gnu.org/packages/";)
;;              ("melpa" . "http://melpa.org/packages/";)
;;              ("melpa-stable" . "http://stable.melpa.org/packages/";)
;;              ("marmalade" . "http://marmalade-repo.org/packages/";)
;;              ("org"   . "http://orgmode.org/elpa/";)))

(setq-default package-archives
              '(("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/";)
                ("org"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/";)
                ("gnu"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/";)))

(let* ((elpa-archives-dir (expand-file-name "elpa/archives/" 
user-emacs-directory))
       (elpa-gnu-archives-dir (concat elpa-archives-dir "gnu"))
       (elpa-melpa-archives-dir (concat elpa-archives-dir "melpa"))
       (elpa-org-archives-dir (concat elpa-archives-dir "org")))
  (unless (and (file-exists-p elpa-gnu-archives-dir)
               (file-exists-p elpa-melpa-archives-dir)
               (file-exists-p elpa-org-archives-dir))
    (package-refresh-contents)))

(package-initialize)

(add-to-list 'display-buffer-alist
             '("^\\*package-build-result\\*"
               (display-buffer-reuse-window display-buffer-below-selected)))


;;; Load `use-package' ahead before `package-initialize' for (use-package org 
:pin manual ...).
;;; [ use-package ]

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))
(require 'bind-key)                     ; if you use any `:bind' variant
(use-package delight                    ; if you use `:delight'
  :ensure t)
;; (use-package deminish                   ; if you use `:diminish'
;;   :ensure t)

(setq use-package-verbose t ; 'debug: any evaluation errors report to 
`*use-package*` buffer.
      use-package-always-ensure nil)

;;; use latest source code version Org Mode.
(if (not (file-exists-p "~/Code/Emacs/org-mode/lisp/"))
    (progn
      (use-package org
        :pin org
        :ensure t
        :preface (setq org-modules nil)
        :mode (("\\.org\\'" . org-mode)))
      (use-package org-plus-contrib
        :pin org
        :ensure t))

  ;; disable Emacs built-in Org Mode
  (delete (format "/usr/local/share/emacs/%s/lisp/org" emacs-version) load-path)
  (delete "/usr/share/emacs/site-lisp/org/" load-path)
  
  (use-package org
    :pin manual
    :load-path "~/Code/Emacs/org-mode/lisp/"
    :defer t
    :preface
    ;; Org Mode modules -- modules that should always be loaded together with 
org.el.
    ;; t: greedy load all modules.
    ;; nil: disable all extra org-mode modules to speed-up Org-mode file 
opening.
    (setq org-modules nil)
    :mode (("\\.org\\'" . org-mode))
    :init
    ;; add source code version Org-mode Info into Emacs.
    (with-eval-after-load 'info
      (add-to-list 'Info-directory-list "~/Code/Emacs/org-mode/doc/")
      (info-initialize))
    ;; load org before using some Org settings.
    (require 'org)
    (use-package org-plus-contrib
      :pin manual
      :load-path "~/Code/Emacs/org-mode/contrib/lisp/"
      :defer t
      :no-require t)))

;;==============================================================================
;;; Here is org-attach.el customization

(require 'org-attach)

;; store link auto with `org-store-link' using `file:' link type or 
`attachment:' link type.
(setq org-attach-store-link-p 'attached)
(setq org-attach-dir-relative t)
(setq org-attach-preferred-new-method 'ask)
#+end_src

#+begin_src sh :eval no
emacs -q -l '~/.config/emacs/minimal-init.el'
#+end_src

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]