Skip to content

Commit

Permalink
Display UTF-8 on the modeline [buffer name, file name].
Browse files Browse the repository at this point in the history
  • Loading branch information
rfivet committed Aug 13, 2019
1 parent 78a7a3b commit e62af18
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Makefile for emacs, updated Tue, Jul 31, 2018 20:37:16
# Makefile for uEMACS, updated Tue, Aug 13, 2019 7:59:24 AM

SRC=basic.c bind.c bindable.c buffer.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c input.c isearch.c line.c lock.c main.c mingw32.c mlout.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c util.c window.c word.c wrapper.c wscreen.c
OBJ=basic.o bind.o bindable.o buffer.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o input.o isearch.o line.o lock.o main.o mingw32.o mlout.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o util.o window.o word.o wrapper.o wscreen.o
HDR=basic.h bind.h bindable.h buffer.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h mlout.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h util.h version.h window.h word.h wrapper.h wscreen.h
HDR=basic.h bind.h bindable.h buffer.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isa.h isearch.h line.h lock.h mlout.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h util.h version.h window.h word.h wrapper.h wscreen.h

# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them

Expand Down Expand Up @@ -100,7 +100,7 @@ tags: ${SRC}

source:
@mv Makefile Makefile.bak
@echo "# Makefile for emacs, updated `date`" >Makefile
@echo "# Makefile for uEMACS, updated `date`" >Makefile
@echo '' >>Makefile
#Sorted
@echo SRC=`ls *.c` >>Makefile
Expand All @@ -111,11 +111,12 @@ source:
# @echo OBJ=$(patsubst %.c,%.o,$(wildcard *.c)) >>Makefile
# @echo HDR=$(wildcard *.h) >>Makefile
@echo '' >>Makefile
@sed -n -e '/^# DO NOT ADD OR MODIFY/,$$p' <Makefile.bak >>Makefile
@sed -n -e '/^# DO NOT ADD OR MODIFY/,$$p' Makefile.bak >> Makefile

depend: ${SRC}
@mv Makefile Makefile.bak
@sed -n -e '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
@echo "# Updated `date`" >> Makefile
@echo >> Makefile
@for i in ${SRC}; do\
$(CC) ${DEFINES} -MM $$i ; done >> Makefile
Expand All @@ -129,6 +130,7 @@ depend: ${SRC}
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c

# DO NOT DELETE THIS LINE -- make depend uses it
# Updated Tue, Aug 13, 2019 7:51:49 AM

basic.o: basic.c basic.h retcode.h input.h bind.h mlout.h random.h \
terminal.h defines.h utf8.h window.h buffer.h line.h
Expand Down
9 changes: 6 additions & 3 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,11 @@ static int vtputs( const char *s) {
int n = 0 ;

while( *s) {
vtputc( *s++) ;
n += 1 ;
unicode_t c ;

s += utf8_to_unicode( s, 0, 4, &c) ;
vtputc( c) ;
n += 1 ; /* Assume non wide char unicode */
}

return n ;
Expand Down Expand Up @@ -1103,7 +1106,7 @@ static void modeline(struct window *wp)
vtputc( ' ') ;

if( n == term.t_nrow - 1)
n = 3 + vtputs( PROGRAM_NAME_LONG " " VERSION ": ") ;
n = 3 + vtputs( PROGRAM_NAME_UTF8 " " VERSION ": ") ;
else
n = 3 ;

Expand Down
2 changes: 1 addition & 1 deletion eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ static char *gtenv( char *vname) {
case EVVERSION:
return VERSION;
case EVPROGNAME:
return PROGRAM_NAME_PFX PROGRAM_NAME_LONG ;
return PROGRAM_NAME_UTF8 ;
case EVSEED:
return i_to_a(seed);
case EVDISINP:
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void emergencyexit(int signr)
static void edinit( char *bname) ;

static void version( void) {
fputs( PROGRAM_NAME_PFX PROGRAM_NAME_LONG " version " VERSION "\n", stdout) ;
fputs( PROGRAM_NAME_UTF8 " version " VERSION "\n", stdout) ;
}


Expand Down
2 changes: 1 addition & 1 deletion utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* NOTE 2! This does *not* verify things like minimality. So overlong forms
* are happily accepted and decoded, as are the various "invalid values".
*/
unsigned utf8_to_unicode( char *line, unsigned index, unsigned len,
unsigned utf8_to_unicode( const char *line, unsigned index, unsigned len,
unicode_t *res) {
unicode_t value ;
unsigned c ;
Expand Down
2 changes: 1 addition & 1 deletion utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

typedef unsigned int unicode_t ;

unsigned utf8_to_unicode( char *line, unsigned index, unsigned len,
unsigned utf8_to_unicode( const char *line, unsigned index, unsigned len,
unicode_t *res) ;
unsigned utf8_revdelta( unsigned char *buf, unsigned pos) ;
unsigned unicode_to_utf8( unicode_t c, char *utf8) ;
Expand Down
5 changes: 2 additions & 3 deletions version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
# define PROGRAM_NAME "em"
#endif

# define PROGRAM_NAME_PFX "\xC2"
# define PROGRAM_NAME_LONG "\xB5""EMACS" /* UTF-8 µEMACS */
#define PROGRAM_NAME_UTF8 "µEMACS"

# define VERSION "4.2.4"
#define VERSION "4.2.4"

#endif /* VERSION_H_ */

0 comments on commit e62af18

Please sign in to comment.