On Wed, 23 Oct 2002 16:48:27 -0500
"bulia byak" <[EMAIL PROTECTED]> wrote:

> Some time ago I asked if it's possible to copy the filename under
> cursor in mc to the X clipboard so it can be pasted into other
> programs. Now I have implemented this using the xclip utility (see
> http://people.debian.org/~kims/xclip/). I created a shell script
> that takes a string as argument and puts it into both primary
> selection and the clipboard buffer:
> 
> #!/bin/sh
> echo -n $1 | xclip -i -selection clipboard
> echo -n $1 | xclip -i -selection primary
> 
> Then, in src/main.c, I added a function that calls system() with a
> command line concatenated from the name of the shell script and the
> current file name, including path (code borrowed from
> copy_current_pathname and copy_prog_name, but without stuffing it
> into the command prompt). Then I added a new entry to default_map to
> bind this function to a key, and that was all.
> 
> One caveat: the current version of xclip does not work with KDE
> apps, so only non-KDE apps can paste the clipboard. The author of
> xclip was planning to fix this in the next version.
> 
> I do not publish the actual patch because it's rather messy
> (although it works) and because this just a temporary solution. The
> correct solution is (as I wrote before) to allow the user to define
> the keymaps via a config file, without recompilation. The syntax for
> this config file should allow binding keys not only to mc's own
> functions, but also to arbitrary shell commands (to be run through
> system()). As in the bindings file, these commands must be able to
> grok substitutions such as %f or %p referring to the currently
> selected file (or tagged files). If anyone would program such a
> configuration system for keybindings, this would be really great for
> users who have better things to do than recompile mc on every
> keybinding change :) (Unfortunately I'm not a programmer - I can 
> only do quick hacks for what I need, not write production code.)
> 
> Meanwhile, I'm planning to use the above approach to implement 
> copying the selected fragment from the mc built-in editor to 
> the clipboard. 

That sounds wonderful. I use mc's internal editor heavily for all things that dont 
require fonts. I have had many occasions where cuting and pasting would have been nice.

//danneh

> 
> -- 
> __________________________________________________________
> Sign-up for your own FREE Personalized E-mail at Mail.com
> http://www.mail.com/?sr=signup
> 
> _______________________________________________
> Mc mailing list
> [EMAIL PROTECTED]
> http://mail.gnome.org/mailman/listinfo/mc
_______________________________________________
Mc mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/mc

Reply via email to