Re: [Vimprobable-users] Editor patch evolution
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
|
From: Serge E. H. <se...@ha...> - 2012-10-07 19:05:31
|
Quoting Markus Demleitner (msd...@ar...):
> Hi list,
>
> On Sat, Oct 06, 2012 at 12:07:08PM +0200, Alexander Foremny wrote:
> > Possibly one could introduce an option in vimprobablerc which
> > overrides the environment if it is specified? This seems to be common
> > in other UNIX applications.
> Well, I'm not sure if all that configurability is not a bit of an
> overkill for something like that, but it's not much code, so here's a
> patch that
>
> (a) evaluates TMPDIR, if set, and
> (b) lets you set a variable tempdir in .vimprobablerc (or
> interactively)
Thanks - this suffices for me. I could see it being backward for some
people where inherited env gives them a TMPDIR, but mine is unset by
default.
Indeed since I run vimprobable through tabbed, setting a vimprobable-
specific TMPDIR would be more convoluted than setting it in the
vimprobablerc, so this is perfect.
> The patch applies on top of last week's editor patch (talking about
> which: If I'd like to get this stuff into the upstream git, what
> would I do?)
>
> Cheers,
>
> Markus
> diff --git a/config.h b/config.h
> index 45957c4..860a0fc 100644
> --- a/config.h
> +++ b/config.h
> @@ -20,6 +20,7 @@ static const gboolean enablePlugins = TRUE; /* TRUE keeps plugins enabled */
> static const gboolean enableJava = TRUE; /* FALSE disables Java applets */
> static const gboolean enablePagecache = FALSE; /* TRUE turns on the page cache. */
> static gboolean escape_input_on_load = TRUE; /* TRUE will disable automatic focusing of input fields via Javascript*/
> +char temp_dir[MAX_SETTING_SIZE] = "/tmp"; /* location of temporary files, default will be overridden if TEMPDIR is set */
>
> /* appearance */
> char statusbgcolor[MAX_SETTING_SIZE] = "#000000"; /* background color for status bar */
> @@ -209,4 +210,5 @@ static Setting browsersettings[] = {
> { "escapeinput", NULL, "", FALSE, TRUE, FALSE, FALSE },
> { "strictssl", NULL, "", FALSE, TRUE, FALSE, FALSE },
> { "cabundle", ca_bundle, "", FALSE, FALSE, FALSE, FALSE },
> + { "tempdir", temp_dir, "", FALSE, FALSE, FALSE, FALSE },
> };
> diff --git a/main.c b/main.c
> index 36e0edb..f82c2cb 100644
> --- a/main.c
> +++ b/main.c
> @@ -1837,7 +1837,8 @@ open_editor(const Arg *arg) {
> gboolean success;
> GPid child_pid;
> gchar *value = NULL, *message = NULL, *tag = NULL, *edit_url = NULL;
> - gchar *temp_file_name = g_strdup("/tmp/vimprobableeditXXXXXX");
> + gchar *temp_file_name = g_strdup_printf("%s/vimprobableeditXXXXXX",
> + temp_dir);
> int temp_file_handle = -1;
>
> /* check if active element is suitable for text editing */
> @@ -2797,6 +2798,11 @@ main(int argc, char *argv[]) {
> return EXIT_SUCCESS;
> }
>
> + if (getenv("TMPDIR")) {
> + strncpy(temp_dir, getenv("TMPDIR"), MAX_SETTING_SIZE);
> + temp_dir[MAX_SETTING_SIZE-1] = 0;
> + }
> +
> if( getenv("XDG_CONFIG_HOME") )
> config_base = g_strdup_printf("%s", getenv("XDG_CONFIG_HOME"));
> else
> diff --git a/vimprobablerc.5 b/vimprobablerc.5
> index f69dda9..2964b20 100644
> --- a/vimprobablerc.5
> +++ b/vimprobablerc.5
> @@ -159,6 +159,9 @@ Reject or accept unverified certificates (default: true)
> .IP cabundle=/path/to/file
> Where CA certificates are stored (default: /etc/ssl/certs/ca-certificates.crt)
>
> +.IP tempdir=/path/without/slash
> +A path to a directory for temporary files (default: $TMPDIR or /tmp)
> +
> .SH MAPPINGS
>
> Keys can be mapped to the following functions:
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Vimprobable-users mailing list
> Vim...@li...
> https://lists.sourceforge.net/lists/listinfo/vimprobable-users
|