aboutsummaryrefslogtreecommitdiffhomepage
path: root/ide
diff options
context:
space:
mode:
authorGravatar pboutill <pboutill@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-11-20 20:03:01 +0000
committerGravatar pboutill <pboutill@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-11-20 20:03:01 +0000
commit6600b4e71cc82fc2a7c00e8dc1d4aa5ec1787cf7 (patch)
tree259c4924513d58738b46d15dff1007bb68f389e5 /ide
parente2da4610f7e27d289ada98383c079c3c939b20c6 (diff)
CoqIdE configuration file won't pollute your home anymore
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14694 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide')
-rw-r--r--ide/FAQ10
-rw-r--r--ide/config_lexer.mll4
-rw-r--r--ide/minilib.ml8
-rw-r--r--ide/minilib.mli1
-rw-r--r--ide/preferences.ml6
5 files changed, 19 insertions, 10 deletions
diff --git a/ide/FAQ b/ide/FAQ
index 39dc095e4..f07f229fc 100644
--- a/ide/FAQ
+++ b/ide/FAQ
@@ -6,8 +6,8 @@ R0: A powerfull graphical interface for Coq. See http://coq.inria.fr. for more i
Q1) How to enable Emacs keybindings?
R1: Insert
gtk-key-theme-name = "Emacs"
- in your ".coqide-gtk2rc" file. It may be in the current dir
- or in $HOME dir. This is done by default.
+ in your "coqide-gtk2rc" file. It should be in $XDG_CONFIG_DIRS/coq dir.
+ This is done by default.
Q2) How to enable antialiased fonts?
R2) Set the GDK_USE_XFT variable to 1. This is by default with Gtk >= 2.2.
@@ -41,7 +41,7 @@ R5)-First solution : type "<CONTROL><SHIFT>2200" to enter a forall in the script
and then to add
bind "F13" {"insert-at-cursor" ("∀")}
bind "F14" {"insert-at-cursor" ("∃")}
- to your "binding "text"" section in .coqiderc-gtk2rc.
+ to your "binding "text"" section in coqiderc-gtk2rc.
The strange ("∀") argument is the UTF-8 encoding for
0x2200.
You can compute these encodings using the lablgtk2 toplevel with
@@ -51,8 +51,8 @@ R5)-First solution : type "<CONTROL><SHIFT>2200" to enter a forall in the script
Q6) How to customize the shortcuts for menus?
R6) Two solutions are offered:
- - Edit $HOME/.coqide.keys by hand or
- - Add "gtk-can-change-accels = 1" in your .coqide-gtk2rc file. Then
+ - Edit $XDG_CONFIG_HOME/coq/coqide.keys by hand or
+ - Add "gtk-can-change-accels = 1" in your coqide-gtk2rc file. Then
from CoqIde, you may select a menu entry and press the desired
shortcut.
diff --git a/ide/config_lexer.mll b/ide/config_lexer.mll
index 933baa5dc..57699c686 100644
--- a/ide/config_lexer.mll
+++ b/ide/config_lexer.mll
@@ -25,7 +25,7 @@ rule prefs m = parse
|ignore* (ident as id) ignore* '=' { let conf = str_list [] lexbuf in
prefs (Stringmap.add id conf m) lexbuf }
| _ { let c = lexeme_start lexbuf in
- eprintf ".coqiderc: invalid character (%d)\n@." c;
+ eprintf "coqiderc: invalid character (%d)\n@." c;
prefs m lexbuf }
| eof { m }
@@ -41,7 +41,7 @@ and string = parse
| '"' { Buffer.add_char string_buffer '"' }
| '\\' '"' | _
{ Buffer.add_string string_buffer (lexeme lexbuf); string lexbuf }
- | eof { eprintf ".coqiderc: unterminated string\n@." }
+ | eof { eprintf "coqiderc: unterminated string\n@." }
{
diff --git a/ide/minilib.ml b/ide/minilib.ml
index 54be52c19..65ff4378e 100644
--- a/ide/minilib.ml
+++ b/ide/minilib.ml
@@ -70,7 +70,13 @@ let subst_command_placeholder s t =
let home =
try Sys.getenv "HOME" with Not_found ->
try (Sys.getenv "HOMEDRIVE")^(Sys.getenv "HOMEPATH") with Not_found ->
- try Sys.getenv "USERPROFILE" with Not_found -> "."
+ try Sys.getenv "USERPROFILE" with Not_found -> Filename.current_dir_name
+
+let xdg_config_home =
+ try
+ Filename.concat (Sys.getenv "XDG_CONFIG_HOME") "coq"
+ with Not_found ->
+ Filename.concat home "/.config/coq"
let coqlib = ref ""
let coqtop_path = ref ""
diff --git a/ide/minilib.mli b/ide/minilib.mli
index 44e570301..749180756 100644
--- a/ide/minilib.mli
+++ b/ide/minilib.mli
@@ -22,6 +22,7 @@ val string_map : (char -> char) -> string -> string
val subst_command_placeholder : string -> string -> string
val home : string
+val xdg_config_home : string
val coqlib : string ref
val coqtop_path : string ref
diff --git a/ide/preferences.ml b/ide/preferences.ml
index 3f2c69acd..14608f984 100644
--- a/ide/preferences.ml
+++ b/ide/preferences.ml
@@ -10,9 +10,9 @@
open Configwin
open Printf
-let pref_file = Filename.concat Minilib.home ".coqiderc"
+let pref_file = Filename.concat Minilib.xdg_config_home "coqiderc"
-let accel_file = Filename.concat Minilib.home ".coqide.keys"
+let accel_file = Filename.concat Minilib.xdg_config_home "coqide.keys"
let mod_to_str (m:Gdk.Tags.modifier) =
match m with
@@ -168,6 +168,8 @@ let contextual_menus_on_goal = ref (fun x -> ())
let resize_window = ref (fun () -> ())
let save_pref () =
+ if not (Sys.file_exists Minilib.xdg_config_home)
+ then Unix.mkdir Minilib.xdg_config_home 0o700;
(try GtkData.AccelMap.save accel_file
with _ -> ());
let p = !current in