Re: Config file questions
Charles Gordon <[email protected]> Mon, 20 Mar 2017 00:43:04 +0100
| Newsgroups | gmane.editors.qemacs.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============4773612325744489944== Content-Type: multipart/alternative; boundary="Apple-Mail=_DFB4B112-52D1-4F3E-B212-CB0F0E19A653" --Apple-Mail=_DFB4B112-52D1-4F3E-B212-CB0F0E19A653 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 19 Mar 2017, at 23:49, Hadrien Lacour = <[email protected]> wrote: > On Sun, Mar 19, 2017 at 10:48:00PM +0100, Charles Gordon wrote: >> I understand your concern, but I don=E2=80=99t know why it does not = work on your system. >> Did you install qemacs from source or via apt-get ? >> I strongly advise you to install from source by checking out the = latest version from Savannah: >>=20 >>> On 19 Mar 2017, at 01:02, Hadrien Lacour = <[email protected]> wrote: >>>=20 >>> Hello, >>> I'm faced with another challenge (well, I can't really program = without being >>> able to change indent-tabs-mode anyway): any way to do what >>> toggle-truncate-lines does in the config file? >=20 > I did as you told and nothing changed at all (as expect, since I'm = using > Gentoo which provide a really recent snapshot). Here's my full config = file: >=20 > default_tab_width =3D 4; > indent_tabs_mode =3D 1; > set_system_font("fixed", "terminus,unifont"); > set_style("default", "color", "#aaaaaa"); > set_style("default", "font-size", "16"); >=20 > Did you try to set "indent_tabs_mode =3D 1;"? Did it work? > I still have no idea of how "toggle-truncate-lines" should be used in = the > config file (toggle-truncate-lines() doesn't work). > Anyway, wouldn't it be simpler from the user AND dev point of view to = have the > config file simply be a command list exactly as the ones that can be = used > inside qe? >=20 > I'll probably make a custom ebuild to change the default, but I'd = sleep better > if the problem could be solved with config files. OK, I got it! indent_tabs_mode is a window variable. Changing it in the config file = only affects the current window, and the setting is lost as soon as an = actual file is loaded and attached to it. I used to be adamant about indenting the code with tabs only, but I = changed to spaces only about 25 years ago, because tabs are inherently = non portable and the code gets messed up when moved from one system to = another, or copied and pasted into emails, websites, various editors... I only use tabs in Makefiles, because there is no choice, due to the = syntax(*). The default is forced in the mode initialization code. Unlike tab_width that is initialized to the value of default_tab_width, = there is no variable default_indent_tabs_mode to specify the default = value for indent_tabs_mode. I should look into this and make it more intuitive. Here are some ideas: * issue a warning when window or buffer specific settings are changed in = the config file * make these modifications affect a prototype window that would hold = default settings, copied to any new window upon attachment to a buffer. As I said, the scripting is still work in progress. What do you mean by "have the config file simply be a command list = exactly as the ones that can be used inside qe?=E2=80=9D * most functions can be used from the config file but using = set_indent_tabs_mode(1); would not work any better as it has the same = problem: it only affects the current window. * do you mean that the config file should have a list of keystrokes to = be run like a macro? This would not be very readable, but is feasible = via define_kbd_macro(). The good news is there is a simple solution for you in the mean time: create a file named .qerc (DOT Q E R C) in your home directory with this = contents: indent_tabs_mode =3D 1; When qemacs loads a file or creates a new file, it loads and evaluates = all .qerc files it finds in all parent directories of the file, from the = root directory all the way to the file directory. You can use this facility to set personal defaults in your home = directory and project specific settings in different project = directories. This should solve your problem. Chqrlie (*) I met Stuart Feldman at Bell Labs a long time ago: his first words = after being introduced to me as the original inventor of make were to = apologize for the syntax glitch: =E2=80=9CPlease to meet you, sorry = about the tabs=E2=80=A6" --Apple-Mail=_DFB4B112-52D1-4F3E-B212-CB0F0E19A653 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = class=3D"">On 19 Mar 2017, at 23:49, Hadrien Lacour <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:<br = class=3D""><div><blockquote type=3D"cite" class=3D"">On Sun, Mar 19, = 2017 at 10:48:00PM +0100, Charles Gordon wrote:<br = class=3D""></blockquote><br class=3D""><blockquote type=3D"cite" = class=3D""><div class=3D""><div class=3D""><blockquote type=3D"cite" = class=3D"">I understand your concern, but I don=E2=80=99t know why it = does not work on your system.<br class=3D"">Did you install qemacs from = source or via apt-get ?<br class=3D"">I strongly advise you to install = from source by checking out the latest version from Savannah:<br = class=3D""><br class=3D""><blockquote type=3D"cite" class=3D"">On 19 Mar = 2017, at 01:02, Hadrien Lacour <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:<br class=3D""><br= class=3D"">Hello,<br class=3D"">I'm faced with another challenge (well, = I can't really program without being<br class=3D"">able to change = indent-tabs-mode anyway): any way to do what<br = class=3D"">toggle-truncate-lines does in the config file?<br = class=3D""></blockquote></blockquote><br class=3D"">I did as you told = and nothing changed at all (as expect, since I'm using<br = class=3D"">Gentoo which provide a really recent snapshot). Here's my = full config file:<br class=3D""><br class=3D"">default_tab_width =3D = 4;<br class=3D"">indent_tabs_mode =3D 1;<br = class=3D"">set_system_font("fixed", "terminus,unifont");<br = class=3D"">set_style("default", "color", "#aaaaaa");<br = class=3D"">set_style("default", "font-size", "16");<br class=3D""><br = class=3D"">Did you try to set "indent_tabs_mode =3D 1;"? Did it work?<br = class=3D"">I still have no idea of how "toggle-truncate-lines" should be = used in the<br class=3D"">config file (toggle-truncate-lines() doesn't = work).<br class=3D"">Anyway, wouldn't it be simpler from the user AND = dev point of view to have the<br class=3D"">config file simply be a = command list exactly as the ones that can be used<br class=3D"">inside = qe?<br class=3D""><br class=3D"">I'll probably make a custom ebuild to = change the default, but I'd sleep better<br class=3D"">if the problem = could be solved with config files.<br = class=3D""></div></div></blockquote><br class=3D""></div><div>OK, I got = it!</div><div><br class=3D""></div><div>indent_tabs_mode is a window = variable. Changing it in the config file only affects the current = window, and the setting is lost as soon as an actual file is loaded and = attached to it.</div><div><br class=3D""></div><div>I used to be adamant = about indenting the code with tabs only, but I changed to spaces only = about 25 years ago, because tabs are inherently non portable and the = code gets messed up when moved from one system to another, or copied and = pasted into emails, websites, various editors...</div><div>I only use = tabs in Makefiles, because there is no choice, due to the syntax(*). The = default is forced in the mode initialization code.</div><div><br = class=3D""></div><div>Unlike tab_width that is initialized to the value = of default_tab_width, there is no variable default_indent_tabs_mode to = specify the default value for indent_tabs_mode.</div><div><br = class=3D""></div><div>I should look into this and make it more = intuitive. Here are some ideas:</div><div>* issue a warning when window = or buffer specific settings are changed in the config file</div><div>* = make these modifications affect a <i class=3D"">prototype</i> window = that would hold default settings, copied to any new window upon = attachment to a buffer.</div><div>As I said, the scripting is still work = in progress.</div><div><br class=3D""></div><div>What do you mean by = "have the config file simply be a command list exactly as the ones that = can be used inside qe?=E2=80=9D</div><div>* most functions can be used = from the config file but using set_indent_tabs_mode(1); would not work = any better as it has the same problem: it only affects the current = window.</div><div>* do you mean that the config file should have a list = of keystrokes to be run like a macro? This would not be very = readable, but is feasible via define_kbd_macro().</div><div><br = class=3D""></div><div>The good news is there is a simple solution for = you in the mean time:</div><div><br class=3D""></div><div>create a file = named .qerc (DOT Q E R C) in your home directory with this = contents:</div><div><br class=3D""></div><div>indent_tabs_mode =3D = 1;</div><div><br class=3D""></div><div>When qemacs loads a file or = creates a new file, it loads and evaluates all .qerc files it finds in = all parent directories of the file, from the root directory all the way = to the file directory.</div><div>You can use this facility to set = personal defaults in your home directory and project specific settings = in different project directories.</div><div><br class=3D""></div><div>This= should solve your problem.</div><div><br = class=3D""></div><div>Chqrlie</div><div><br class=3D""></div><div>(*) I = met Stuart Feldman at Bell Labs a long time ago: his first words after = being introduced to me as the original inventor of make were to = apologize for the syntax glitch: =E2=80=9CPlease to meet you, sorry = about the tabs=E2=80=A6"</div><div><br class=3D""></div><br = class=3D""></body></html>= --Apple-Mail=_DFB4B112-52D1-4F3E-B212-CB0F0E19A653-- --===============4773612325744489944== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Qemacs-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/qemacs-devel --===============4773612325744489944==--