aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-03-03 01:44:34 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-03-03 23:35:04 +0300
commit1b907dae072f2aa93d75d8c056a9bd02555a17f8 (patch)
treea34f9cec995db63e61e9d70c93bc375fce303f25
parentbe368b6f79148720b798cc98222ac86829a53724 (diff)
downloadsciteco-1b907dae072f2aa93d75d8c056a9bd02555a17f8.tar.gz
rename sample.teco_ini to fallback.teco_ini and mung it by default
* After installation, SciTECO will therefore start into a more userfriendly mode even if the user does not create a custom ~/.teco_ini. It is hoped that this will scare away less of new users, who are not willing to read through all of the documentation. Still, users are warned in the absence of ~/.teco_ini. This warning however, might not be immediately visible, especially not when running gsciteco without an attached console. (This will change once I redo the UI and allow a number of messages to be queued in the message area.) * Theoretically, you could also just extend fallback.teco_ini from ~/.teco_ini, but that would require installing it into $SCITECOPATH. * Since the fallback profile will now be munged automatically on a wide range of systems, we set up xclip only when detecting X11 ($DISPLAY is non-empty). E.g. when running under Wayland or the Linux console, you still won't get the clipboard registers, which is probably better than having the clipboard operations fail once you try to use them. * xclip is now "suggested" on Debian/Ubuntu. Unfortunately we cannot pull it in only in the presence of X11.
-rw-r--r--.github/workflows/nightly.yml4
-rw-r--r--INSTALL2
-rw-r--r--Makefile.am2
-rw-r--r--TODO11
-rw-r--r--debian/control1
-rw-r--r--distribute.mk.in4
-rw-r--r--doc/sciteco.1.in13
-rw-r--r--fallback.teco_ini (renamed from sample.teco_ini)8
-rw-r--r--freebsd/files/pkg-message.in2
-rw-r--r--freebsd/pkg-plist2
-rw-r--r--src/main.c26
11 files changed, 51 insertions, 24 deletions
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index af16dbe..35645ba 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -254,7 +254,7 @@ jobs:
cp -r /mingw64/bin/{gsciteco.exe,sciteco.exe,grosciteco.tes,tedoc.tes} ./
# datadir is relative to bindir
cp -r /mingw64/bin/{lib,*.tmac} ./
- cp /mingw64/bin/sample.teco_ini .teco_ini
+ cp /mingw64/bin/fallback.teco_ini .teco_ini
cp -r /mingw64/share/doc/sciteco/* ./
cp ../COPYING ../ChangeLog ./
cp /mingw64/bin/gspawn-win64-helper*.exe ./
@@ -330,7 +330,7 @@ jobs:
cp -r /mingw64/bin/{lib,*.tmac} ./
# FIXME: Maybe there should be a separate win32/.teco_ini with
# a few pre-enabled settings?
- cp /mingw64/bin/sample.teco_ini .teco_ini
+ cp /mingw64/bin/fallback.teco_ini .teco_ini
cp /mingw64/bin/fallback.css .teco_css
cp -r /mingw64/share/doc/sciteco/* ./
cp ../COPYING ../ChangeLog ./
diff --git a/INSTALL b/INSTALL
index 9a46b30..b5aff56 100644
--- a/INSTALL
+++ b/INSTALL
@@ -134,7 +134,7 @@ To install SciTECO, type something like:
$ sudo make install
-You are recommended to use the included "sample.teco_ini" as a starting
+You are recommended to use the included "fallback.teco_ini" as a starting
point for your profile. On UNIX, you can copy it to your $HOME directory
at "~/.teco_ini" while on Windows, it should be in the same directory
as `sciteco.exe` unless you adapt the $SCITECOCONFIG variable.
diff --git a/Makefile.am b/Makefile.am
index c9ba183..f6bcf86 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,7 @@ MAYBE_DLMALLOC = contrib/dlmalloc
endif
SUBDIRS = lib $(MAYBE_DLMALLOC) contrib/rb3ptr src doc tests
-dist_scitecodata_DATA = sample.teco_ini
+dist_scitecodata_DATA = fallback.teco_ini
EXTRA_DIST = README TODO
diff --git a/TODO b/TODO
index 08b195c..32b2333 100644
--- a/TODO
+++ b/TODO
@@ -124,7 +124,7 @@ Known Bugs:
which is correct. Without --incremental even the formatting is broken.
This could well be a Git bug.
* Margins, identions and the like are not configured on the unnamed
- buffer by sample.teco_ini.
+ buffer by fallback.teco_ini.
And this is probably correct.
However when saving a new unnamed file for the first time,
nothing will change either and it's tricky to apply the correct
@@ -308,6 +308,8 @@ Features:
Video TECO had ET for the same purpose.
TECO 10 had a ^W regular command for case folding all strings,
but I don't think it's worth supporting.
+ * n:"x to leave <n> on the stack (i.e. only peek). This simplifies
+ expressions like Qa"N Qa ...
* Perhaps there should be a command for converting absolute line numbers
to positions (i.e. ESPOSITIONFROMLINE$$:^E).
This should also include the opposite as currently supported by :^Q.
@@ -593,11 +595,6 @@ Features:
* Erroneous constructs could be highlighted up to the previous
start state. E.g. when redefining labels, the entire label would be
highlighted.
- * Instead of defaulting to nothing in the absence of ~/.teco_ini,
- we should load the installed sample.teco_ini, which
- gives a more user-friendly experience.
- Or perhaps even simpler, should the profile be missing, just log
- a warning on startup.
* NLS (Native Language Support). I could at least add German and Russian.
There aren't many localizable strings in SciTECO.
Should be optional.
@@ -708,7 +705,7 @@ Documentation:
* People are demanding a Youtube tutorial.
* Vimtutor like tutorial. Could be a woman-page.
Perhaps sciteco-tutorial would copy the files to /tmp and
- open them always with sample.teco_ini.
+ open them always with fallback.teco_ini.
* The HTML manuals lack monospaced fonts.
This is partly because an.tmac removes the Courier family
in nroff mode, but it still doesn't work if you undo this.
diff --git a/debian/control b/debian/control
index e1d67f8..7e8a0df 100644
--- a/debian/control
+++ b/debian/control
@@ -14,6 +14,7 @@ Vcs-Git: git://github.com/rhaberkorn/sciteco.git
Package: sciteco-curses
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, sciteco-common (= ${source:Version})
+Suggests: xclip
Description: Scintilla-based Text Editor and Corrector (curses)
SciTECO is an interactive TECO dialect, similar to Video TECO.
It also adds features from classic Standard TECO-11,
diff --git a/distribute.mk.in b/distribute.mk.in
index 0a82b2c..ab79262 100644
--- a/distribute.mk.in
+++ b/distribute.mk.in
@@ -104,7 +104,7 @@ poudriere:
# and static linking of all dependant libraries (no DLLs are
# added to the zip).
# If a win32.teco_ini exists, it is added to the release
-# instead of sample.teco_ini.
+# instead of fallback.teco_ini.
# This also adds gspawn-win32-helper-console.exe to the archive
# which is required by the glib spawn functions.
# If we ever build a non-console version on Windows,
@@ -141,7 +141,7 @@ mingw-binary : @PACKAGE@-@PACKAGE_VERSION@-win32.zip
temp-install/usr/share/doc/sciteco/* \
temp-bin/
cp @srcdir@/win32.teco_ini temp-bin/.teco_ini || \
- cp temp-install/usr/bin/sample.teco_ini \
+ cp temp-install/usr/bin/fallback.teco_ini \
temp-bin/.teco_ini
cp @srcdir@/COPYING @srcdir@/ChangeLog temp-bin/
rm -rf temp-install/
diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in
index b7084c5..0d2662e 100644
--- a/doc/sciteco.1.in
+++ b/doc/sciteco.1.in
@@ -152,7 +152,11 @@ option is absent, \*(ST will mung
On UNIX/Linux, the default profile is at
.I ~/.teco_ini
(see \fBENVIRONMENT\fP).
-It will consequently not expect a \fIscript\fP file name as
+If the per-user profile is missing, \*(ST falls back to
+.IR @scitecodatadir@/fallback.teco_ini .
+Without
+.BR \-\-mung ,
+a \fIscript\fP file name will consequently not be expected as
the first non-option argument.
The profile will usually set up various Scintilla and \*(ST options,
configure syntax highlighting,
@@ -342,7 +346,7 @@ via \*(ST code.
\# That would only be possible by rewriting everything with GSpawn.
.SCITECO_TOPIC xclip
See
-.B @scitecodatadir@/sample.teco_ini
+.B @scitecodatadir@/fallback.teco_ini
for an example of how to integrate the X11 clipboard via
.BR xclip (1).
Integrating with Wayland and the Mac OS clipboards is of course also possible.
@@ -398,8 +402,9 @@ program termination or user-programmed behaviour.
.B $SCITECOCONFIG/.teco_ini
Default profile macro.
.TP
-.B @scitecodatadir@/sample.teco_ini
-Sample profile macro configuring commonly used run-time options,
+.SCITECO_TOPIC "fallback.teco_ini"
+.B @scitecodatadir@/fallback.teco_ini
+Fallback profile macro configuring commonly used run-time options,
syntax highlighting, session handling
and opening files specified on the command line.
.TP
diff --git a/sample.teco_ini b/fallback.teco_ini
index 13ab76b..0211ade 100644
--- a/sample.teco_ini
+++ b/fallback.teco_ini
@@ -65,9 +65,11 @@ EMQ[$SCITECOPATH]/fnkeys.tes
!* Uncomment if terminal emulator supports OSC-52 clipboards *!
!!0,256ED
-!* For integrating with xclip on ncurses *!
-[$SCITECO_CLIPBOARD_SET]xclip -in -selection {}
-[$SCITECO_CLIPBOARD_GET]xclip -out -selection {} || true
+:Q[$DISPLAY]">
+ !* For integrating with xclip on ncurses *!
+ [$SCITECO_CLIPBOARD_SET]xclip -in -selection {}
+ [$SCITECO_CLIPBOARD_GET]xclip -out -selection {} || true
+'
!* Uncomment to enable Unicode icons in the Curses UI *!
!!0,512ED
diff --git a/freebsd/files/pkg-message.in b/freebsd/files/pkg-message.in
index b91ee06..7d95cdb 100644
--- a/freebsd/files/pkg-message.in
+++ b/freebsd/files/pkg-message.in
@@ -1,7 +1,7 @@
[
{ type: install
message: <<XYZZY
-You are recommended to copy %%DATADIR%%/sample.teco_ini to ~/.teco_ini
+You can copy %%DATADIR%%/fallback.teco_ini to ~/.teco_ini
and edit this file afterwards with SciTECO.
XYZZY
}
diff --git a/freebsd/pkg-plist b/freebsd/pkg-plist
index 48a4b61..9dcdcca 100644
--- a/freebsd/pkg-plist
+++ b/freebsd/pkg-plist
@@ -102,7 +102,7 @@ share/man/man7/%%PROGRAM_PREFIX%%sciteco.7.gz
%%DATADIR%%/lib/women/sciteco.7.woman.tec
%%DATADIR%%/lib/women/tedoc.tes.1.woman
%%DATADIR%%/lib/women/tedoc.tes.1.woman.tec
-%%DATADIR%%/sample.teco_ini
+%%DATADIR%%/fallback.teco_ini
%%DATADIR%%/sciteco.tmac
%%GTK%%%%DATADIR%%/sciteco-16.png
%%GTK%%%%DATADIR%%/sciteco-32.png
diff --git a/src/main.c b/src/main.c
index 7849798..0a33d64 100644
--- a/src/main.c
+++ b/src/main.c
@@ -465,11 +465,33 @@ main(int argc, char **argv)
goto cleanup;
}
- if (!mung_filename && teco_mung_profile)
+ if (!mung_filename && teco_mung_profile) {
/* NOTE: Still safe to use g_getenv() */
mung_filename = g_build_filename(g_getenv("SCITECOCONFIG"), INI_FILE, NULL);
+ if (!g_file_test(mung_filename, G_FILE_TEST_IS_REGULAR)) {
+ g_autofree gchar *datadir = teco_file_get_datadir();
+ gchar *fallback = g_build_filename(datadir, "fallback.teco_ini", NULL);
+ if (g_file_test(fallback, G_FILE_TEST_IS_REGULAR)) {
+ teco_interface_msg(TECO_MSG_WARNING,
+ "Profile \"%s\" not found: Falling back to \"%s\".",
+ mung_filename, fallback);
+ g_free(mung_filename);
+ mung_filename = fallback;
+ } else {
+ teco_interface_msg(TECO_MSG_WARNING,
+ "No profile found to mung.");
+ g_free(mung_filename);
+ g_free(fallback);
+ mung_filename = NULL;
+ }
+ }
+ }
- if (mung_filename && g_file_test(mung_filename, G_FILE_TEST_IS_REGULAR)) {
+ if (mung_filename) {
+ /*
+ * NOTE: Theoretically there is a small timeframe when the file could
+ * disappear, in which case there will be an error.
+ */
if (!teco_execute_file(mung_filename, &local_qregs, &error) &&
!g_error_matches(error, TECO_ERROR, TECO_ERROR_QUIT))
goto error;