Thanks, Lex. I will mull it over and see if I can get more and more of it. The files being
already opened and not messed with, that's a good insight.
On Friday, December 13, 2019, 11:15:39 PM EST, Lex Trotman <elextr(a)gmail.com>
On Sat, 14 Dec 2019 at 12:29, Douglas Morris via Users
Happy Holidays to everyone!
I am struggling to understand the indentation mechanism of geany. I am aware of:
(1) the configuration files, e.g. filetypes.sh under Tools > Configuration Files,
(2) Tools > Reload Configuration,
(3) Project > Apply Default Indentation, and
(4) Edit > Preferences > Indentation (tab)
(5) The notice on the Indentation panel under Edit > Preferences that says: Note: To
apply these settings to all currently opened documents, use Project -> Apply Default
(6) Document > Indent Type
It seems to me that it is either complicated or buggy. It is certainly not intuitive to
me. I wonder if the interface could be simplified. I don't know why the Edit >
Preference interface could not have a heading that says what the open project is (or is
not) rather than having a separate Project > Properties.
a) I think its newer than 1.33 but when a project is open there is now
a warning on the edit->preferences->indentation that the settings are
overridden by the settings in the project.
As far as controlling indentation, I don't get it.
I fiddle around and sometimes get what I want. I have a case where I am not getting what I
want. I looked online at the Geany manual and discovered the Document > Indent Type |
Indent Width settings.
b) As you would expect the "document" settings are applied to the
current document only. The indentation settings in edit->preferences
and project properties are the _defaults_ that apply to newly opened
documents, and as the note says they are not applied to already open
documents unless you say so. Wholesale changing settings on all open
files without asking is rude, and doing it automatically would be
annoying if the user has files with differing settings open at the
same time. And note they are all just changing settings, none are
instructions to edit existing file contents, see h).
So let's say I'm editing a sh file without a sh extension, because I am. And
let's say the first line in the file is: #!/bin/sh . And let's say I have no
projects open. To let's say I have the checkbox 'Detect type from file' from
item (4), the Preferences > Indentation panel, checked. And I'm using Debian Linux
with Geany 1.33.
c) Filetype detection works for me, but see note d) below.
Indentation detection works for me, but see note f) below.
From testing, I don't think that Geany recognizes the file as an sh file to apply the
filetypes.sh configuration file. It seems that item (2) does not do anything. I'm not
surprised, supposing it works only by file extension on open files. I suppose it works by
file extension and necessarily using item (2), Reload Configuration to make edits take
d) Geany does not ever change the filetype of an open file because the
user can set it manually and it would be rude to overwrite that. Note
that includes if Geany is closed and restarted with the file open.
Geany will make its best guess of a filetype when a file is first
opened but never changes it after that. And reload configuration
reloads the Geany configuration if you have edited something such as a
filetype file, nothing to do with open files.
I did not notice that using the Apply button of item (4) did anything. I can't
remember a case were it did anything to a document.
See b) above, that would be expected.
However, if I followed the item (5) notice and applied item (3), and I have no project
open, I got the spaces-and-tabs indentation in my file with a tab width of 8 spaces. Where
the hell does that come from? I got nothing set to tab and spaces with width of 8 spaces,
well, maybe I had Document > Indent Type > Tabs and Space set already, but I
didn't do it. If I set Document > Indent Type > Tabs (only), then I don't.
If I do the project apply and with a different open document selected, it makes the
document in question go back to Tabs and Spaces per the Document > Indent Type setting.
e) I'm afraid I can't follow what you did and what settings you had in
each case, a clear recipe for reproducing is needed.
If I use item (6), Document > Indent Type, there is a 'Detect from Content'
choice that does nothing. I mean it has no radio button and no indication that I selected
it after I select it and then return to look at it. The 'Detect from Content'
choice under Document > Indent Width seems unresponsive too. But I can select and click
on them as if they would do something.
f) Detect from content is a menu item that is actioned when you click
on it, it does not set a status, so there is no checkbox. Works for
me, it would appear that it is detecting the settings as you have them
so nothing appears to change. Note that detection is heuristic, it
can't read your mind, it can just make a best guess based on what it
sees in the file, if the file does not have sufficient indentation or
it is mixed and one type isn't predominant enough, it may detect the
wrong thing, or the wrong size. Note that the size of a tab is a
display thing and cannot be detected so it won't change.
If under the Document menu I select Tabs (which deselects 'Tabs' and
'Spaces'), I get the plain tab of a width of four spaces, which btw is what I have
set for item (4), the Edit > Prefs > Indentation panel.
Now suppose I uncheck item (4) checkbox 'Detect type from file', recall
that's under the Edit menu. The project item (3) does not seem to do anything. At
least unchecking the item (4) checkbox has, it seems, the effect of disabling the group
application of tabs and spaces, which I don't want applied so that's fine. I'm
pretty sure I'm doing it right. Okay not really.
g) "detect from file" in the edit menu has a checkbox because it is a
setting to perform the detection when the file is opened, its not a
menu item to be actioned immediately.
There does not seem to be a way I can apply 4-space tabs to my opened, no extensions, sh
script documents all at once. I can only do each document one at a time, which is tedious.
I can go to tabs and spaces for everything all at once, which is not what I want. Is there
some default for files without a known extension. My files have no dots in the name and so
h) Correct. Base Geany is very conservative, I don't think there is
any case where it will actually make changes to any file other than
the current one where you can see it. It will change _settings_ of
all files by Project->apply default indentation but it will not edit
all the files when you can't see what it has done. I'm not sure if
any plugins might do it.
That was really tedious, right? I tried to be clear. I'm not the best with rot memory
or logistics. Maybe I'm missing something particular that if identified would clarify
the indentation control mechanism to me. If that reads like a mess, then maybe I'm
asking the wrong question. I wish I could answer some of the questions I see from this
email subscription, but I'm just not that good.
i) If the indentation UI was designed from scratch it probably would
be different, but it was not, it has grown slowly over time as new
features have been added and nobody has had the time or interest in
totally re-doing it. It works reasonably well for the common
use-cases of contributors, but sure there are also occasional
use-cases that are not covered and probably could be documented
better. Perhaps you could attack that from the point of view of
someone who remembers what they didn't understand. Most experts (not
just Geany ones) are bad at documenting things because, well, its
obvious thats how it works, no need to mention it :)
Best wishes to everyone of course. I notice that Lex
provides insightful answers on a regular basis. Happy Holidays, Lex!
Cheers and same to you
I hope you are doing well and not working too hard. BTW, maybe after
switching from Void to Debian I figured out how to apply the Tango
Icon Theme, which makes Geany look nice. Now if I had that one icon
for making a new file with a tab strip click I'd have it all. lol I'm
learning that perfection is not a good goal more and more, at least
for me it's not so good. Get off the computer, y'all. Dang, almost
9:30 on a Friday. What the heck. Peace and out.
Users mailing list
Users mailing list