Fixed a bug in yesterday's bug fix: macro commands could be executed twice
[nedit.git] / doc / faq.txt
blob6991f92ca30fc204995a7df019e955ed14819ee4
4 NEDIT FREQUENTLY ASKED QUESTIONS
5 --------------------------------
8 Version 2001/10/01
10 NEdit is a popular GUI-style text editor for Unix and VMS systems. These
11 are answers to the most frequently asked questions to discuss@nedit.org.
12 This information is also available from:
14     ftp://ftp.nedit.org/pub/<current>/FAQ,
16 and from the NEdit web page at:
18     http://nedit.org.
20 FAQ Maintainers: Florian Xhumari (Florian.Xhumari@free.fr)
24 ABOUT THE NEDIT FAQ
25 -------------------
28 This FAQ is written in XML and translated to HTML using an XSL stylesheet.
29 The XML source is processed using James Clark's (http://www.jclark.com/)
30 XSLT processor XT (http://www.jclark.com/xml/xt.html) and XML parser XP
31 (http://www.jclark.com/xml/xp).
33 The XSL stylesheet used to generate the HTML version is here (faq.xsl).
35 The text version is generated in three steps: first, an XSL stylesheet
36 (faq-txt.xsl) is used to generate a simple HTML. Then, a second XSL
37 stylesheet (faq-txt-pass2.xsl) transforms the HTML into plain text. An awk
38 script (faq-txt.awk) then performs the word wrapping.
40 For any questions about or contributions to the FAQ, please send a mail to
41 the maintainers (mailto:Florian.Xhumari@free.fr).
45 WHERE TO GET INFORMATION
46 ------------------------
49 > Where can I get information about NEdit?
51 The NEdit web page is at:
53     http://nedit.org
55 and it is mirrored in Australia at:
57     http://www.au.nedit.org/
59 The primary ftp site for NEdit is:
61     ftp://ftp.nedit.org/pub
63 which has a mirror in The Netherlands:
65     ftp://ftp.nl.nedit.org/pub/mirror/NEdit
67 The NEdit ftp site has executables for most Unix and VMS systems, sources,
68 documentation, and contributed software.
70 The first and easiest place to look for help with NEdit is the NEdit Help
71 menu. The bottom item in the menu (Problems/Bugs) has answers to the most
72 commonly asked questions about NEdit, which are not duplicated here. Also
73 check the platform specific information in the README file packaged in the
74 NEdit distribution kits.
76 If you have a problem that you really can't figure out, send mail to
77 discuss@nedit.org, and see if anyone else might be having the same trouble.
78 The nedit developers also subscribe to this list, and hopefully someone
79 will be able to answer your question. If you are a Silicon Graphics user
80 and NEdit came bundled on your system, you can also contact SGI's technical
81 support.
83 > Are there any mailing lists for NEdit users?
85 There are two separate mailing lists for nedit users, and one for
86 developers. Users may post to the developer mailing list to report bugs and
87 communicate with the nedit developers.
89 The lists are:
91     * discuss@nedit.org: general discussion, questions and answers among
92     nedit users and developers.
94     * develop@nedit.org: communication among and with nedit developers.
95     Developers should also subscribe to the discuss list.
97     * announce@nedit.org: a low-volume mailing list for announcing new
98     versions.
100 Please note that only subscribers can send mail to the list.
102 The nedit developers subscribe to both discuss@nedit.org and
103 develop@nedit.org, either of which may be used for reporting bugs. If
104 you're not sure, or you think the report might be of interest to the
105 general nedit user community, send the report to discuss@nedit.org. If it's
106 something obvious and boring, like we misspelled "anemometer" in the
107 on-line help, send it to develop@nedit.org.
109 Please do not cross post to both lists!
111 In order to subscribe to a list, send mail to majordomo@nedit.org with one
112 or more of the following in the body of the message:
114     subscribe announce
115     subscribe discuss
116     subscribe develop
118 To unsubscribe do the same with the keyword unsubscribe.
120     unsubscribe announce
121     unsubscribe discuss
122     unsubscribe develop
124 After subscribing, you will receive copies of all of the email submitted to
125 the lists. You may submit mail to the discussion list by sending it to the
126 appropriate list: discuss@nedit.org, develop@nedit.org or
127 announce@nedit.org.
129 The archives of the old mailing lists (nedit_discuss@fnal_gov and
130 nedit_announce@fnal.gov) can be found on egroups.com:
132         * http://www.egroups.com/group/nedit_discuss/
134         * http://www.egroups.com/group/nedit_announce/
136 For more information about the mailing lists, refer to the mailing lists
137 section (http://nedit.org/community/mailing.shtml) in the NEdit site.
139 > Where can I get binaries / executables for machines other than those
140 > available at NEdit site?
142 In past versions, we separated "supported" and "unsupported" executables
143 and divided them between the binary and contrib directories. With more
144 supported systems, you're less likely to find executables in the contrib
145 directory, but it's worth a peek, anyhow. If you can't find anything
146 appropriate, you can try asking in a usenet news group appropriate to your
147 system. Other places to try are, the discuss@nedit.org mailing list, or
148 news:comp.windows.x.apps or news:comp.editors.
150 > What can I contribute?
152 If you use and enjoy NEdit, and feel like giving something back to the
153 NEdit user community, contact develop@nedit.org. If you have ported NEdit
154 to a new machine, written a useful set of macros, or would like to
155 contribute to an ongoing development project, we'd love to hear from you.
159 DIAGNOSING AND REPORTING PROBLEMS
160 ---------------------------------
163 > How do I report problems I've encountered using NEdit ?
165 If you have a problem which is not covered in the on-line help, in this
166 FAQ, or in the README file specific to your system, you can report it to
167 discuss@nedit.org (usage questions) or, develop@nedit.org (error reports).
168 Note that these lists only allow members to post, and if you are not a
169 member, your post will probably de delayed in reaching the list.
170 Alternatively you can use the bug tracker on Sourceforge
171 (http://sourceforge.net/projects/nedit/) to report bugs and make feature
172 requests. Below are some suggestions for information you can provide to
173 help in diagnosing your problem.
175 Because NEdit runs on a large number of different platforms and
176 environments, many problems are platform-specific. It's always helpful to
177 know what kind of system it's being run on. Sometimes, strange behavior can
178 also be traced to the X server software or window manager, so you may want
179 to include information on these as well.
181 The origin of the NEdit executable is often important, particularly,
182 whether it came from the NEdit site (http://www.nedit.org), was built
183 locally, or came from some other ftp server or freeware distribution CD.
184 Despite the fact that Motif appears on almost all Unix platforms, the Motif
185 libraries still vary from one machine to another. Be sure to mention
186 whether you're using Lesstif or Motif. As of version 5.2 a summary with
187 build information is present under 'Version' in the Help menu.
189 If you are having configuration or appearance problems, you should probably
190 look at the output from the command:
192    appres NEdit nedit
194 The 'appres' command will show you the resources that NEdit actually sees
195 when it runs, including "stray" resources intended for other programs but
196 not properly qualified by the program name. It will also give you a final
197 objective check as to whether resource settings that you have made are
198 actually readable by NEdit.
202 BUILDING
203 --------
206 > When I build NEdit on my SunOS system, I get the fillowing undefined
207 > symbols:
209 > ld: Undefined symbol
210 >    _memmove
211 >    _atexit
212 >    _strerror
213 > *** Error code 1
214 > make: Fatal error: Command failed for target `nedit'
216 Older versions of the gcc C runtime library were missing these functions.
217 You can either upgrade gcc, or get sources for these functions from
218 ftp://ftp.nedit.org/pub/contrib/misc (which someone else with your very
219 same problem kindly contributed).
221 > I'd like to build NEdit, but my system seems to be missing the Xm...
222 > include files and libXm.a
224 Xm means Motif, which is an important part of NEdit's GUI interface. Motif
225 is standard on commercial Unix workstations, but not on free Unix platforms
226 like Linux and FreeBSD. On these systems, you can now use LessTif, the GPL
227 clone of Motif, or purchase a copy of Motif, which is usually relatively
228 inexpensive, but not free. You can find a list of companies selling Motif
229 for Linux at:
231     http://www.cen.com/mw3/#providers
233 As of this writing LessTif is very close to being a fully reliable and
234 complete replacement for Motif, so it's definitely worth trying before
235 shelling out any money for a commercial copy. Also remember that in most
236 cases, you don't really need Motif libraries to use NEdit. There are plenty
237 of versions available pre-built with the Motif libraries linked in
238 statically. If you can't find one for your system, ask around, and you may
239 find that someone else has already built one for you. Motif licensing
240 allows free distribution of statically linked binaries. Executables for
241 NEdit are available from
242 ftp://ftp.nedit.org/pub/<current-version>/executables.
244 > When I build NEdit, I get the yacc error:
246 >   conflicts: 36 shift/reduce
248 That's normal. NEdit's macro language has a very conflicted grammar, but
249 the conflicts all resolve themselves correctly. The conflicts stem from
250 allowing awk-style no-operator concatenation of strings.
252 > I built NEdit on my Linux system, and it's full of bugs. What a horrible
253 > editor!
255 Several of the Linux distributions began including LessTif (a free version
256 of the Motif GUI library) before it was really ready for general use
257 (particularly for something which needs to be as reliable as a text
258 editor). If you have a version of Lesstif prior to 0.92.26, you have to
259 upgrade it, before it will support NEdit reliably. To get the newest
260 version, go to http://lesstif.org. Alternatively, you can get pre-built,
261 statically linked, executables from
262 ftp://ftp.nedit.org/pub/<current-version>/executables.
264 > While compiling NEdit on Linux, I get the following warning:
266 >     file.o: In function `PrintString':
267 >     file.o(.text+0x17b7): the use of `tmpnam' is dangerous, better use `mkstemp'
269 > Is NEdit insecure?
271 Not if you are using the glibc. The algorithm of mkstemp(3) consists of two
272 parts: the first part is the one used in tmpnam(3) -- this is what NEdit
273 accomplishes by calling tmpnam(3); the second part is done directly in
274 NEdit.
276 > NEdit fails to build on Linux, with messages
278 >    undefined reference to `XpGetDocumentData'
279 >    undefined reference to `XpGetPageDimensions'
280 >    ...
282 Edit makefiles/Makefile.Linux, and add '-lXp' to the line starting with
283 'LIB', right before '-lXext'. At this time we are not sure whether libXp
284 (the X print library) is installed on all Linux systems.
288 CUSTOMIZATION
289 -------------
292 > I can't get the delete key to remap to a forward delete. I have re-bound it
293 > in my .Xdefaults file, and that doesn't help.
295 In your .Xdefaults file, add:
297     nedit.remapDeleteKey: False
299 This is now the default, so you likely have an old resource file sitting
300 around somewhere with this setting. When remapDeleteKey is True), NEdit
301 forcibly maps the delete to backspace. This can be used when the X server
302 and the client machine have different expectations about whether the key in
303 the backspace position on the keyboard is a backspace key or a delete key.
304 It also saves users in very heterogeneous environments from having to
305 re-map keys on nearly every system they use just to be able to backspace.
307 > My X resource settings don't work.
309 It's harder to explain how to specify X resources than you might expect,
310 since how they are set is often configured by your local system manager.
311 They are either automatically attached to the server (your screen) by an X
312 startup or login script, or they are left unspecified, and read from the
313 .Xdefaults file whenever you run an X application. If they are attached to
314 the server, you should find out the "normal" method for setting them on
315 your system. If it's not the .Xdefaults file, then it is usually a file
316 called .Xresources (also in your home directory). To make a change, you
317 have to either run xrdb, or re-invoke the startup script that originally
318 attached them, usually by exiting and re-starting X, or logging out and
319 back in to your X session.
321 Since setting resources is tricky, it's usually better to start with
322 something simple, like:
324     nedit*foreground:green
326 Then, once you have that working, try the more subtle or difficult ones.
327 You can also use the appres command to find out what resources nedit
328 actually sees ('appres NEdit nedit').
330 > I am setting some X defaults in my $HOME/.nedit file but some of them don't
331 > work.
333 The .nedit file holds the NEdit Preferences menu options and is
334 automatically overwritten whenever you select "Save Defaults". You really
335 shouldn't put X resource settings there. Also, as you may have discovered,
336 resources other than Preferences resources don't always work from there.
338 How you set X resources depends on local system conventions. You usually
339 put them in the .Xdefaults or .Xresources file in your home directory. You
340 may also need to run xrdb to install them in the server. It depends on how
341 your local system has been configured, so it's best to talk to the person
342 who configured your system. If you're not sure whether your resources are
343 set up correctly, the command:
345     appres NEdit nedit
347 will tell you what settings NEdit will see when it runs.
349 > If I install an "app-defaults" file for NEdit (empty too), all default
350 > shortcuts are reset (only "Alt+B" and "Alt+Z" works). Without that file all
351 > works fine. Now, how can I customize nedit with this problem ? Or, how can
352 > I get a copy of all default shortcuts to add on my NEdit "app-defaults"
353 > file ?
355 NEdit uses the X fallback resources mechanism to provide default values for
356 user-settable resources. When you provide a system-wide app- defaults file,
357 it overrides the entire contents of the fallback resources, meaning all of
358 the program defaults are lost, except for those which are also represented
359 in the app-defaults file. To use an app-defaults file, therefore, you need
360 to start from a complete one which provides all of the necessary default
361 values. There is a complete app-defaults file in:
363     ftp://ftp.nedit.org/pub/contrib/misc/nedit.app-defaults
365 We strongly discourage users from using system-wide app-defaults because
366 once you install the file, you have to keep it up to date with every new
367 release of the software. If you don't update it, users might not even
368 notice the difference, but things will be increasingly wrong with each new
369 release.
371 > Where can I get the complete list of nedit resources?
373 The way X is designed, there are a LOT of user settable resources in NEdit,
374 most of them quite useless. You can see them all using the editres tool,
375 which is available on most Unix systems. A more useful subset are the
376 application default resources, which you can look at either in the source
377 code (near the beginning of nedit.c, in the variable called
378 fallbackResources) or in the app-defaults file in:
380     ftp://ftp.nedit.org/pub/contrib/misc/nedit.app-defaults
382 > Can I use 'ispell' with NEdit instead of the less capable Unix 'spell'
383 > command?
385 'ispell' is actually the default spell checker for NEdit on Linux systems
386 where 'spell' is not available. On other systems, enter the following in
387 the Shell Commands dialog:
389   Command Input: Either
390   Command Output: Same Window
391   Output Replaces Input: ON
392   Shell Command: cat>spellTmp; xterm -e ispell -x spellTmp; cat spellTmp; rm spellTmp
394 If you want to get fancy, the following puts the temporary file in the /tmp
395 directory, and uses $$ (the process ID of the shell) in the file name so
396 you don't have to worry about clashes between simultaneous ispell sessions:
398   cat > /tmp/ispell.$$; xterm -title "Spell Check" -e
399   ispell -S /tmp/ispell.$$; cat /tmp/ispell.$$; rm /tmp/ispell.$$
401 > How can the display of hidden (eg .login) files in dialog boxes be
402 > suppressed? We use nedit with for teaching programming with very naive and
403 > inexperienced students. The display of these in dialogs such as the "Save
404 > as..." one encourages them to screw up important login stuff, state files
405 > etc.
407 It depends on the system you are running how easy this is to do. Under
408 Motif 2.0, which I think is still only found on Linux and Free-BSD systems,
409 it's a simple resource setting:
411     nedit*XmFileSelectionBox.fileFilterStyle: FILTER_HIDDEN_FILES
413 On other systems, unfortunately, it's a rather difficult source code
414 change, involving creating a replacement file searching procedure to be
415 spliced in to the file selection box widget.
417 > Most Motif applications allow you to type in the file name in a separate
418 > text field (as in the 'open file' dialog). Why doesn't NEdit? Can I make it
419 > do that?
421 Set the X resource nedit.stdOpenDialog to True. The field is disabled by
422 default to get new users accustomed to typing the file name directly in to
423 the list widget, which is not standard Motif behavior.
425 > I would like to change NEdit's cursor from a bar to a block. I seem to lose
426 > it sometimes in my text.
428 The block cursor in NEdit is used to indicate overstrike mode, but you can
429 turn on a resource to make the cursor thicker:
431     nedit*text.heavyCursor: true
433 The only way to get a permanent block cursor, though is to hack the source
434 code. This shouldn't be too difficult, since the code for drawing a block
435 cursor is already there.
437 > I'd like to see more than 8 files in the file selection dialogs (Open, Save
438 > As, Include, etc.). I've tried to set the X-resources like
439 > nedit*XmList.visibleItemCount: 20, but this did not work.
441 The only effective way I've found to control the number of items in the
442 highly temperamental Motif FileSelectionBox widget is through the height
443 resource:
445     nedit*FileSelect.height: 900
447 The X resource line above will make the file selection box 900 pixels tall.
449 > I am trying to do key bindings such that, for example, Find is Alt+F rather
450 > than Ctrl+F. However, this clashes with the find menu mnemonic. I realize
451 > that the menu mnemonics can be changed to any letter, but they are always
452 > bound to Alt-letter. I would like to just remove all menu mneumonics. Is
453 > there any way to do this in an .Xdefaults file?
455 You can turn mnemonics off by setting them to the ascii null character, for
456 example:
458     nedit*fileMenu.mnemonic: \0
460 > I have a PC-style 2-button mouse. Can I switch the 2nd and 3rd mouse
461 > buttons so the more important functions like secondary selection are on the
462 > right button instead of the middle (which is emulated by pressing 1+3
463 > buttons simultaneously under Linux), like they were in version 4?
465 It's somewhat involved and hard to figure out from the documentation, but
466 yes you can. You have to reverse the translation table bindings for mouse
467 buttons 2 and 3, AND reset the bgMenuButton resource. The translation table
468 bindings can either be found in the source file source/text.c, or by adding
469 and activating a temporary translation to the text widget for dumping the
470 translation table itself (XtDisplayTranslations()).
472 What it boils down to, though, is just add the following lines to your X
473 resource file (.Xdefaults or .Xresources depending on your system):
475   NEdit*text.Translations: #override \n\
476      <Btn3Down>: secondary_or_drag_start()\n\
477      Shift Ctrl Button3<MotionNotify>: \
478          secondary_or_drag_adjust("rect", "copy", "overlay")\n\
479      Shift Button3<MotionNotify>: secondary_or_drag_adjust("copy")\n\
480      Ctrl Button3<MotionNotify>: secondary_or_drag_adjust("rect", "overlay")\n\
481      Button3<MotionNotify>: secondary_or_drag_adjust()\n\
482      Shift Ctrl<Btn3Up>: move_to_or_end_drag("copy", "overlay")\n\
483      Shift <Btn3Up>: move_to_or_end_drag("copy")\n\
484      Alt<Btn3Up>: exchange()\n\
485      Meta<Btn3Up>: exchange()\n\
486      Ctrl<Btn3Up>: copy_to_or_end_drag("overlay")\n\
487      <Btn3Up>: copy_to_or_end_drag()\n\
488      Ctrl~Meta~Alt<Btn2Down>: mouse_pan()\n\
489      Ctrl~Meta~Alt Button2<MotionNotify>: mouse_pan()\n\
490      <Btn2Up>: end_drag()
491   nedit.bgMenuButton: ~Shift~Ctrl~Meta~Alt<Btn2Down>
493 > I'd like to send mail directly from my nedit window, but there's no good
494 > way to make a shell command prompt me for input (for entering the recipient
495 > and subject).
497 Use a macro command instead to do the prompting:
499   to = string_dialog("Send mail to: (enter name below, along with any\n" \
500       "additional Unix Mail command parameters, -s for subject)", \
501       "Send", "Cancel")
502   if ($string_dialog_button == 2 || $string_dialog_button == 0)
503       return
504   if ($selection_start == -1)
505       body = get_range(0, $text_length)
506   else
507       body = get_selection()
508   cmdOutput = shell_command("Mail " to, body)
509   if ($shell_cmd_status != 0)
510       dialog("mail command returned failed exit status\n" cmdOutput)
511   else if (cmdOutput != "")
512       dialog(cmdOutput)
514 > How I can set the foreground color for selected text to be always say grey1
515 > even when syntax highlighting is applied?
517 There's no equivalent to the nedit*text.selectForeground resource when you
518 turn on syntax highlighting. You just have to choose a selection color that
519 is compatible with all of your highlighting colors.
523 FEATURES
524 --------
527 > I'm a little confused about what happend to drag and drop. I thought
528 > drag-N-drop was supported by the Motif library.
530 NEdit no longer uses the Motif text widget, so all of the functionality had
531 to be duplicated in the new widget. Drag and drop between windows got left
532 off due to time pressure of getting out the new release, but it will be
533 back some day.
535 > Why don't you integrate Max Vohlken's / Yunliang Yu's versions into the
536 > official release of NEdit
538 Many of their changes will eventually find their way in to the "official"
539 version, but some will not. Max has really done quite a lot of stuff. I
540 appreciate it, and I think it's kind of neat to have a "bleeding edge"
541 version of NEdit around to try out new features.
543 I can't just apply Max's patches to our version and release it. Some of
544 them break the VMS version, some interfere with existing commands that are
545 important to other users, and some are just customizations that I don't
546 particularly agree with. Mostly, I want to do a lot of testing to make sure
547 the changes are safe on all platforms, and I just don't have time right
548 now. (Mark Edel)
550 Update as of NEdit version 5.2RC1: The forthcoming NEdit version 5.2
551 contains several functionalities of Max's patches.
553 > I really like nedit and it would be nice to use on windows 95 or NT instead
554 > of word or notepad. Is this possible?
556 There is an NT version of NEdit, available at
557 http://nedit.org/download/win32.shtml. A mini-FAQ is also available.
559 > A feature which is found in in some Macintosh and PC programs, which I
560 > like, is to provide pre-entered default values in text fields. For example,
561 > the find and replace dialogs could show the last search/replace string, or
562 > the currently selected text. These programs select the text, so simply
563 > typing in the field automatically replaces the default without any extra
564 > work from the user.
566 X has a strict convention that there can be only one selection at a time on
567 the whole display. This means that some of the tricks used in PC and
568 Macintosh programs don't work in X. On PCs and Macs, programs can fill in
569 default values in text fields, and select the text that they have inserted
570 such that If the user types over the selection, it will automatically be
571 erased. Under X, there is a price to pay for making an automatic selection.
572 The selection must be "stolen" from some other window, maybe some other
573 program. If the user's intent was to paste a selection that existed before
574 the dialog popped up, once the automatic selection is made, they are out of
575 luck.
577 If NEdit automatically transferred the selection to the Find or Replace
578 dialog, it would either have to steal the selection, or users would have to
579 click or drag the mouse over the text to delete it before they could type
580 anything different. Instead, NEdit has a "Find Selection" command, as well
581 as various methods of pasting and copying the selection into dialog fields.
582 It also allows you to recall of previous search strings in the Find and
583 Replace dialogs via the up-arrow and down-arrow keys.
585 > I would like to use (multiple fonts, special symbols) in my file, but NEdit
586 > seems to allow just one single font.
588 NEdit is a plain text editor, not a word processor. Plain text files have
589 no font or formatting information contained in them, they are just a string
590 of ascii characters. While you might find a font with limited symbols and
591 greek letters, your troubles would just be beginning. You'd still have
592 trouble getting the printer to agree and print out the characters as they
593 appeared in NEdit. For anything involving font changes or special symbols,
594 you need a word processor, such as Microsoft Word, or a text formatting
595 program like LaTEX.
597 > Auto-wrap doesn't work very well. When I type in the middle of a line, I
598 > can push the end of the line beyond the right margin, and when I delete, It
599 > doesn't keep the right edge of the text lined up.
601 You probably want continuous wrap mode (Preferences -> Wrap -> Continuous).
603 Because NEdit is not a word processor, it is stuck with the limits of the
604 plain text format. In the default, auto-newline, wrapping mode, nedit does
605 wrapping by inserting newline characters. Because there is only one newline
606 character, NEdit can't distinguish a newline which can be "unwrapped" from
607 one which the user intended to be permanent. While it might be possible for
608 NEdit to temporarily make that distinction, for example while the cursor is
609 on a particular line that the user is typing, ultimately, NEdit will have
610 to forget this information, because there is no way to save it in the file.
611 Users who work in auto-newline wrap mode tend to make liberal use of the
612 Fill paragraph command.
614 In continuous wrapping mode, you can intentionally leave out the newlines
615 within paragraphs, and lines will be wrapped as needed to fit within the
616 page. When you edit in the middle of a paragraph, the text will be
617 continuously adjusted. However, continuous wrap mode has it's limitations
618 too. All paragraphs must be lined up against the right margin to take
619 advantage of continuous wrapping, and Unix systems have limited support for
620 files of that format. You may have trouble printing and viewing the files
621 outside of NEdit.
623 > NEdit scrolls too fast when I extend a selection by dragging the mouse
624 > outside of the window.
626 NEdit features proportional auto-scrolling, where the speed is controlled
627 by how far your mouse is beyond the edge of the window. If you want it to
628 scroll slower, bring the mouse back closer to the text.
630 > Is there a special symbol (as % for filename in the shell commands) that
631 > can be used to represent the text that is selected, which can then be used
632 > as an argument to a command? For instance, I want to feed the selection to
633 > a script so that it can be used as the expression to a 'grep' command. Is
634 > there any other way that I can accomplish this goal?
636 Below is an example from the NEdit discussion list (from David L.
637 Paterline) of a "Find All" command implemented by using the selection as an
638 argument to the grep command:
640     I set up a command to list all lines in a file which contain the
641     highlighted selection as follows, using the Preferences -> Shell
642     Commands menu:
644         Menu Entry:           all <selection>
645         Command Input:        selection
646         Command Output:       new window
647         Save file before:     yes
648         Shell Command:        grep -n -- "`cat -`" %
650     The 'cat -' portion of the command echoes the selected text to the
651     'grep -n' command, which lists the lines containing the selection with
652     line numbers. The output of the command appears in a new window; I can
653     then highlight a line number in the new window and use the Search ->
654     Goto Selected menu in the original window to jump to the line in the
655     original file.
657 > How can I print highlighted text on my printer as it appears in NEdit.
659 In the current version, that's not possible, but there are external tools
660 for highlighting, which are specifically designed for printing, including
661 a2ps, enscript, and genscript.
665 SERVER MODE AND NC
666 ------------------
669 > I use a mailer which can invoke an external editor, but if I use nc, the
670 > mailer process continues and assumes the editor has finished, when in fact
671 > it hasn't.
673 nc is actually finished communicating with the NEdit server when it
674 returns. It's possible to create a shell command that invokes nc and then
675 goes to sleep, and a second script to be run from the NEdit Shell menu,
676 which looks for the sleeping process with a matching file name and kills
677 it. Try the shell scripts in:
679     ftp://ftp.nedit.org/pub/contrib/misc/nc_and_wait.tar
681 > I started nedit (via 'nc') as root, and then later tried to edit a file as
682 > myself with 'nc'. I was very suprised to see that a new nedit wasn't
683 > started--rather, I was given the old nedit window, with root permissions.
684 > Isn't this a security hole?
686 Actually, NEdit does check who the user is. When you use the su command,
687 however, several Unix variants return the original user name in response to
688 the standard C library calls for getting a user name, rather than the name
689 to which you have su'd. Starting with version 5.1, a different mechanism is
690 used for getting this information, so you shouldn't see this problem any
691 more.
693 In your case, my guess is that you used su to become root, then started an
694 nedit server as root. On a system which returns the original user name,
695 both the new server and the nc client program think the user name is your
696 original user name, so the server accepts requests from both you as root
697 and you as you.
699 The security of an nedit session, depends upon the security of your X
700 server. Only those with access to your screen can send commands to an nedit
701 server, but they can also send keystrokes to any nedit, or a shell window,
702 etc... Anyhow, just upgrade to the latest NEdit version.
706 EDITING TECHNIQUES
707 ------------------
710 > I'd like to select a large expanse of text without dragging all the way
711 > through it with the mouse.
713 Using the shift key with the left mouse button, you can select all of the
714 text between the cursor (or an existing selection) and the mouse.
716     * Position the cursor at one end of the desired selection
718     * Use the scroll bar to make the other end visible
720     * Shift+Click with the left mouse button to select the text between the
721     cursor and the mouse
723 Alternatively, using only keyboard navigation:
725     * Position the cursor at one end of the desired selection
727     * Type Alt-m and a letter to mark the position
729     * Use the keyboard to go to the other end of the desired selection
731     * Type Shift-Alt-g and the letter you used to mark the first end of the
732     selection
734 > How can I select the text between two marks?
736     * Go to the first mark (Goto Mark).
738     * Hold the shift key while selecting Goto Mark or Alt+Shift+G to select
739     the text.
743 BUGS
744 ----
747 > The keyboard shortcuts (accelerator keys) are not working when 'Caps' or
748 > 'Num Lock' are switched on. Have I overlooked something obvious?
750 You haven't overlooked anything, it's a Motif design flaw. Netscape
751 painfully works around this and the Alt/Meta key reversal on Sun
752 workstations by internally re-implementing the Motif menu accelerator
753 mechanism. NEdit will likely follow suit with the release of version 5.2.
755 Another possibility (writes Peter Daifuku of SGI):
757     There's another answer which unfortunately isn't widespread as yet. For
758     an X11R6.3 X server supporting the XKB extension, there is a mechanism
759     to ignore the NumLock and CapsLock key as modifiers. The file
760     /usr/lib/X11/xkb/X0-config.keyboard should contain the string
761     IgnoreLockMods=NumLock+Lock . For systems with multiple displays,
762     display 1 would be controlled by the file X1-config.keyboard, etc.
764     On SGI systems, this mechanism is support on IRIX 6.2 with X server
765     patch 1574 or later, on IRIX 6.3 and IRIX 6.4 and all later releases.
767 > Sometimes NEdit inserts <dc3> instead of saving the file when I type ^S.
768 > Other keyboard shortcuts (accelerator keys) don't work either.
769 You have probably NumLock or CapsLock ON. See the answer to this (#N900)
770 question.
771 > I use the numeric keypad really often, so I keep NumLock on. But NEdit
772 > shortcuts don't work when NumLock is on.
774 The bug is not in NEdit, but in Motif. This is fixed as of NEdit 5.2, but
775 that might not help you much. Older versions have the same problem.
777 Here's how you tell X to interpret the keypad keys as numbers without
778 turning NumLock on. Create a file .Xmodmap in your home directory, and put
779 the following lines in it:
781   keycode  79 = KP_7
782   keycode  80 = KP_8
783   keycode  81 = KP_9
784   keycode  83 = KP_4
785   keycode  84 = KP_5
786   keycode  85 = KP_6
787   keycode  87 = KP_1
788   keycode  88 = KP_2
789   keycode  89 = KP_3
790   keycode  90 = KP_0
791   keycode  91 = KP_Decimal
793 Then make sure the script that starts your X session parses this file with
794 the command:
796   xmodmap -merge ~/.Xmodmap
798 This script can be ~/.xinitrc (called by startx) or something like Xsession
799 if you use xdm/kdm/gdm. Then again, it might be an entirely different
800 script on some systems.
802 Then turn off numlock, and just continue using the keypad. The only thing
803 is, you loose the alternate set of functions (cursor/home/pgdown/etc).
805 > NEdit crashes I try to paste text in to a text field in a dialog (like Find
806 > or Replace) on my SunOS system.
808 On many SunOS systems, you have to set up an nls directory before various
809 inter-client communication features of Motif will function properly. Before
810 NEdit 4.0 this wasn't much of a problem, because users couldn't cut and
811 paste at all, and Motif would sometimes print a warning about not finding
812 an nls directory, so most users figured it out right away. But with 4.0,
813 everything seems to be working fine, except when someone tries to move text
814 in or out of a dialog field, then blamo.
816 There are instructions in README.sun in
817 ftp://ftp.nedit.org/pub/<current-version<, as well as a tar file containg a
818 complete nls directory:
819 ftp://ftp.nedit.org/pub/<current-version</individual/README.sun
821 It contains directions for setting up an nls directory, which is required
822 by Motif for handling copy and paste to Motif text fields.
824 > NEdit crashes frequently, particularly on window closing.
826 There is an obsolete resource in Motif called defaultFontList, which does
827 nothing but cause random crashing. I don't know why NEdit users keep
828 popping up with this resource set, maybe it looks enticing when you look at
829 widget resources with editres. Anyhow, setting it to anything, whether it
830 be a valid font or just garbage, causes random crashing in both Motif 1.2
831 and 2.0, so just don't set it.
833 > NEdit sometimes crashes when I execute a shell command menu item I just
834 > added.
836 Check the "Command Input" setting, in the Preferences->Shell Commands
837 dialog for that menu item. If the shell command being executed does not
838 take input, but "Command Input" is set to "selection" or "window", NEdit
839 tries to write the input anyhow, and fails. Set "Command Input" to "none"
840 to prevent this possibility. This is fixed in version 5.1 and later.
842 > When NEdit starts up, I get errors:
844 >    Cannot allocate colormap entry for "#b3b3b3"
845 >    Cannot allocate colormap entry for "#e5e5e5"
847 Most X displays are set up to operate in a mode which allocates 8 bits of
848 video memory per-pixel, and requires a color mapping table to translate
849 pixel values to screen colors. With just 8 bits there are only 256 possible
850 colors, and programs must either allocate and share these pixel values, or
851 swap in their own colormap and make all other windows flash to strange
852 colors while their window is focused. Some programs, Netscape in
853 particular, are bad neighbors in this environment and snarf up every free
854 entry in the shared colormap, such that every program that runs after them
855 gets the errors you're asking about.
857 The solution is either to start Netscape last, after all other applications
858 that you might want to run, or better, tell Netscape how many colors it is
859 allowed to allocate. Fortunately, you can do this with a resource setting:
861     Netscape*maxImageColors: 80
863 > Sometimes when I use regular expression replacement inside of a rectangular
864 > selection, NEdit fails to match text which does legally match the
865 > expression.
867 The problem with REs and rectangular selections is that matching is bounded
868 by the rectangular selection, but text outside of the selection is still
869 fed to the matching routines, so ^, $, don't refer to the edges of the
870 selection, they still refer to the beginning and ending of the line, and
871 some legal matches are excluded because they continue outside of the
872 selection are thereby excluded, or are shadowed by matches which begin or
873 end outside of the selection.
875 > When ever I execute an nedit shell command (such as spell or wc) I get
876 > (extra junk, error messages, complaints from stty) inserted into my text,
877 > or an Information dialog with (extra junk, error messages, complaints from
878 > stty).
880 You probably have printing commands in your shell startup file (.cshrc, or
881 equivalent). These should either be skipped in non-interactive mode, or
882 moved to your .login file. You can often see the problem outside of nedit
883 by typing:
885     csh -c ls
887 Error messages from stty are a result of it being executed from a process
888 which isn't attached to a terminal. You can safely move stty statements and
889 most other interactive commands to your .login file (calling stty from a
890 .cshrc file is redundant because the terminal device doesn't change for
891 each sub-shell). If you can't remove interactive commands, you should skip
892 around them in non-interactive shells, I think the usual method is to put
893 them at the end, preceded by something like:
895     if ($?prompt == 0) exit
897 The manual entry on csh has more information on this.
899 > On a Solaris system, when trying to open a file within nedit, you get the
900 > listing of available file names. However, the sub-window (on the right)
901 > containing the file names (not directory names) sometimes is too narrow so
902 > that you can't see the filename part (i.e.
903 > /usr/people/rainer/sometextfile.txt shows up as /usr/people/rain or so).
904 > When resizing the dialog box, the filenames sub-window on the right doesn't
905 > become larger. I know I can use nedit.stdOpenDialog to type a filename, but
906 > that's annoying.
908 It's a bug in the shared Motif library. Depending on your system, the patch
909 is one of ID# 103461-07, # 102226-19, or # 103186-21. If you can't patch
910 your system, you can set the resource:
912     nedit*XmFileSelectionBox.pathMode:  XmPATH_MODE_RELATIVE
914 This will stop the dialog from displaying the path component of file names.
915 Another possible workaround is to use the nedit_sunos executable (from
916 ftp://ftp.nedit.org/pub/), which is statically linked with a good Motif.
918 > When I try to open a file from the "Open" dialog nothing appears in the
919 > "Filter" textfield. Instead, I get repeated message like:
921 >     Name: Text
922 >     Class: XmTextField
923 >     Character '/' not supported in font.  Discarded.
925 In some versions of S.u.S.E. Linux, there's apparently something wrong with
926 their builds of NEdit and other Motif apps. I've been told you can make
927 nedit work by seting the environment variable LD_PRELOAD to
928 /lib/libBrokenLocale.so.1 before launching it. You can also use the
929 statically linked version of NEdit for Linux from ftp://ftp.nedit.org/pub/
931 > NEdit seems to be running very slowly on my Solaris 2.6 system.
933 If you're running NEdit on a Solaris 2.6 system and experiencing
934 performance problems (windows come up slowly), the patch for Sun's shared
935 Motif library is ID# 105284-04. Installing the patch alone will improve the
936 performance dramatically. The patch also enables a resource,
937 *XmMenuReduceGrabs. Setting this to True will eliminate the delay
938 completely.
940 > I can't seem to enter accented characters on my system.
942 This should be working properly on most systems as of NEdit 5.1 or later.
943 If it's not, try re-building NEdit with -DNO_XMIM. If it still doesn't
944 work, send mail to develop@nedit.org
946 > When I try to use nc to start an nedit server, for instance using
948 >     nc (filename)
950 > I receive the following error message:
952 >    (filename): forward host lookup failed:
953 >                Host name lookup failure: Connection refused
955 There is another program called 'nc' which is installed on some systems. In
956 this case, 'nc' is for 'netcat', some kind of network diagnostic tool. You
957 can safely rename NEdit's 'nc' to something else (we recommend ncl), or put
958 it first in your path before 'netcat'.
960 > Whenever I try to open existing files by using menu, nedit crashes, and
961 > sometimes I get the following error message:
963 >    X Error of failed request:  BadAlloc (insufficient resources for operation)
964 >    Major opcode of failed request:  53 (X_CreatePixmap)
966 > But if I type 'nedit filename' command, it works. So how can I open file by
967 > using menu bar?
969 Several users have reported this problem. Most of them were using S.u.S.E.
970 Linux . A few others had different distributions, but always European. The
971 problem appears to be related to how Motif searches for named pixmaps and
972 bitmaps. My guess is that on some systems, this search encounters a match
973 with a bad pixmap file, or tries to load something which is not a pixmap at
974 all. One solution was to set the environment variable XBMLANGPATH to a
975 random directory. For example:
977   XBMLANGPATH=.
978   export XBMLANGPATH
980 The solution on S.u.S.E Linux systems was to remove an unnecessary line in
981 the global /etc/profile (provided by S.u.S.E.):
983   export XAPPLRESDIR=
984       "$XAPPLRESDIR:/var/X11R6/app-defaults:/usr/X11R6/lib/X11/app-defaults"
986 Another user who had the problem reported that the root cause appeared to
987 be insufficient read permissions on some xm_* (e.g. xm_warning) pixmaps in
988 "/usr/X11R6/include/X11/bitmaps". (Could someone else confirm this?)
990 > I want to be able to spawn a command from NEdit. By this I mean that I want
991 > to NEdit to launch another program without waiting for the program to
992 > return. At the moment I'd like to be able to launch 'mctags', but I also
993 > have a variety of other things I'd like to do. The shell command: 'mctags
994 > &' continues to wait for mctags to finish, despite the "&". Is there any
995 > way to do what I want?
997 It's a bug/feature of NEdit that it considers a shell command process alive
998 as long as any of it's file descriptors remain open. Forked processes
999 generally copy and keep open the stdout and stderr descriptors from their
1000 parent process, so you have to add '>& /dev/null' to your shell command, so
1001 it reads:
1003     mctags >& /dev/null &
1005 > NEdit flashes or matches the wrong parenthesis, bracket, or brace if there
1006 > is an intervening paren/bracket/brace quoted in between.
1008 Until version 5.0, NEdit had no way of even knowing what language you were
1009 operating in when making the flash/match decision, so it simply counted
1010 opening and closing instances, disregarding language syntax context
1011 (strings, comments, etc.) completely. Now that the feature is more possible
1012 to implement, it may be included in a future version, but I'm not entirely
1013 sure how best to do it yet.
1015 > I'd like to edit a file which is about 50 Megabytes long. Whenever I try to
1016 > read this file, there was always a message as following:
1018 >     Error: Cannot perform realloc
1020 How large a file you can edit with NEdit depends on how much swap space +
1021 RAM you have, since it loads your file into virtual memory and occasionally
1022 does a full copy of that memory space. NEdit can handle a 100MB file
1023 reasonably well if you increase your swap space, but I don't know how far
1024 beyond that it can go. To work with a 100MB file, you must have at least
1025 200MB of virtual memory available. Many Unix systems can be set up to
1026 temporarily increase swap space by creating a temporary swap file.
1028 > We installed NEdit Version 5.0 recently, and the accelerators Ctrl-G (Find
1029 > again) and Ctrl-L (Goto Line Number) are now missing
1031 You have an out-of-date app-defaults file. We strongly recommend not using
1032 such files for this exact reason. When you use an app-defaults file, it
1033 replaces ALL of the program defaults. If you do install an app-defaults
1034 file, it is your responsibility to keep it up to date with each new release
1035 of the executable. Otherwise, as you have observed, certain features will
1036 degrade with each release, as the app-defaults file and the executable get
1037 further and further out of sync with eachother.
1039 > On our PCs we have Windows 3.1 and we run XVision as X-Server. The problem
1040 > that we have is, that we cannot mark with the mouse within NEdit.
1042 > When you click and hold the left mouse button and then move the mouse, you
1043 > can see the mark-area flickering during the movement of the mouse. When
1044 > stopping the movement nothing is highlighted and nothing is marked.
1046 XVision is grabbing the selection immediately, as soon as it is made, not
1047 allowing applications to own it. This behavior is completely wrong, and I
1048 have no idea what they might have been thinking when they implemented it.
1049 It may be possible to turn it off, ask their technical support people if
1050 they're not already out of business.
1052 > My regular expression replacement got truncated! I wrote a regular
1053 > expression to nest additional braces around blocks of code (replace
1054 > {([^{}]|\n)*} with {\0}), which works for small blocks of text, but it
1055 > fails on large ones, truncating the replacement at around 512 bytes.
1057 A remnant of pre-regular-expression, pre-macro-language NEdit, is that
1058 replacement strings are limited to 511 bytes. This is high on the list to
1059 fix in a future upgrade.
1061 > NEdit is slow and pages continuously on my 8MB Linux system
1063 On most Unix workstations, 8MB of RAM is actually insufficient to run X and
1064 Motif properly. Some Linux users get by with it and Linux itself seems to
1065 be quite memory efficient, but you really should have 12 or 16 if you're
1066 going to be using X much. NEdit would not be my first choice in editors on
1067 an 8MB system.
1069 > Some of the special keys on my keyboard don't do what I expect.
1071 X systems are rife with this kind of problem because are just too many
1072 levels of re-settable bindings between the keyboard and the application
1073 program that reads it. Sun systems are the worst offenders, combining poor
1074 Motif support with a variety of strange keyboard arrangements.
1076 To diagnose these problems, you have to look at all three levels of key
1077 binding that affect Motif programs.
1079 At the bottom level are the modifier map and keymap table, where hardware
1080 key codes are bound to X keysyms. You can see the bindings on this level
1081 with the xmodmap program (see man xmodmap). A useful tool in debugging the
1082 xmodmap level is a program like xev, which can show you the keysyms it
1083 receives.
1085 The next level up from that is the motif virtual binding level (see man
1086 VirtualBindings). You can (usually) view the bindings at this level by
1087 looking at the value of the root window property: _MOTIF_DEFAULT_BINDINGS,
1088 using the xprop -root command, however what you see is not necessarily what
1089 you'll get. The defaults for these bindings are determined by an
1090 unbelievably complicated process involving not just the application in
1091 question, but Motif applications which have run before it attached to the
1092 same server. This process is described in detail in the VirtualBindings
1093 manual page (which is often not available on systems where the bindings are
1094 messed up). While it's usually better to attack system configuration
1095 problems at the source, this one is so contorted that you're better off
1096 with a patch. Luckily, the default Motif virtual bindings can be overridden
1097 by an application resource called defaultVirtualBindings. If you think the
1098 problem is at the Motif virtual binding level, define a
1099 defaultVirtualBindings resource in your .Xresources or .Xdefaults file,
1100 using the example below as a template, replacing the keysym names (to the
1101 right of the colon) with the keysyms shown by xev when you press the
1102 desired key:
1104    !
1105    ! Motif Virtual Key Bindings
1106    !
1107    nedit*defaultVirtualBindings: \
1108         osfActivate     :               <Key>KP_Enter\n\
1109         osfCancel       :               <Key>Escape\n\
1110         osfHelp         :               <Key>Help\n\
1111         osfMenu         :               <Key>F4\n\
1112         osfMenuBar      :               <Key>F10\n\
1113         osfLeft         :               <Key>Left\n\
1114         osfUp           :               <Key>Up\n\
1115         osfRight        :               <Key>Right\n\
1116         osfDown         :               <Key>Down\n\
1117         osfBeginLine    :               <Key>Home\n\
1118         osfEndLine      :               <Key>End\n\
1119         osfPageUp       :               <Key>Prior\n\
1120         osfPageDown     :               <Key>Next\n\
1121         osfBackSpace    :               <Key>BackSpace\n\
1122         osfDelete       :               <Key>Delete\n\
1123         osfInsert       :               <Key>Insert\n\
1124         osfUndo         :               <Key>F14\n\
1125         osfAddMode      :Shift          <Key>F8\n\
1126         osfCopy         :               <Key>F16\n\
1127         osfCut          :               <Key>F20\n\
1128         osfPaste        :               <Key>F18\n
1130 If NEdit is having binding problems, chances are that other Motif-based
1131 programs are also having trouble. Removing the "nedit" from the resource
1132 name above (just *defaultVirtualBindings), will apply it to the other Motif
1133 programs that you run as well.
1135 The top level bindings in the key binding hierarchy, are the X toolkit
1136 translation tables (see the NEdit Help section called X Resources). To show
1137 the translations in use, you can add a binding which dumps the table
1138 itself:
1140     nedit*text.Translations: #override \
1141         Alt<Key>t: XtDisplayTranslations()\n
1143 Typing Alt+T will then display the contents of the translation table to
1144 stdout (the terminal from which you started NEdit). If you have the NEdit
1145 source, you can also look at the default bindings in the module text.c.
1147 Sometimes, even if you don't understand the problem, you can patch around
1148 it by supplying translations for the keysyms that NEdit actually sees,
1149 binding them to the action routines that you want activated when you press
1150 that key.
1152 $Id: faq.txt,v 1.3 2002/09/26 12:37:37 ajhood Exp $