tImprove Makefile - ledit - Text editor (WIP) | |
git clone git://lumidify.org/ledit.git (fast, but not encrypted) | |
git clone https://lumidify.org/git/ledit.git (encrypted, but very slow) | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b4c5e772118e3f198989732e3aee1146ef9b5217 | |
parent 7892e89a47ccb35549b25fe558245b9e8f639daf | |
Author: lumidify <[email protected]> | |
Date: Sun, 19 Dec 2021 13:27:55 +0100 | |
Improve Makefile | |
Diffstat: | |
M Makefile | 33 +++++++++++++++++++++++++++++… | |
M ledit.1 | 24 ++++++++++++++++++------ | |
M undo.c | 1 + | |
M window.h | 2 +- | |
4 files changed, 52 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -8,6 +8,7 @@ MANPREFIX = ${PREFIX}/man | |
BIN = ${NAME} | |
MAN1 = ${BIN:=.1} | |
+MISCFILES = Makefile README LICENSE IDEAS NOTES TODO | |
OBJ = \ | |
assert.o \ | |
t@@ -28,6 +29,8 @@ OBJ = \ | |
window.o \ | |
pango-compat.o | |
+SRC = ${OBJ:.o=.c} | |
+ | |
HDR = \ | |
assert.h \ | |
buffer.h \ | |
t@@ -46,13 +49,22 @@ HDR = \ | |
draw_util.h \ | |
window.h \ | |
cleanup.h \ | |
+ macros.h \ | |
pango-compat.h | |
+CONFIGHDR = \ | |
+ config.h \ | |
+ theme_config.h \ | |
+ keys_basic_config.h \ | |
+ keys_command_config.h \ | |
+ keys_config.h | |
+ | |
CFLAGS_LEDIT = -g -Wall -Wextra -D_POSIX_C_SOURCE=200809L `pkg-config --cflags… | |
LDFLAGS_LEDIT = ${LDFLAGS} `pkg-config --libs x11 xkbfile pangoxft xext` -lm | |
all: ${BIN} | |
+# FIXME: make this nicer | |
ledit.o window.o : config.h | |
theme.o : theme_config.h | |
keys_basic.o : keys_basic_config.h keys_config.h | |
t@@ -67,7 +79,26 @@ ${OBJ} : ${HDR} | |
${BIN}: ${OBJ} | |
${CC} -o $@ ${OBJ} ${LDFLAGS_LEDIT} | |
+install: all | |
+ mkdir -p "${DESTDIR}${PREFIX}/bin" | |
+ cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" | |
+ for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done | |
+ mkdir -p "${DESTDIR}${MANPREFIX}/man1" | |
+ cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" | |
+ for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done | |
+ | |
+uninstall: | |
+ for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done | |
+ for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done | |
+ | |
clean: | |
rm -f ${BIN} ${OBJ} | |
-.PHONY: all clean | |
+dist: | |
+ rm -rf "${NAME}-${VERSION}" | |
+ mkdir -p "${NAME}-${VERSION}" | |
+ cp -f ${MAN1} ${SRC} ${HDR} ${CONFIGHDR} ${MISCFILES} "${NAME}-${VERSI… | |
+ tar cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz" | |
+ rm -rf "${NAME}-${VERSION}" | |
+ | |
+.PHONY: all clean install uninstall dist | |
diff --git a/ledit.1 b/ledit.1 | |
t@@ -1,3 +1,7 @@ | |
+.\" TODO: | |
+.\" paste buffer line vs. char oriented | |
+.\" bigword, etc. | |
+.\" | |
.\" WARNING: Some parts of this are stolen shamelessly from OpenBSD's | |
.\" vi(1) manpage! | |
.Dd December 18, 2021 | |
t@@ -23,22 +27,23 @@ are documented, but it is very likely that many have been … | |
If you find an important difference that is not documented, please | |
contact me. | |
.Sh ANTI-DESCRIPTION | |
-.Bl -tag -width Ds | |
-.It Nm | |
+.Nm | |
is not a code editor. | |
Features for code editing may be added in the future, but the main | |
purpose is currently to edit other text. | |
-.It Nm | |
+.Pp | |
+.Nm | |
is not a general-purpose text editor. | |
It is content to be useful for some tasks and does not feel insulted when | |
other editors are used for other tasks. | |
-.It Nm | |
+.Pp | |
+.Nm | |
is not a minimalistic text editor. | |
It probably counts as reasonably minimalistic in the modern world, but | |
that is not the main goal. | |
-.It Nm | |
+.Pp | |
+.Nm | |
is not a good text editor. | |
-.El | |
.Sh KEY BINDINGS | |
The key bindings listed here are given as the default English bindings. | |
These will, of course, not be accurate for other languages or if | |
t@@ -700,6 +705,13 @@ Substitute | |
with | |
.Ar replace | |
in the given line range. | |
+.Pp | |
+Instead of | |
+.Cm / , | |
+any other unicode character may be used. The first unicode character after the | |
+.Cm s | |
+is used as the delimiter. | |
+.Pp | |
If no range is given, substitution is only performed on the current line. | |
Note that no regex is currently supported. | |
.Pp | |
diff --git a/undo.c b/undo.c | |
t@@ -198,6 +198,7 @@ ledit_undo(undo_stack *undo, ledit_mode mode, void *callba… | |
); | |
break; | |
default: | |
+ /* FIXME: show this as a message */ | |
fprintf(stderr, "Error with undo. This should not happ… | |
break; | |
} | |
diff --git a/window.h b/window.h | |
t@@ -52,7 +52,7 @@ typedef struct { | |
int message_shown; /* whether a readonly message is shown at the… | |
bottom_bar *bb; /* encapsulates the text at the bottom */ | |
int redraw; /* whether something has changed and the wind… | |
- ledit_mode mode; /* mode of the view - a bit ugly to duplicate this… | |
+ ledit_mode mode; /* mode of the view - a bit ugly to duplicate… | |
/* stuff for filtering events so not too many have to be handled */ | |
struct timespec last_scroll; |