home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / hebrew / patch-src < prev    next >
Encoding:
Text File  |  1992-08-22  |  13.9 KB  |  443 lines

  1. *** buffer.c.orig    Thu Jun  4 15:19:29 1992
  2. --- buffer.c    Thu Jun  4 16:01:40 1992
  3. ***************
  4. *** 1069,1074 ****
  5. --- 1069,1076 ----
  6.     XFASTINT (buffer_defaults.tab_width) = 8;
  7.     buffer_defaults.truncate_lines = Qnil;
  8.     buffer_defaults.ctl_arrow = Qt;
  9. +   buffer_defaults.display_literal = Qnil;    /* yossi */
  10. +   buffer_defaults.display_reversed = Qnil;    /* yossi */
  11.   
  12.     XFASTINT (buffer_defaults.fill_column) = 70;
  13.     XFASTINT (buffer_defaults.left_margin) = 0;
  14. ***************
  15. *** 1107,1112 ****
  16. --- 1109,1116 ----
  17.     XFASTINT (buffer_local_flags.left_margin) = 0x800;
  18.     XFASTINT (buffer_local_flags.abbrev_table) = 0x1000;
  19.     XFASTINT (buffer_local_flags.syntax_table) = 0x2000;
  20. +   XFASTINT (buffer_local_flags.display_literal) = 0x4000;    /* yossi */
  21. +   XFASTINT (buffer_local_flags.display_reversed) = 0x8000;    /* yossi */
  22.   
  23.     Vbuffer_alist = Qnil;
  24.     current_buffer = 0;
  25. ***************
  26. *** 1178,1183 ****
  27. --- 1182,1197 ----
  28.       "Default ctl-arrow for buffers that do not override it.\n\
  29.   This is the same as (default-value 'ctl-arrow).");
  30.   
  31. +   DEFVAR_LISP_NOPRO ("default-display-literal",        /* yossi */
  32. +           &buffer_defaults.display_literal,
  33. +     "Default display-literal for buffers that do not override it.\n\
  34. + This is the same as (default-value 'display-literal).");
  35. +   DEFVAR_LISP_NOPRO ("default-display-reversed",    /* yossi */
  36. +           &buffer_defaults.display_reversed,
  37. +     "Default display-reversed for buffers that do not override it.\n\
  38. + This is the same as (default-value 'display-reversed).");
  39.     DEFVAR_LISP_NOPRO ("default-truncate-lines",
  40.             &buffer_defaults.truncate_lines,
  41.       "Default truncate-lines for buffers that do not override it.\n\
  42. ***************
  43. *** 1269,1274 ****
  44. --- 1283,1299 ----
  45.       "*Non-nil means display control chars with uparrow.\n\
  46.   Nil means use backslash and octal digits.\n\
  47.   Automatically becomes local when set in any fashion.");
  48. +   DEFVAR_PER_BUFFER ("display-literal", ¤t_buffer->display_literal,   /* yossi */
  49. +     "*Non-nil means display the characters in the buffer as they are,\n\
  50. + even when ther are \"nonprintable\" ascii.\n\
  51. + Nil means display using ctl-arrow for the low nonprintables, and use\n\
  52. + backslash and octal digits for the high nonprintables.\n\
  53. + Automatically becomes local when set in any fashion.");
  54. +   DEFVAR_PER_BUFFER ("display-reversed", ¤t_buffer->display_reversed, /* yossi */
  55. +     "*Non-nil means display each line of the buffer in reversed order,\n\
  56. + useful for editing texts in Semitic languages which write right-to-left.");
  57.   
  58.     DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines,
  59.       "*Non-nil means do not display continuation lines;\n\
  60. *** buffer.h.orig    Fri Jan  4 19:12:49 1991
  61. --- buffer.h    Thu Jun  4 16:01:41 1992
  62. ***************
  63. *** 208,213 ****
  64. --- 208,219 ----
  65.       Lisp_Object truncate_lines;
  66.       /* Non-nil means display ctl chars with uparrow */
  67.       Lisp_Object ctl_arrow;
  68. +     /* yossi-- Non-nil means display the characters in the buffer as they are,
  69. +        even when they are "nonprintable" ascii.  This is particularly useful
  70. +        for fonts which have more than 128 characters */
  71. +     Lisp_Object display_literal;
  72. +     /* yossi-- Non-nil means reverse each line of the buffer, for Semitics */
  73. +     Lisp_Object display_reversed;
  74.       /* Non-nil means do selective display;
  75.          See doc string in syms_of_buffer (buffer.c) for details.  */
  76.       Lisp_Object selective_display;
  77. *** dispnew.c.orig    Thu Jun  4 15:19:39 1992
  78. --- dispnew.c    Thu Jun  4 16:01:42 1992
  79. ***************
  80. *** 614,624 ****
  81.     reassert_line_highlight (0, cursor_vpos);
  82.     output_chars (¤t_screen->contents[vpos][hpos], 1);
  83.     fflush (stdout);
  84. !   ++cursor_hpos;
  85.     if (hpos == current_screen->used[vpos])
  86.       {
  87. !       current_screen->used[vpos] = hpos + 1;
  88. !       current_screen->contents[vpos][hpos + 1] = 0;
  89.       }
  90.     return 1;
  91.   }
  92. --- 614,624 ----
  93.     reassert_line_highlight (0, cursor_vpos);
  94.     output_chars (¤t_screen->contents[vpos][hpos], 1);
  95.     fflush (stdout);
  96. !   cursor_hpos += (NULL(XBUFFER(w->buffer)->display_reversed))? 1: -1;    /* yossi */
  97.     if (hpos == current_screen->used[vpos])
  98.       {
  99. !       current_screen->used[vpos] = cursor_hpos;
  100. !       current_screen->contents[vpos][cursor_hpos] = 0;
  101.       }
  102.     return 1;
  103.   }
  104. ***************
  105. *** 633,639 ****
  106.     if (XINT (w->hscroll) && cursor_hpos == XFASTINT (w->left))
  107.       return 0;
  108.   
  109. !   cursor_hpos += n;
  110.     XFASTINT (w->last_point_x) = cursor_hpos;
  111.     XFASTINT (w->last_point) = point;
  112.     move_cursor (cursor_vpos, cursor_hpos);
  113. --- 633,639 ----
  114.     if (XINT (w->hscroll) && cursor_hpos == XFASTINT (w->left))
  115.       return 0;
  116.   
  117. !   cursor_hpos += (NULL(XBUFFER(w->buffer)->display_reversed))? n: -n;    /* yossi */
  118.     XFASTINT (w->last_point_x) = cursor_hpos;
  119.     XFASTINT (w->last_point) = point;
  120.     move_cursor (cursor_vpos, cursor_hpos);
  121. *** indent.c.orig    Thu Jun  4 15:19:50 1992
  122. --- indent.c    Thu Jun  4 16:07:53 1992
  123. ***************
  124. *** 79,84 ****
  125. --- 79,85 ----
  126.     register int post_tab;
  127.     register int tab_width = XINT (current_buffer->tab_width);
  128.     int ctl_arrow = !NULL (current_buffer->ctl_arrow);
  129. +   int display_literal = !NULL (current_buffer->display_literal);    /* yossi */
  130.   
  131.     if (point == last_known_column_point
  132.         && MODIFF == last_known_column_modified)
  133. ***************
  134. *** 132,137 ****
  135. --- 133,142 ----
  136.         col = 0;
  137.         tab_seen = 1;
  138.       }
  139. +       else if (display_literal)            /* yossi */
  140. +     {
  141. +       col++;
  142. +     }
  143.         else
  144.       col += (ctl_arrow && c < 0200) ? 2 : 4;
  145.       }
  146. ***************
  147. *** 298,303 ****
  148. --- 303,309 ----
  149.     register int end = ZV;
  150.     register int tab_width = XINT (current_buffer->tab_width);
  151.     register int ctl_arrow = !NULL (current_buffer->ctl_arrow);
  152. +   register int display_literal = !NULL (current_buffer->display_literal);    /* yossi */
  153.   
  154.     Lisp_Object val;
  155.   
  156. ***************
  157. *** 324,332 ****
  158.         col += tab_width - 1;
  159.         col = col / tab_width * tab_width;
  160.       }
  161. !       else if (ctl_arrow && (c < 040 || c == 0177))
  162.           col++;
  163. !       else if (c < 040 || c >= 0177)
  164.           col += 3;
  165.       }
  166.   
  167. --- 330,338 ----
  168.         col += tab_width - 1;
  169.         col = col / tab_width * tab_width;
  170.       }
  171. !       else if ((!display_literal) && ctl_arrow && (c < 040 || c == 0177))  /* yossi */
  172.           col++;
  173. !       else if ((!display_literal) && (c < 040 || c >= 0177))    /* yossi */
  174.           col += 3;
  175.       }
  176.   
  177. ***************
  178. *** 355,360 ****
  179. --- 361,367 ----
  180.     register int c;
  181.     register int tab_width = XFASTINT (current_buffer->tab_width);
  182.     register int ctl_arrow = !NULL (current_buffer->ctl_arrow);
  183. +   register int display_literal = !NULL (current_buffer->display_literal);    /* yossi */
  184.     int selective
  185.       = XTYPE (current_buffer->selective_display) == Lisp_Int
  186.         ? XINT (current_buffer->selective_display)
  187. ***************
  188. *** 428,433 ****
  189. --- 435,442 ----
  190.           hpos = width;
  191.           }
  192.       }
  193. +       else if (display_literal)            /* yossi */
  194. +     hpos++;
  195.         else
  196.       hpos += (ctl_arrow && c < 0200) ? 2 : 4;
  197.   
  198. *** keyboard.c.orig    Thu Jun  4 15:19:53 1992
  199. --- keyboard.c    Thu Jun  4 16:01:44 1992
  200. ***************
  201. *** 705,711 ****
  202.           {
  203.             lose = FETCH_CHAR (point);
  204.             SET_PT (point + 1);
  205. !           if (lose >= ' ' && lose < 0177
  206.                 && (XFASTINT (XWINDOW (selected_window)->last_modified)
  207.                 >= MODIFF)
  208.                 && (XFASTINT (XWINDOW (selected_window)->last_point)
  209. --- 705,712 ----
  210.           {
  211.             lose = FETCH_CHAR (point);
  212.             SET_PT (point + 1);
  213. !           if (((lose >= ' ' && lose < 0177) ||
  214. !                !NULL(current_buffer->display_literal))        /* yossi */
  215.                 && (XFASTINT (XWINDOW (selected_window)->last_modified)
  216.                 >= MODIFF)
  217.                 && (XFASTINT (XWINDOW (selected_window)->last_point)
  218. ***************
  219. *** 721,727 ****
  220.           {
  221.             SET_PT (point - 1);
  222.             lose = FETCH_CHAR (point);
  223. !           if (lose >= ' ' && lose < 0177
  224.                 && (XFASTINT (XWINDOW (selected_window)->last_modified)
  225.                 >= MODIFF)
  226.                 && (XFASTINT (XWINDOW (selected_window)->last_point)
  227. --- 722,729 ----
  228.           {
  229.             SET_PT (point - 1);
  230.             lose = FETCH_CHAR (point);
  231. !           if (((lose >= ' ' && lose < 0177) ||
  232. !                !NULL(current_buffer->display_literal))        /* yossi */
  233.                 && (XFASTINT (XWINDOW (selected_window)->last_modified)
  234.                 >= MODIFF)
  235.                 && (XFASTINT (XWINDOW (selected_window)->last_point)
  236. ***************
  237. *** 761,768 ****
  238.               }
  239.             if (!lose
  240.                 && (point == ZV || FETCH_CHAR (point) == '\n')
  241. !               && last_command_char >= ' '
  242. !               && last_command_char < 0177)
  243.               no_redisplay
  244.                 = direct_output_for_insert (last_command_char);
  245.             goto directly_done;
  246. --- 763,770 ----
  247.               }
  248.             if (!lose
  249.                 && (point == ZV || FETCH_CHAR (point) == '\n')
  250. !               && ((last_command_char >= ' ' && last_command_char < 0177) ||
  251. !               !NULL(current_buffer->display_literal)))    /* yossi */
  252.               no_redisplay
  253.                 = direct_output_for_insert (last_command_char);
  254.             goto directly_done;
  255. *** xdisp.c.orig    Thu Jun  4 15:20:53 1992
  256. --- xdisp.c    Thu Jun  4 16:01:45 1992
  257. ***************
  258. *** 405,410 ****
  259. --- 405,417 ----
  260.         if (pos.vpos < 1)
  261.           {
  262.             cursor_hpos = max (XFASTINT (w->left), pos.hpos);
  263. +           if (!NULL(XBUFFER(w->buffer)->display_reversed)) {    /* yossi */
  264. +           register int width = XFASTINT (w->width) - 1
  265. +               - (XFASTINT(w->width) + XFASTINT(w->left) != screen_width);
  266. +           
  267. +           cursor_hpos = XFASTINT(w->left) + width -
  268. +               (cursor_hpos - XFASTINT(w->left));
  269. +           }
  270.             cursor_vpos = this_line_vpos;
  271.             goto update;
  272.           }
  273. ***************
  274. *** 551,556 ****
  275. --- 558,589 ----
  276.         last_arrow_string = Qt;
  277.       }
  278.   }
  279. + /*
  280. +  * yossi-- the following function is a simplified version of Denys Duchier's
  281. +  *         epoch::redisplay-screen, stolen from Epoch 3.1.
  282. +  */
  283. + DEFUN ("x-smart-redisplay",Fx_smart_redisplay,Sx_smart_redisplay,0,0,"",
  284. +        "Perform a smart redisplay of the screen.")
  285. +      ()
  286. +     {
  287. +     Lisp_Object root_window = XWINDOW (minibuf_window)->prev;
  288. +     int modified = BUF_MODIFF(current_buffer)++;
  289. +     windows_or_buffers_changed++;
  290. +     do_pending_window_change();
  291. +     if (interrupt_input) unrequest_sigio();
  292. +     redisplay_window(root_window,0);
  293. +     update_screen(1,1);
  294. +     BUF_MODIFF(current_buffer) = modified;
  295. +     do_pending_window_change();
  296. +     if (interrupt_input) request_sigio();
  297. +     return Qnil;
  298. +     }
  299.   
  300.   int do_id = 1;
  301.   
  302. ***************
  303. *** 672,677 ****
  304. --- 705,717 ----
  305.         if (EQ (window, selected_window))
  306.           {
  307.             cursor_hpos = max (0, pos.hpos) + XFASTINT (w->left);
  308. +           if (!NULL(XBUFFER(w->buffer)->display_reversed)) {    /* yossi */
  309. +           register int width = XFASTINT (w->width) - 1
  310. +               - (XFASTINT(w->width) + XFASTINT(w->left) != screen_width);
  311. +           
  312. +           cursor_hpos = XFASTINT(w->left) + width -
  313. +               (cursor_hpos - XFASTINT(w->left));
  314. +           }
  315.             cursor_vpos = pos.vpos + XFASTINT (w->top);
  316.           }
  317.       }
  318. ***************
  319. *** 704,709 ****
  320. --- 744,756 ----
  321.           {
  322.             /* These variables are supposed to be origin 1 */
  323.             cursor_hpos = max (0, pos.hpos) + XFASTINT (w->left);
  324. +           if (!NULL(XBUFFER(w->buffer)->display_reversed)) {    /* yossi */
  325. +           register int width = XFASTINT (w->width) - 1
  326. +               - (XFASTINT(w->width) + XFASTINT(w->left) != screen_width);
  327. +           
  328. +           cursor_hpos = XFASTINT(w->left) + width -
  329. +               (cursor_hpos - XFASTINT(w->left));
  330. +           }
  331.             cursor_vpos = pos.vpos + XFASTINT (w->top);
  332.           }
  333.   /* This doesn't do the trick, because if a window to the right of
  334. ***************
  335. *** 1213,1218 ****
  336. --- 1260,1272 ----
  337.       }
  338.   
  339.     cursor_hpos = max (0, point_hpos);
  340. +   if (!NULL(XBUFFER(w->buffer)->display_reversed)) {    /* yossi */
  341. +       register int width = XFASTINT (w->width) - 1
  342. +       - (XFASTINT(w->width) + XFASTINT(w->left) != screen_width);
  343. +       
  344. +       cursor_hpos = XFASTINT(w->left) + width -
  345. +       (cursor_hpos - XFASTINT(w->left));
  346. +   }
  347.     cursor_vpos = point_vpos;
  348.   
  349.     if (debug_end_pos)
  350. ***************
  351. *** 1265,1270 ****
  352. --- 1319,1325 ----
  353.     register unsigned char *p1prev;
  354.     int tab_width = XINT (current_buffer->tab_width);
  355.     int ctl_arrow = !NULL (current_buffer->ctl_arrow);
  356. +   int display_literal = !NULL (current_buffer->display_literal);    /* yossi */
  357.     int width = XFASTINT (w->width) - 1
  358.       - (XFASTINT (w->width) + XFASTINT (w->left) != screen_width);
  359.     struct position val;
  360. ***************
  361. *** 1382,1387 ****
  362. --- 1437,1448 ----
  363.           }
  364.         break;
  365.       }
  366. +       else if (display_literal)        /* yossi */
  367. +     {
  368. +       if (p1 >= startp)
  369. +         *p1 = c;
  370. +       p1++;
  371. +     }
  372.         else if (c < 0200 && ctl_arrow)
  373.       {
  374.         if (p1 >= startp)
  375. ***************
  376. *** 1534,1539 ****
  377. --- 1595,1624 ----
  378.   
  379.     val.bufpos = pos;
  380.     val_display_text_line = val;
  381. +   
  382. +   /* yossi-- reverse the line if necessary */
  383. +   if (!NULL(current_buffer->display_reversed)) {
  384. +       unsigned char *p2, t;
  385. +       if (p1 < endp + 1) {
  386. +       while (p1 <= endp) *p1++ = ' ';
  387. +       new_screen->used[vpos] = max(new_screen->used[vpos], p1 - new_screen->contents[vpos]);
  388. +       new_screen->contents[vpos][new_screen->used[vpos]] = 0;
  389. +       }
  390. +       /* reverse the line */
  391. +       for (p1 = startp, p2 = startp + width; p1 < p2; p1++, --p2) {
  392. +       t = *p1;
  393. +       *p1 = *p2;
  394. +       *p2 = t;
  395. +       }
  396. +       /* reverse the position of point if necessary */
  397. +       if ((point_vpos == vpos) && (w == XWINDOW (selected_window)))
  398. +       cursor_hpos = XFASTINT(w->left) + width -
  399. +           (cursor_hpos - XFASTINT(w->left));
  400. +   }
  401.     return &val_display_text_line;
  402.   }
  403.   
  404. ***************
  405. *** 1976,1981 ****
  406. --- 2061,2072 ----
  407.           }
  408.         while ((p1 - start + hscroll - (hscroll > 0)) % tab_width);
  409.       }
  410. +       else if (buffer_defaults.display_literal)        /* yossi */
  411. +     {
  412. +       if (p1 >= start)
  413. +         *p1 = c;
  414. +       p1++;
  415. +     }
  416.         else if (c < 0200 && buffer_defaults.ctl_arrow)
  417.       {
  418.         if (p1 >= start)
  419. ***************
  420. *** 2065,2070 ****
  421. --- 2156,2162 ----
  422.     mode_line_inverse_video = 1;
  423.   
  424.     defsubr (&Sredraw_display);
  425. +   defsubr (&Sx_smart_redisplay);        /* yossi */
  426.   }
  427.   
  428.   /* initialize the window system */
  429.