emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "numbchild@gmail.com" <numbchild@gmail.com>
To: Chunyang Xu <mail@xuchunyang.me>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Asks user what to do with each tangle-file before overriding?
Date: Mon, 19 Jun 2017 13:06:57 +0800	[thread overview]
Message-ID: <CAL1eYuL=wGxwh=pBoPAeBiirfYytObjG8mddVoPmDwFzq1W2Cg@mail.gmail.com> (raw)
In-Reply-To: <m2o9toldr3.fsf@xuchunyang.me>

[-- Attachment #1: Type: text/plain, Size: 1886 bytes --]

I also think Org-mode table src block content to override file is dangerous.

I have another idea. Append src block content to end of file.

I have a sceniro:

File `dotfile-1.org`:
```
* SSH config 1

#+BEGIN_SRC conf :tangle "~/.ssh/config"
fragment 1
#+END_SRC
```

File `dotfile-2.org`:
```
* SSH config 2

#+BEGIN_SRC conf :tangle "~/.ssh/config"
fragment 2
#+END_SRC

```

When the tangle src blocks are in separate files, this override file way is
not suitable.
Of course I can put those src blcoks together, but when I have to organize
literate programming files in separately, the override way is not suitable
anymore. So hope Org-mode can provide `append` way with an `defcustom`
option.


[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Fri, Jun 16, 2017 at 1:09 PM, Chunyang Xu <mail@xuchunyang.me> wrote:

> Hi,
>
> Currently 'C-c C-v C-t' ('org-babel-tangle') simply overrides existing
> tangle-file, I would like org to ask me what to do? such as
>
> a) yes (override)
> b) no (don't override)
> c) show the diff then ask again
>
> In addition, if there is no diff (i.e., having the same contents), user
> can choose (e.g., via a user option) to simply pass this tangle-file
> without overriding.
>
> I am asking for this feature because I am storing my dotfiles in a
> single Org file [1], and when I change my Bash configuration then
> tangle, I don't need to worry if Org is tangling other configuration
> correctly, especially ~/.ssh/id_rsa and ~/.authinfo.gpg. I would rather
> leave these unchanged files than override (even only file modification
> timestamps are updated).
>
> [1] https://raw.githubusercontent.com/xuchunyang/dotfiles/
> master/README.org
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 4925 bytes --]

      parent reply	other threads:[~2017-06-19  5:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16  5:09 Asks user what to do with each tangle-file before overriding? Chunyang Xu
2017-06-18  7:23 ` Nicolas Goaziou
2017-06-18 11:21   ` Chunyang Xu
2017-06-18 17:12     ` Charles C. Berry
2017-06-19  4:57       ` Chunyang Xu
2017-06-19  5:06 ` numbchild [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL1eYuL=wGxwh=pBoPAeBiirfYytObjG8mddVoPmDwFzq1W2Cg@mail.gmail.com' \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@xuchunyang.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).