⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 diff

📁 早期freebsd实现
💻
📖 第 1 页 / 共 2 页
字号:
YOU WILL LOSE: C mode does not know a function starts there.Open-brace at the beginning of a line makes it possiblefor C mode to find function boundaries with total reliability;something I consider vital and which cannot be doneif the other style is used.The Tab command indents C code very cleverly.I know of only one cases in which Tab does not indent C code nicely: Expressions continued over several lines with few parentheses. Tab does not know the precedences of C operators, so it does not know which lines of the expression should go where. Using parentheses to indicate the nesting of operators except within a line makes this problem go away.The indenting algorithm is entirely written in Lisp.Tab with a numeric argument in Twenex Emacs indentsthat many lines.  It is different in GNU Emacs: it meansto shift all the lines of a bracketed expression by thesame amount as the line being indented.  For example, if you have    if (foo)        {	    hack ();	     /** Well? */	}and type C-u Tab on the line with the open brace, you get    if (foo)      {	  hack ();	   /* Well? */      }from indenting the brace line and then shifting thelines within the braces rigidly with the first one.Meta-Control-q works as in Lisp mode; it should beused with dot just before a bracketed grouping, andindents each line INSIDE that grouping using Tab.If used instead of C-u Tab in the previous example, it makes    if (foo)        {	  hack ();	  /* Well? */	}Meta-Control-h puts mark at the end of the current C functionand puts dot before it.Most other Meta-Control commands intended for Lisp expressionswork usefully in C mode as well.** Meta-g (fill-region) is different.In Twenex Emacs, Meta-g fills the region with no paragraphboundaries except for blank and indented lines.  In GNU Emacs,it divides the region into paragraphs in the same manner asMeta-], and fills each paragraph separately.  There is alsothe function fill-region-as-paragraph which fills the regionregarding at as a single paragraph regardless even of blankor indented lines.** Indented Text Mode instead of Edit Indented Text.Twenex Emacs has a command Edit Indented Text which temporarilyalters some commands for editing indented paragraphs.GNU Emacs has instead a separate major mode, Indented Text Mode,which is different from ordinary Text Mode in just the samealterations.  Specifically, in Indented Text Mode,Tab runs the function indent-relative, and auto filling indentsthe newly created lines.** But rectangle commands are implemented.C-x r stores the rectangle described by dot and markinto a register; it reads the register name from the keyboard.C-x g, the command to insert the contents of a register,can be used to reinsert the rectangle elsewhere.Other rectangle commands include  open-rectangle:    insert a blank rectangle in the position and size    described by dot and mark, at its corners;    the existing text is pushed to the right.  clear-rectangle:    replace the rectangle described by dot ane mark    with blanks.  The previous text is deleted.  delete-rectangle:    delete the text of the specified rectangle,    moving the text beyond it on each line leftward.  kill-rectangle    like delete-rectangle but also stores the text of    the rectangle in the "rectangle kill buffer".    More precisely, it stores the text as a list of strings    (one string for each line) in the variable killed-rectangle.  yank-rectangle    inserts the text of the last killed rectangle.  extract-rectangle and delete-extract-rectangle    these functions return the text of a rectangle    as a list of strings.  They are for use in writing    other functions that operate on rectangles.   ** Keyboard MacrosThe C-x ( command for defining a keyboard macro can in GNU Emacsbe given a numeric argument, which means that the new macrostarts out not empty but rather as the same as the lastkeyboard macro entered.  In addition, that last keyboardmacro is replayed when the C-x ( is typed.  C-x ( with anargument is thus equivalent to typing plain C-x ( and thenretyping the last keyboard macro entered.The command write-kbd-macro and append-kbd-macro can be used tosave a keyboard macro definition in a file.  It is represented asa Lisp expression which, when evaluated, will define the keyboardmacro.  write-kbd-macro writes the specified file from scratch,whereas append-kbd-macro adds to any existing text in the file.Both expect the keyboard macro to be saved to be specified byname; this means you must use the command name-last-kbd-macro togive the macro a name before you can save it.** The command to resume a terminated tags-search or tags-query-replaceis Meta-comma in GNU Emacs.** Auto Save is on by default.Auto Save mode is enabled by default in all buffersthat are visiting files.The file name used for auto saving is made by prepending"#" to the file name visited.** Backup files.Since Unix stupidly fails to have file version numbers,GNU Emacs compensates slightly in the customary fashion:when a file is modified and saved for the first time ina particular GNU Emacs run, the original file is renamed,appending "~" to its name.  Thus, foo.c becomes foo.c~.Emacs can also put a version number into the name of the backup file,as in foo.c.~69~ for version number 69.  This is an optional featurethat the user has to enable.** Mode Line differences.Each window in GNU Emacs has its own mode line, which alwaysdisplays the status of that window's buffer and nothing else.The mode line appears at the bottom of the window.  It isfull of dashes, to emphasize the boundaries between windows,and is displayed in inverse video if the terminal supports it.The information usually available includes:** Local Modes feature changed slightly.GNU Emacs supports local mode lists much like those in Twenex Emacs,but you can only set variables, not commands.  You writeLocal variables:tab-width:      10end:in the last page of a file, if you want to make tab-width be ten in afile's buffer.  The value you specify must be a Lisp object!It will be read, but not evaluated.  So, to specify a string,you MUST use doublequotes.  For "false", in variables whosemeanings are true or false, you MUST write  nil  .Two variable names are special: "mode" and "eval".Mode is used for specifying the major mode (as in Twenex Emacs).mode: textspecifies text mode.  Eval is used for requesting the evaluationof a Lisp expression; its value is ignored.  Thus,eval: (set-syntax-table lisp-mode-syntax-table)causes Lisp Mode syntax to be used.Note that GNU Emacs looks for the string "Local variables:"whereas Twenex Emacs looks for "Local modes:".  This incompatibilityid deliberate, so that neither one will see local settingsintended for the other.** Lisp code libraries.Libraries of commands, and init files, are written in Lisp.libraries conventionally have names ending in .el, while theinit file is named .emacs and is in your home directory.Use  Meta-x load-library  to load a library.  Most standard librariesload automatically if you try to use the commands in them.Meta-x byte-compile-file filenamecompiles the file into byte code which loads and runs fasterthan Lisp source code.  The file of byte code is given a namemade by appending "c" to the end of the input file name.Meta-x byte-recompile-directory directorynamecompiles all files in the specified directory (globbing not allowed)which have been compiled before but have been changed since then.Meta-x load-library automatically checks for a compiled filebefore loading the source file.Libraries once loaded do not retain their identity within GNUEmacs.  Therefore, you cannot tell just what was loaded from alibrary, and you cannot un-load a library.  Normally, librariesare written so that loading one has no effect on the editingoperations that you would have used if you had not loaded thelibrary.** Dired features.You can do dired on partial directories --- any patternthe shell can glob.  Dired creates a buffer named afterthe directory or pattern, so you can dired several differentdirectories.  If you repeat dired on the same directory orpattern, it just reselects the same buffer.  Use Meta-x Reverton that buffer to read in the current contents of the directory.** Directory listing features.C-x C-d now uses the default output format of `ls',which gives just file names in multiple columns.C-u C-x C-d passes the -l switch to `ls'.Both read a directory spec from the minibuffer.  It canbe any pattern that the shell can glob.** Compiling other programs.Meta-x compile allows you to run make, or any other compilationcommand, underneath GNU Emacs.  Error messages go into a buffer whosename is *compilation*.  If you get error messages, you can use thecommand C-x ` (that is a backquote) to find the text of the nexterror message.You must specify the command to be run as an argument to M-x compile.A default is placed in the minibuffer; you can kill it and startfresh, edit it, or just type Return if it is what you want.The default is the last compilation command you used; initially,it is "make -k".** Searching multiple files.Meta-x grep searches many files for a regexp by invoking grepand reading the output of grep into a buffer.  You can thenmove to the text lines that grep found, using the C-x ` commandjust as after M-x compile.** Running inferior shells.Do Meta-x shell to make an inferior shell together with a bufferwhich serves to hold "terminal" input and output of the shell.The shell used is specified by the environment variable ESHELL,or by SHELL if ESHELL is not set.Use C-h m whilst in the *shell* buffer to get more detailed info.The inferior shell loads the file .emacs_csh or.emacs_sh(or similar using whatever name the shell has) when it starts up.M-! executes a shell command in an inferior shelland displays the output from it.  With a prefix argument,it inserts the output in the current buffer after dotand sets the mark after the output.  The shell commandgets /dev/null as its standard input.M-| is like M-! but passes the contents of the regionas input to the shell command.  A prefix argument makesthe output from the command replace the contents of the region.** Sending mail.Once you enter Mail Mode using C-x m or C-x 4 m or M-x mail,C-c becomes a prefix character for mail-related editing commands.C-c C-s is vital; that's how you send the message.  C-c C-c sendsand then switches buffers or kills the current window.Use C-h m to get a list of the others.** Regular expressions.GNU Emacs has regular expression facilities like those of mostUnix editors, but more powerful:***		-- + --+ specifies repetition of the preceding expression 1 or moretimes.  It is in other respect like *, which specifies repetition0 or more times.***		-- ? --?  is like * but matches at most one repetition of the precedingexpression.***		-- \| --\| specifies an alternative.  Two regular expressions A and B with \| inbetween form an expression that matches anything that either A or B willmatch.  Thus, "foo\|bar" matches either "foo" or "bar" but no otherstring.\| applies to the larges possible surrounding expressions.  Only asurrounding \( ... \) grouping can limit the grouping power of \|.Full backtracking capability exists when multiple \|'s are used.***		-- \( ... \) --\( ... \) are a grouping construct that serves three purposes:1.  To enclose a set of \| alternatives for other operations.    Thus, "\(foo\|bar\)x" matches either "foox" or "barx".2.  To enclose a complicated expression for * to operate on.    Thus, "ba\(na\)*" matches "bananana", etc., with any number    of na's (zero or more).3.  To mark a matched substring for future reference.Application 3 is not a consequence of the idea of a parentheticalgrouping; it is a separate feature which happens to be assigned as asecond meaning to the same \( ... \) construct because there is noconflict in practice between the two meanings.  Here is an explanationof this feature.		-- \digit --After the end of a \( ... \) construct, the matcher remembers thebeginning and end of the text matched by that construct.  Then, later onin the regular expression, you can use \ followed by a digit to mean,``match the same text matched this time by the \( ... \) construct.''The first nine \( ... \) constructs that appear in a regular expressionare assigned numbers 1 through 9 in order of their beginnings.  \1through \9 can be used to refer to the text matched by the corresponding\( ... \) construct.For example, "\(.*\)\1" matches any string that is composed of twoidentical halves.  The "\(.*\)" matches the first half, which can beanything, but the \1 that follows must match the same exact text.***		-- \` --Matches the empty string, but only if it is at the beginning of the buffer.***		-- \' --Matches the empty string, but only if it is at the end of the buffer.***		-- \b --Matches the empty string, but only if it is at the beginning or end ofa word.  Thus, "\bfoo\b" matches any occurrence of "foo" as a separate word."\bball\(s\|\)\b" matches "ball" or "balls" as a separate word.***		-- \B --Matches the empty string, provided it is NOT at the beginning or end ofa word.***		-- \< --Matches the empty string, provided it is at the beginning of a word.***		-- \> --Matches the empty string, provided it is at the end of a word.***		-- \w --Matches any word-constituent character.  The editor syntax table determineswhich characters these are.***		-- \W --Matches any character that is not a word-constituent.***		-- \s<code> --Matches any character whose syntax is <code>.  <code> is a letter thatrepresents a syntax code: thus, "w" for word constituent, "-" forwhitespace, "(" for open-parenthesis, etc.  Thus, "\s(" matches anycharacter with open-parenthesis syntax.***		-- \S<code> --Matches any character whose syntax is not <code>.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -