Path: utzoo!utgpu!watserv1!watmath!att!rutgers!ucsd!ucbvax!ucsfcgl!cca.ucsf.edu!wet!epsilon From: epsilon@wet.UUCP (Eric P. Scott) Newsgroups: comp.mail.elm Subject: Fixing the "builtin" editor Message-ID: <1334@wet.UUCP> Date: 16 Jul 90 15:56:50 GMT Reply-To: eps@sutro.SFSU.EDU (Eric P. Scott) Organization: SFSU via Wetware Diversions, San Francisco Lines: 108 (This has already been mailed to the elm coordinator) We are looking to use elm as a replacement for mailx/BSD Mail for new users who have not yet learned to use an external editor. As distributed, elm only works as advertised if configured to use vi as the default editor; we want to use "builtin" instead. Some minor changes make this viable. These changes are UNOFFICIAL. You will have to back them out before applying patch #6. The following context diffs to ELM 2.3PL5 . Fix ~v to properly invoke vi when elm is configured to use "builtin" or "none" as the default editor . Even if already_has_text is true, if the alternate_editor is "builtin" or "none" don't try to shell to it . Avoid creating extraneous process from ~! shell escape -=EPS=- ------- *** hdrs/sysdefs.SH.orig --- hdrs/sysdefs.SH *************** *** 92,97 **** --- 92,98 ---- #define readmsg_file ".elm/readmsg" #define emacs_editor "$emacs" + #define vi_editor "$vi" #define default_editor "$defeditor" #define mailhome "$maildir/" *** src/editmsg.c.orig --- src/editmsg.c *************** *** 72,78 **** buffer[0] = '\0'; if (strcmp(editor, "builtin") == 0 || strcmp(editor, "none") == 0) { ! if (already_has_text) sprintf(buffer, "%s %s", alternative_editor, filename); else return(no_editor_edit_the_message(filename)); --- 72,79 ---- buffer[0] = '\0'; if (strcmp(editor, "builtin") == 0 || strcmp(editor, "none") == 0) { ! if (already_has_text && strcmp(alternative_editor, "builtin") && ! strcmp(alternative_editor, "none")) sprintf(buffer, "%s %s", alternative_editor, filename); else return(no_editor_edit_the_message(filename)); *************** *** 249,255 **** case 'v' : NewLine(); strcpy(buffer, editor); ! strcpy(editor, default_editor); fclose(edit_fd); (void) edit_the_message(filename,0); strcpy(editor, buffer); --- 250,256 ---- case 'v' : NewLine(); strcpy(buffer, editor); ! strcpy(editor, vi_editor); fclose(edit_fd); (void) edit_the_message(filename,0); strcpy(editor, buffer); *************** *** 299,305 **** if (( old_raw = RawState()) == ON) Raw(OFF); if (strlen(buffer) < 3) ! (void) system_call(shell, USER_SHELL, TRUE, TRUE); else (void) system_call((char *) buffer+2, USER_SHELL, TRUE, TRUE); if (old_raw == ON) --- 300,306 ---- if (( old_raw = RawState()) == ON) Raw(OFF); if (strlen(buffer) < 3) ! (void) system_call((char *)NULL, USER_SHELL, TRUE, TRUE); else (void) system_call((char *) buffer+2, USER_SHELL, TRUE, TRUE); if (old_raw == ON) *** src/syscall.c.orig --- src/syscall.c *************** *** 218,224 **** #endif /* Go for it. */ ! execl(sh, argv_zero(sh), "-c", string, (char *) 0); /* If exec fails, we write a byte to the pipe before exiting. */ perror(sh); --- 218,225 ---- #endif /* Go for it. */ ! if (string) execl(sh, argv_zero(sh), "-c", string, (char *) 0); ! else execl(sh, argv_zero(sh), (char *) 0); /* If exec fails, we write a byte to the pipe before exiting. */ perror(sh);