[Request] Slackpkg custom merge tool.
Hi,
I checked slackpkg sources, and found that it was using sdiff to merge configurations files. I'd like to use another merge tool (emacs to be precise :) ). Would it be possible to make the merge tool customizable ? It would be great to be able to change the sdiff default using an environment variable. If any help needed, I'd be glad to participate (at least for testing ;) ). Thanks ! Bests, Garry. Edit: It could be in slackpkg.conf too, but an external environment variable could make this more "versatile". |
so that means all users wanting to use slackpkg should install emacs?
i don't think most users will agree on this one :) i personally don't install emacs and i think sdiff works for me |
Quote:
I asked to be able to choose which merge tool you want to use. With an environment variable. I mentioned emacs just because it's the one I want to use in my particular situation... |
i guess the main important is what's the advantage of using emacs compared to sdiff?
|
Quote:
|
Quote:
But I am really curious about that, what exactly do you want to achieve with the switch to Emacs? |
no, it's not a joke
i know emacs is a great application and some might like it and prefer it compared to vi or nano, but i don't see anything different with the results of diff by changing to emacs (please, CMIIW) |
Quote:
It's before all a matter of being more productive to be able to use the tool you're used to use in your daily tasks. That's seems obvious to me. Beside I don't ask for emacs (I thought my OP was clear about that)... I ask to be able to have an environment variable to be able to customize. Default would be ie: Code:
SLACKPKG_MERGE_TOOL=sdiff -s -o Code:
SLACKPKG_MERGE_TOOL=mymergetool-of-my-choice --with --my --args I use emacs, but many others use vim so I'm not doing some "emacs evangelization" and don't want to enter in this mode... I was just talking about giving slackpkg some more flexibility. And I'm open to any point which could be about "not in the plan" or "difficult to maintain" although I really don't see (I might be wrong) any difficult problem here. In practice it could even be a wrapper script that shuffle arguments if the wanted merge tool is too exotic. Thanks Garry. |
Quote:
And I don't see the need to argue "which one is better" because ultimately, it's a matter of choice, is it personal or professional/corporate... Anyway. I'm not saying sdiff is rubbish, sdiff is good when you don't have anything else accessible. I'd just rather use emacs for that, it's a choice as any choice. Edit: obviously, I hope there's no difference in the 'result of diff' haha... It's on the way you do the merge, which color you want etc. Usability in short, productivity for a longer word. Edit2: also it's less error prone to use something you're used to use... And config files merges can sometimes be "sensible". Edit3: sorry, I can understand the problem now, I'm talking about having 'interactive merge tool'. And now I see that it might introduce more changes in slackpkg behavior. But I guess it's not something impossible. So that was maybe the source of misunderstanding. But sdiff is interactive too so at the end, it seems to me that the point is the same. |
Slackpkg is designed to be easy to customise. I actually implement a custom merge using vimdiff. I find it useful for updating large config files with custom entries e.g. for cups and ssh. Adapting this for emacs should not be difficult.
I edit /usr/libexec/slackpkg/functions.d/postfunctions.sh Code:
--- post-functions.sh.orig 2013-02-21 21:07:05.408637573 +1100 |
Quote:
I know this file, it's just I'd rather not modify/patch it, and I myself don't want to use emacs all the time. That's why I was talking about an environment variable... In the function mergenew(), instead of: Code:
sdiff -s -o "${FULLNAME}.smerge" "${FULLNAME}" "${FULLNAME}.new" Code:
$SLACKPKG_MERGE_TOOL "${FULLNAME}.smerge" "${FULLNAME}" "${FULLNAME}.new" Code:
SLACKPKG_MERGE_TOOL=${SLACKPKG_MERGE_TOOL:-sdiff -s -o} As simple as this. No one lose anything, does it ? Cheers Garry. |
I find that having another menu entry is more convenient than setting an environment variable.
Editing postfunctions.sh is only a problem when it gets overwritten by a package update. |
Quote:
- consistency: it's like the common $EDITOR env var used in many places. - complexity: a menu requires more modification and imply to know which options you want to provide, and each must be tested upstream (this might become a PITA for developers) - flexibility: a variable can be set to anything the user want, even a yet unknown tool or a wrapper script that provide an "unified" interface. Plus you can set the variable in a script (or the .bashrc file) and it's not difficult. On my point of view the variable is more "UNIX" in style and flavor, it's a very tiny modification and open to more choice. BTW, it's my developer reflex and my preference, I don't know what slackpkg developers prefer, it's up to them. |
One argument for avoiding using emacs is that it requires X to be running. I prefer to do my upgrades from run level 3, so vimdiff is a viable choice for that.
|
Quote:
(Edit: And even in graphical environment I tend to use the console version of emacs...) |
All times are GMT -5. The time now is 01:36 AM. |