- Subject: Re: [jed-users] entab/detab
- From: Roland Hughes <roland@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 29 Aug 2017 07:39:25 -0500
This certainly did not work for me. Then again my .jedrc is as follows:
% .jedrc
require ("keydefs");
require ("cua");
require ("wmark.sl");
% if you need to findout what code a key generates in your terminal
% invoke jed as follows
%
% jed -l keycode -f keycode
%
% Some terminals send \e0H for both Home and Ctrl-Home
% Some terminals send \e0F for both End and Ctrl-End
% Sometimes you need to unset \eo %unsetkey ("\e0");
setkey ("beg_of_buffer", "\e[1;5H" );
setkey ("end_of_buffer", "\e[1;5F" );
c_set_style("linux");
LINENUMBERS = 2; % show line and column numbers in status line
WRAP_INDENTS = 0; % turn off auto-indent so pasting into buffer doesn't
get wonky
USE_TABS = 0;
TAB_DEFAULT = 4;
WRAP = 0;
BLINK = 1; % blink matching parenthesis
C_INDENT = 4;
C_BRA_NEWLINE = 1;
C_BRACE = 0;
C_Colon_Offset = 0;
enable_top_status_line (0); % hide tome menu
if (BATCH == 0)
{
() = evalfile ("cua"); % CUA-like key bindings
%() = evalfile ("ide"); % Borland IDE
}
define my_trim_buffer()
{
push_spot();
while (up_1()) { eol_trim(); bol(); }
pop_spot();
push_spot();
while (down_1()) { eol_trim(); bol(); }
pop_spot();
}
% Trim buffer but keep multiple blank lines:
public define trim_buffer_lines()
{
% remove whitespace at end of lines
push_spot_bob();
do {
eol_trim();
}
while (down_1());
% remove empty lines at end of buffer
eob();
do {
go_left_1();
if (bolp() and eolp())
del();
}
while (bolp());
pop_spot();
!if (BATCH) message ("done.");
}
add_to_hook("_jed_save_buffer_before_hooks",&trim_buffer_lines);
define text_mode_hook() {
set_mode("Text", 0); % do not wrap
}
define readonly ()
{
set_readonly (1);
}
I tried 3 times with the following VAX BASIC program to change from
spaces to tabs since, in theory, I should be able to dance back and
forth with untab(). Editor would not recognize return key if I typed
untab(); or untab() only <Esc>-1-<Esc>untab<enter>
=====
1 SUB BAS_SQLM_ZILL_DUE_REPORT_SUB
OPTION TYPE=EXPLICIT
!
! BAS_SQLM_ZILL_DUE_REPORT_SUB.BAS
!
! program to report off the drawing
! and Mega numbers which are due. Numbers reported
! will appear in descending order by SINCE_LAST.
!
%INCLUDE "LIB$ROUTINES" %FROM %LIBRARY
%INCLUDE "SYS$LIBRARY:SQL_LITERALS.BAS"
!;;;;;;;;;;
! Constants
!;;;;;;;;;;
DECLARE BYTE CONSTANT rpt_chan% = 11%
DECLARE BYTE CONSTANT elm_count% = 52%
DECLARE STRING CONSTANT report_name$ = "ZILL_DUE.RPT"
!;;;;;;;;;;
! Maps
!;;;;;;;;;;
MAP (LOCAL_MAP) STRING TRANSLATED_NAME$ = 255%
!;;;;;;;;;;
! Local Variables
!;;;;;;;;;;
DECLARE BYTE B_DONE%
DECLARE WORD W_X%
DECLARE LONG L_X%, L_ERR%, L_END%, SQLCODE%
DECLARE STRING WORK_STR$, LOG_TXT$
DECLARE BYTE ELM_NO
DECLARE LONG HIT_COUNT, LAST_DRAW_NO, SINCE_LAST, CURR_SEQ,
LONGEST_SEQ, MAX_BTWN
DECLARE GFLOAT PCT_HITS, AVE_BTWN
!;;;;;;;;;;
! Main Logic
!;;;;;;;;;;
100 L_ERR% = 0%
GOSUB A910_OPEN_FILES
IF SQLCODE% = 0%
THEN
GOSUB A940_GENERATE_REPORT
END IF
GOTO PROGRAM_EXIT
910 !;;;;;;;;;;
! Subroutine to open indexed files
!;;;;;;;;;;
A910_OPEN_FILES:
WHEN ERROR IN
L_ERR% = 0%
OPEN report_name$ FOR OUTPUT AS FILE # rpt_chan%, &
RECORDTYPE LIST, &
ACCESS WRITE
USE
L_ERR% = ERR
PRINT "Error opening report file for output"
PRINT "Error: ";L_ERR%;" ";ERT$( L_ERR%)
END WHEN
CALL OPEN_DUE_DRAW( SQLCODE%)
PRINT "Result of Draw open";SQLCODE%
CALL OPEN_DUE_MEGA( SQLCODE%)
PRINT "Result of Mega Open";SQLCODE%
RETURN
940 !;;;;;;;;;;
! Subroutine to generate the report
! No need for page breaks when will will have less
! than the number of lines a page can hold.
!;;;;;;;;;;
A940_GENERATE_REPORT:
WORK_STR$ = "Due Numbers Report"
L_X% = 40% - (LEN( WORK_STR$) / 2%) ! size needed to center
!;;;;;
! First Heading line
!;;;;;
PRINT #rpt_chan%, "DATE: ";DATE$(0%);
PRINT #rpt_chan%, TAB( L_X%);WORK_STR$;TAB( 71%);"PAGE: ";
PRINT #rpt_chan%, FORMAT$( 1%, "###")
PRINT #rpt_chan%, " "
WORK_STR$ = "Regular Drawing Numbers"
L_X% = 40% - (LEN( WORK_STR$) / 2%) ! size needed to center
PRINT #rpt_chan%, TAB( L_X%);WORK_STR$
PRINT #rpt_chan%, " "
PRINT #rpt_chan%, " "
!;;;;;
! Column headings
!;;;;;
PRINT #rpt_chan%, "No Hits Since Pct_hits Ave_btwn"
PRINT #rpt_chan%, "-- ---- ----- -------- --------"
WHILE (SQLCODE% = 0%)
CALL FETCH_DUE_DRAW( SQLCODE%, ELM_NO, HIT_COUNT,
SINCE_LAST, PCT_HITS, AVE_BTWN)
IF SQLCODE% = 0% THEN
PRINT #rpt_chan% USING "## #### #### ##.###
##.###", &
ELM_NO, HIT_COUNT, SINCE_LAST,
PCT_HITS, AVE_BTWN
END IF
NEXT
!;;;;;;;;;;
! Second page for Mega numbers
!;;;;;;;;;;
PRINT #rpt_chan%, FF
WORK_STR$ = "Due Numbers Report"
L_X% = 40% - (LEN( WORK_STR$) / 2%) ! size needed to center
PRINT #rpt_chan%, "DATE: ";DATE$(0%);
PRINT #rpt_chan%, TAB( L_X%);WORK_STR$;TAB( 71%);"PAGE: ";
PRINT #rpt_chan%, FORMAT$( 2%, "###")
PRINT #rpt_chan%, " "
WORK_STR$ = "Mega Numbers"
L_X% = 40% - (LEN( WORK_STR$) / 2%) ! size needed to center
PRINT #rpt_chan%, TAB( L_X%);WORK_STR$
PRINT #rpt_chan%, " "
PRINT #rpt_chan%, " "
!;;;;;
! Column headings
!;;;;;
PRINT #rpt_chan%, "No Hits Since Pct_hits Ave_btwn"
PRINT #rpt_chan%, "-- ---- ----- -------- --------"
SQLCODE% = 0%
WHILE (SQLCODE% = 0%)
CALL FETCH_DUE_MEGA( SQLCODE%, ELM_NO, HIT_COUNT,
SINCE_LAST, PCT_HITS, AVE_BTWN)
IF SQLCODE% = 0% THEN
PRINT #rpt_chan% USING "## #### #### ##.###
##.###", &
ELM_NO, HIT_COUNT, SINCE_LAST,
PCT_HITS, AVE_BTWN
END IF
NEXT
CALL CLOSE_MOST_DRAW( SQLCODE%)
CALL CLOSE_MOST_MEGA( SQLCODE%)
CALL COMMIT_MEGA( SQLCODE%)
RETURN
32767 ! End of module
PROGRAM_EXIT:
WHEN ERROR IN
CLOSE #rpt_chan%
USE
END WHEN
WORK_STR$ = "EDIT/READ " + report_name$
L_X% = LIB$SPAWN( WORK_STR$)
END SUB
=====
On 08/28/2017 11:24 PM, John E. Davis wrote:
Roland Hughes <roland@xxxxxxxxxxxxxxxxxxxx> wrote:
You know, I tried to play with this today. I even read through the
documentation. What I cannot find and will certainly create a blog post
about is just how one provides a "prefix" argument to the untab()
function from the S-Lang command line. This appears to be a piece of the
lore "just assumed."
This concept is part of the emacs emulation. Basically it means that
you would press `ESC n` prior to calling the function. Here n
represents 1 or more digits that specify the value of the prefix
argument. So, `ESC 1234` creates a prefix argument whose value is
1234.
In this case, you would do the following:
A. Mark the region
B. ESC 1 ESC x % Assumes emacs-emulation to
C. Enter untab at the M-x prompt
Programmatically, you would use the `set_prefix_argument' function
prior to calling `untab`, i.e.,
.
.
set_prefix_argument (1);
untab ();
I looked at the code here: https://searchcode.com/codesearch/view/19435302/
I also couldn't get untab_convert_to_tabs() to function. It went all the
way to bottom of buffer, but didn't insert any tabs. Does this function
not work if tabs are disabled in .jedrc?
No, it requires both the USE_TABS and the buffer's TAB value to be
non-zero. Perhaps the untab_convert_to_tabs function should be
modified as follows:
define untab_convert_to_tabs ()
{
variable c, tab = TAB, use_tabs = USE_TABS;
EXIT_BLOCK {
TAB = tab;
USE_TABS = use_tabs;
}
USE_TABS = 1;
if (tab == 0) TAB = 8;
while (fsearch (....))
.
.
}
Hopefully this clarifies things somewhat.
Thanks,
--John
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
--
Roland Hughes, President
Logikal Solutions
(630)-205-1593
http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us/
http://onedollarcontentstore.com
[2017 date index]
[2017 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]