diff --git a/ChangeLog b/ChangeLog index db4f7a2aacd..a97a1fa2c26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-04-17 Richard M. Stallman + + * INSTALL: Move the info about site-lisp dirs, + and say uninstalled Emacs looks there too. + 2004-04-04 Eli Zaretskii * config.bat (lib-src): Recognize comment lines in Makefile.in diff --git a/INSTALL b/INSTALL index 255a6bcdc17..b18baaa1efa 100644 --- a/INSTALL +++ b/INSTALL @@ -466,17 +466,6 @@ are installed in the following directories: at the same time; in particular, you don't have to make Emacs unavailable while installing a new version. -`/usr/local/share/emacs/VERSION/site-lisp' holds the local Emacs Lisp - files installed for Emacs version VERSION only. - -`/usr/local/share/emacs/site-lisp' holds the local Emacs Lisp - files installed for all Emacs versions. - - When Emacs is installed, it searches for its Lisp files - in `/usr/local/share/emacs/VERSION/site-lisp', then in - `/usr/local/share/emacs/site-lisp', and finally in - `/usr/local/share/emacs/VERSION/lisp'. - `/usr/local/share/emacs/VERSION/etc' holds the Emacs tutorial, the DOC file, the `yow' database, and other architecture-independent files Emacs might need while @@ -506,6 +495,20 @@ are installed in the following directories: `/usr/local/man/man1' holds the man pages for the programs installed in `/usr/local/bin'. +Any version of Emacs, whether installed or not, also looks for Lisp +files in these directories. + +`/usr/local/share/emacs/VERSION/site-lisp' holds the local Emacs Lisp + files installed for Emacs version VERSION only. + +`/usr/local/share/emacs/site-lisp' holds the local Emacs Lisp + files installed for all Emacs versions. + + When Emacs is installed, it searches for its Lisp files + in `/usr/local/share/emacs/VERSION/site-lisp', then in + `/usr/local/share/emacs/site-lisp', and finally in + `/usr/local/share/emacs/VERSION/lisp'. + If these directories are not what you want, you can specify where to install Emacs's libraries and data files or where Emacs should search for its Lisp files by giving values for `make' variables as part of diff --git a/etc/ChangeLog b/etc/ChangeLog index 580c256f12e..bd7ca250615 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2004-04-16 David Kastrup + + * TUTORIAL.ru: Changes by Alex Ott checked in. + 2004-04-14 Jan Nieuwenhuizen * TUTORIAL.nl: Update Delete/Delback translation. diff --git a/etc/NEWS b/etc/NEWS index e7b2355b222..1659cccf12b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -88,6 +88,7 @@ types any more. Add -DUSE_LISP_UNION_TYPE if you want union types. * Changes in Emacs 21.4 ++++ ** New command line option -Q. This is like using -q --no-site-file, but in addition it also disables diff --git a/etc/TUTORIAL.fr b/etc/TUTORIAL.fr index 953e9edb649..ae88ff4a242 100644 --- a/etc/TUTORIAL.fr +++ b/etc/TUTORIAL.fr @@ -1197,6 +1197,7 @@ Cette traduction fran ;;; Local Variables: ;;; coding: latin-1 +;;; sentence-end-double-space: nil ;;; End: ;;; arch-tag: f6c5c2ff-bf24-477c-bd18-32f76f51ba65 diff --git a/etc/TUTORIAL.it b/etc/TUTORIAL.it index 7936bbd298f..02a91045d0e 100644 --- a/etc/TUTORIAL.it +++ b/etc/TUTORIAL.it @@ -1114,4 +1114,8 @@ copie di GNU Emacs ai vostri amici. Aiutateci a combattere l'ostruzionismo al software ("la proprietЮ") usando, scrivendo e condividendo software libero! +;;; Local Variables: +;;; coding: latin-1 +;;; End: + ;;; arch-tag: c6f7079d-8032-473d-91d4-36754af15719 diff --git a/etc/TUTORIAL.nl b/etc/TUTORIAL.nl index b4f21f1e1c5..989f8334fd1 100644 --- a/etc/TUTORIAL.nl +++ b/etc/TUTORIAL.nl @@ -830,8 +830,7 @@ het zoeken. zien wat er met de cursor gebeurt. Je hebt nu eenmaal naar het woord `cursor' gezocht. >> Type nogmaals C-s, om het volgende woord `cursor' te zoeken - -> Type nu viermaal en let op de cursorbewegingen. +>> Type nu viermaal en let op de cursorbewegingen. >> Type om het zoeken te beКindigen. Zag je wat er gebeurde? Tijdens incrementeel zoeken probeert Emacs naar @@ -1093,4 +1092,8 @@ same spirit. Please read the file COPYING and then do give copies of GNU Emacs to your friends. Help stamp out software obstructionism ("ownership") by using, writing, and sharing free software!) +;;; Local Variables: +;;; coding: latin-1 +;;; End: + ;;; arch-tag: 3399e308-e605-4125-8fbb-b2fe91ac3149 diff --git a/etc/TUTORIAL.pl b/etc/TUTORIAL.pl index 012cd143c45..501df8f6521 100644 --- a/etc/TUTORIAL.pl +++ b/etc/TUTORIAL.pl @@ -1239,13 +1239,10 @@ z t znajomym kopie Emacsa. PomС© tЙpiФ obstrukcjonizm w informatyce, u©ywaj╠c, tworz╠c i dziel╠c siЙ oprogramowaniem swobodnym. - ;;; Local Variables: ;;; mode: fundamental ;;; coding: latin-2 +;;; sentence-end-double-space: nil ;;; End: - - - ;;; arch-tag: 6c6b7445-4cd5-44ca-a101-7f4697b92f60 diff --git a/etc/TUTORIAL.ru b/etc/TUTORIAL.ru index bb7480d913f..84f4b4c6c82 100644 --- a/etc/TUTORIAL.ru +++ b/etc/TUTORIAL.ru @@ -1,43 +1,41 @@ -;; -*- coding: cyrillic-koi8; -*- -Copyright (c) 1985, 1996 Free Software Foundation, Inc. See end for conditions. - -Вы читаете учебник Emacs. +Вы читаете учебник Emacs. Условия копирования в конце файла. +Copyright (c) 1985, 1996, 2004 Free Software Foundation, Inc. Для управления Emacs обычно используется ключ (сочетание клавиш клавиатуры -и/или кнопок мыши), включающий в себя клавишу CONTROL (иногда отмечаемая как -CTRL или CTL) или клавишу META (иногда помеченную как ALT или EDIT). В -дальнейшем вместо того, чтобы каждый раз писать META или CONTROL мы будем +и/или кнопок мыши), включающий в себя клавишу CONTROL (иногда отмечаемая +как CTRL или CTL) или клавишу META (иногда помеченную как ALT или EDIT). В +дальнейшем вместо того, чтобы каждый раз писать META или CONTROL, мы будем использовать следующее сокращение: - C- следует удерживать клавишу CONTROL пока набирается символ + C- следует удерживать клавишу CONTROL, пока набирается символ . Так, C-f должно означать: нажать клавишу CONTROL и f. - M- следует удерживать клавишу META пока набирается символ . Если + M- следует удерживать клавишу META, пока набирается символ . Если нет клавиши META, ALT или EDIT, то нажмите , отпустите ее, а потом наберите символ . -Важное замечание: для завершения сеанса Emacs, наберите C-x C-c. (Два +Важное замечание: для завершения сеанса Emacs, наберите C-x C-c. (Два символа). Символы ">>" с левой стороны указывают, что вам нужно делать, -чтобы применить команду. Например: -<<Середина страницы оставлена пустой для учебных целей. Текст прдолжается ниже>> +чтобы применить команду. Например: +<<Середина страницы оставлена пустой для учебных целей. Текст продолжается ниже>> >> Теперь нажмите C-v (Просмотр следующего экрана) для перемещения на следующий экран. (Выполните это, удерживая клавишу CONTROL нажимая v). Теперь вы должны это сделать еще раз, когда закончите читать экран. Обратите внимание на то, что, пока вы движетесь с экрана на экран, -перекрываются две строчки; это обеспечивает некоторую непрерывность, так что -вы можете продолжить читать текст. +перекрываются две строчки; это обеспечивает некоторую непрерывность, так +что вы можете продолжить читать текст. -Первое что вам необходимо знать -- как передвигаться по тексту из одного +Первое, что вам необходимо знать -- как передвигаться по тексту из одного места в другое. Вы уже знаете, как переместиться вперед один экран, -используя ключ C-v. Для перемещения назад на один экран, нажмите M-v -(удерживайте клавишу META и наберите v, или нажмите v если у вас нет -клавише META, EDIT, или ALT). +используя ключ C-v. Для перемещения назад на один экран, нажмите M-v +(удерживайте клавишу META и наберите v, или нажмите v, если у вас нет +клавишы META, EDIT, или ALT). >> попробуйте набрать M-v и потом C-v, несколько раз. * КРАТКАЯ СВОДКА ---------- +---------------- Для просмотра используются следующие команды: @@ -47,18 +45,18 @@ CTRL текст, находящийся возле курсора, в центре экрана. (Это CONTROL-L, а не CONTROL-1.) ->> Найдите курсор, и запомните текст возле него. Потом нажмите C-l. +>> Найдите курсор, и запомните текст возле него. Потом нажмите C-l. Найдите курсор снова и убедитесь, что возле него все тот же текст. * БАЗОВЫЕ КОМАНДЫ УПРАВЛЕНИЯ КУРСОРОМ ------------------------------ +------------------------------------- Движение от экрана к экрану удобно, но как переместиться в определенное место текста на экране? -Есть насколько способов сделать это. Основной способ -- использовать команды -C-p, C-b, C-f и C-n. Каждая из этих команд передвигает курсор на одну +Есть несколько способов сделать это. Основной способ -- использовать команды +C-p, C-b, C-f и C-n. Каждая из этих команд передвигает курсор на одну строку или колонку на экране в определенном направлении. Эта таблица показывает четыре команды и четыре направления их движения: @@ -78,7 +76,7 @@ C-p, C-b, C-f F-вперед (forward). Это основные команды позиционирования курсора, которыми Вы будете пользоваться ВСЕГДА, так что будет неплохо их выучить. ->> Нажмите несколько раз C-n чтоб опустить курсор вниз на эту строку. +>> Нажмите несколько раз C-n, чтобы опустить курсор вниз на эту строку. >> Переместитесь по строке, используя C-f и потом поднимитесь вверх с помощью C-p. Посмотрите, как изменилось положение курсора при нажатии @@ -95,7 +93,7 @@ character), C-f может перемещать курсор через символ перевода строки так же, как и C-b. ->> Попробуйте несколько раз применить C-b, так чтобы Вы увидели, как +>> Попробуйте несколько раз применить C-b так, чтобы Вы увидели, как движется курсор. Далее используйте C-f чтобы вернуться на конец строки. Нажмите C-f еще раз, чтобы перейти к началу следующей строки. @@ -130,15 +128,16 @@ Control- перемещает курсор в начало и конец строки, а M-a и M-e перемещает курсор в начало и конец предложения. ->> Попробуйте нажать пару раз C-a, и потом пару раз C-e. Попробуйте пару +>> Попробуйте нажать пару раз C-a, и потом пару раз C-e. Попробуйте пару раз нажать M-a, после этого пару раз нажать M-e. Посмотрите, что повтор C-a ничего не изменяет, а повтор M-a продолжает движение курсора к следующему предложению. Это не сохраняет аналогию, но выглядит естественно. -Положение курсора в тексте также называют "точка". Скажем иначе: курсор -показывает место на экране в какой точке будет расположен вводимый текст. +Положение курсора в тексте также называют "точкой вставки". Скажем иначе: +курсор показывает место на экране в какой точке будет расположен вводимый +текст. Здесь собраны простые команды перемещения курсора, включая движение по словам и предложениям: @@ -166,22 +165,22 @@ Control- Greater-than {Больше-Чем}), которая перемещает курсор в конец текста. На большинстве терминалов знак "<" находится над знаком точки, и чтобы -набрать его вы должны использовать клавишу Shift. На этих терминалах вы так -же должны использовать Shift чтоб набрать M-<; Без удержания клавиши Shift -вы наберете M-точка. +набрать его, вы должны использовать клавишу Shift. На этих терминалах вы так +же должны использовать Shift, чтобы набрать M-< (без удержания клавиши Shift +вы наберете M-точка). ->> Сейчас попробуйте M-<, чтоб переместиться в начало учебника. Потом - используйте C-v чтоб вернуться назад. +>> Сейчас попробуйте M-<, чтобы переместиться в начало учебника. Потом + используйте C-v, чтобы вернуться назад. ->> Сейчас попробуйте M->, что переместиться к концу учебника. Используйте - M-v чтоб вернуться снова. +>> Сейчас попробуйте M->, чтобы переместиться к концу учебника. Используйте + M-v, чтобы вернуться снова. Курсор можно перемещать клавишами управления курсора (стрелками), если ваш терминал оборудован ими. Мы рекомендуем выучить C-b, C-f, C-n и C-p по трем -причинам. Во первых, они работают на любых терминалах. Во вторых, однажды +причинам. Во-первых, они работают на любых терминалах. Во-вторых, однажды получив практику использования Emacs, вы поймете, что использовать CTRL-символы удобнее и быстрее, чем кнопки со стрелочками (потому что вы не -убираете руки с обычного их положения при печати). В третьих, как только вы +убираете руки с обычного их положения при печати). В-третьих, как только вы привыкните использовать CTRL-символы, вы сможете так же легко выучить и использовать другие, расширенные команды перемещения курсора. @@ -192,7 +191,7 @@ CTRL- аргумент можно задать другим способом: наберите цифры, удерживая клавишу META. Мы рекомендуем освоить использование C-u, поскольку эта последовательность клавиш работает на любом терминале. Числовой аргумент -также называется "префиксным аргументом" поскольку вы набираете аргумент до +также называется "префиксным аргументом", поскольку вы набираете аргумент до выполнения команды. Например, C-u 8 C-f переместит курсор на восемь символов вперед. @@ -217,7 +216,7 @@ META. прокрутить его вниз, можете задать аргумент для M-v. Если вы используете оконную систему, такую как X11 или MS-Windows, должна -быть прямоугольная область именуемая полосой прокрутки с левой стороны окна +быть прямоугольная область, именуемая полосой прокрутки с левой стороны окна Emacs. Вы можете прокручивать текст, используя манипулятор мышь. >> Попробуйте перемещать мышь при нажатой средней кнопке мыши. Вы увидите @@ -232,7 +231,7 @@ Emacs. влево, вправо, вверх и вниз передвигают курсор в ожидаемом направлении; они работают точно также как C-b, C-f, C-p и C-n, но легче в наборе и запоминании. Вы так же можете использовать сочетания C-left и C-right для -передвижения по словам, и C-up и C-down для передвижения по блокам (т.е., +передвижения по словам, и C-up и C-down для передвижения по блокам (т.е. параграфам, если вы редактируете текст). Если у вас есть кнопки помеченные HOME (или BEGIN) или END, то они будут перемещать курсор в начало и конец строки, соответственно, и C-home и C-end будут перемещать в начало и конец @@ -249,14 +248,14 @@ CONTROL * ЕСЛИ EMACS ЗАВИС ------------------ -Если Emacs перестал реагировать на ваши команды, вы можете остановить это -просто нажав C-g. Вы можете использовать C-g чтобы остановить выполнение -команды которая слишком долго выполняется. +Если Emacs перестал реагировать на ваши команды, вы можете остановить это, +просто нажав C-g. Вы можете использовать C-g, чтобы остановить выполнение +команды, которая слишком долго выполняется. -Вы так же можете использовать C-g для отмены цифрового аргумента или начатой +Вы также можете использовать C-g для отмены цифрового аргумента или начатой команды, которую вы не хотите завершать. ->> Наберите C-u 100 для задания аргумента 100, потом нажмите C-g. Теперь +>> Наберите C-u 100 для задания аргумента 100, потом нажмите C-g. Теперь нажмите C-f. Курсор должен переместиться всего на один символ, потому что вы отменили аргумент нажатием C-g. @@ -264,7 +263,7 @@ CONTROL нажатием C-g. -* ЗАПРЕЩЕННЫЕ КОМАНДЫ (DISABLED COMMANDS) +* ЗАПРЕЩЕННЫЕ КОМАНДЫ (DISABLED COMMANDS) ----------------------------------------- Некоторые команды Emacs "запрещены", поскольку начинающие пользователи могут @@ -291,7 +290,7 @@ Emacs C-x 1 Одно окно. (закрыть все другие окна). -Это CONTROL-x со следующей цифрой 1. C-x 1 развернет окно которое содержит +Это CONTROL-x со следующей цифрой 1. C-x 1 развернет окно, которое содержит курсор, так, чтобы оно заняло весь экран. При этом будут удалены все остальные окна. @@ -301,7 +300,7 @@ Emacs Посмотрите, как текущее окно сожмется, когда новое появится и отобразит документацию на команду CONTROL-f. ->> Наберите C-x 1 и посмотрите как окно с документацией исчезнет. +>> Наберите C-x 1 и посмотрите, как окно с документацией исчезнет. Эта команда отличается от других команд, которые вы изучили, тем, что она состоит из двух символов. Она начинается со знака CONTROL-x. Есть целый @@ -326,7 +325,7 @@ Emacs курсора. >> Попробуйте выполнить это сейчас -- наберите несколько символов, потом - удалите их нажимая несколько раз. Не волнуйтесь о изменениях + удалите их нажимая несколько раз. Не волнуйтесь об изменениях этого файла; вы не изменяете главный учебник. Это ваша личная копия учебника. @@ -336,7 +335,7 @@ Emacs стрелка) с правой границы показывает, что строка будет продолжена. >> Вводите текст, пока не достигните правой границы, и продолжайте - вставку. Вы увидите, как появится символ продолжения строки. + вставку. Вы увидите, как появится символ продолжения строки. >> Используйте для удаления текста, пока строка не поместится в экран снова. Символ продолжения строки исчезнет. @@ -353,13 +352,13 @@ Emacs удаленного вами. Помните, что многие команды Emacs могут получать счетчик повторения; простые -символы не являются исключением. Набирайте простые символы вставляя их по +символы не являются исключением. Набирайте простые символы, вставляя их по несколько за один раз. >> Попробуйте выполнить это -- наберите C-u 8 * для вставки ********. Теперь вы научились основному способу набрать что-нибудь в Emacs и -исправлять ошибки. Так же вы можете удалять слова и строки. Здесь собраны +исправлять ошибки. Также вы можете удалять слова и строки. Здесь собраны операции удаления: удалить символ перед курсором @@ -371,8 +370,8 @@ Emacs C-k Убить все от курсора до конца строки M-k Убить все до конца предложения -Заметьте, что и C-d против M- и M-d расширяют параллель -начатую, C-f и M-f (да, это не реальный управляющий символ, но не +Заметьте, что и C-d против M- и M-d расширяют параллель, +начатую C-f и M-f (да, это не реальный управляющий символ, но не нужно волноваться об этом). C-k и M-k, как и C-e и M-e, проводят параллель между строками и предложениями. @@ -393,13 +392,13 @@ C-SPC ( Отличие между "убить (killing)" и "удалить (deleting)" заключается в том, что "убитый" текст может быть заново вставлен, в то время как "удаленные" части не могут быть вставлены. Вставка "убитого" текста называется -"восстановление (yanking)". В общем, команды, которые могут удалять большие -части текста, удаляют этот текст (они так настраиваются так, что вы можете -восстановить текст), в то время как команды, которые удаляют только один +"восстановление (yanking)". В общем, команды, которые могут убирать большие +части текста, убивают этот текст (они так настраиваются так, что вы можете +восстановить текст), в то время как команды, которые убирают только один символ, или только пустые строки и пробельные символы, выполняют удаление (так что вы не можете восстановить текст). ->> Переместите курсор на начало непустой строки. Теперь нажмите C-k чтобы +>> Переместите курсор на начало непустой строки. Теперь нажмите C-k, чтобы убить текст в этой строке. >> Нажмите C-k еще раз. Вы видите, что это убьет символ новой строки @@ -407,7 +406,7 @@ C-SPC ( Заметьте, что первое C-k убивает содержимое строки, а второе C-k убивает саму строку и поднимает другие строки вверх. C-k обрабатывает числовой -аргумент специальным образом: убивает много строк _И_ их содержимое. Это не +аргумент специальным образом: убивает столько строк _И_ их содержимое. Это не просто повторение. C-u 2 C-k удалит две строи и завершающие их символы новой строки; ввод C-k два раза не сделает этого. @@ -420,10 +419,10 @@ C-SPC ( Командой для восстановления текста является C-y. Она восстанавливает последний убитый текст в место расположение курсора. ->> Попробуйте выполнить это; наберите C-y чтоб вернуть текст назад. +>> Попробуйте выполнить это; наберите C-y, чтобы вернуть текст назад. Помните, если вы использовали несколько команд C-k в строке, все убитые -строки будут сохранены вместе, так, что C-y восстановит их вместе. +строки будут сохранены вместе так, что C-y восстановит их вместе. >> Попробуйте выполнить это сейчас, нажмите C-k несколько раз. @@ -434,8 +433,8 @@ C-SPC ( Что делать, если есть некоторый текст, который вы хотите вернуть назад и потом убить что-то еще? C-y вернет не более чем последний удаленный текст. -Но предыдущий текст не будет потерян. Вы сможете его вернуть назад используя -команду M-y. После того как вы вернули последний удаленный текст, нажмите +Но предыдущий текст не будет потерян. Вы сможете его вернуть назад, используя +команду M-y. После того, как вы вернули последний удаленный текст, нажмите M-y, и замените этот восстановленный текст тем, который был убит ранее. Нажатие M-y снова и снова будет возвращать ранее убитый текст. Когда вы достигните искомого текста, вам не нужно делать ничего более чтобы сохранить @@ -447,7 +446,7 @@ M-y, >> Убейте строку, переместите курсор вокруг этой точки, потом удалите еще одну строку. Затем используйте C-y для восстановления второй убитой - строки. Затем используйте M-y и она будет заменена первой убитой + строки. Затем используйте M-y, и она будет заменена первой убитой строкой. Нажмите M-y еще несколько раз, чтобы увидеть полученный результат. Продолжайте делать это, пока вторая убитая строка не вернется, и еще чуть-чуть. Если вам хочется, то вы можете задавать для M-y @@ -463,7 +462,7 @@ M-y, Обычно, C-x u отменяет изменения, сделанные одной командой; если повторить C-x u несколько раз подряд, каждый раз будет отменяться еще одна команда. -Но есть два исключения: команды которые не изменяют текст не учитываются +Но есть два исключения: команды, которые не изменяют текст, не учитываются (это включает команды перемещения курсора и прокрутки), и самовставляющиеся (self-inserting) символы обрабатываются группами до 20. (Это уменьшает число C-x u которые вы можете набрать для отмены ввода текста). @@ -472,14 +471,14 @@ C-x u вернуться назад. C-_ альтернативная команда отмены; она работает также как и C-x u, но легче -в использовании несколько раз подряд. Неудобное положение C-_ а на некоторых +в использовании несколько раз подряд. Неудобное положение C-_ на некоторых клавиатурах делает неочевидным способ ее набора. Поэтому мы предлагаем -использовать C-x u. На некоторых терминалах, вы можете набирать C-_ нажимая +использовать C-x u. На некоторых терминалах, вы можете набирать C-_, нажимая / и удерживая клавишу CONTROL. Числовой аргумент для C-_ или C-x u работает как счетчик повторения. -Вы можете отменить удаление текста точно также как отмену убития +Вы можете отменить удаление текста точно так же, как отмену убития текста. Отличие между убийством и удалением чего-либо заключается в том, что вы можете восстановить убитый текст с помощью C-y; но это не делает различий для отмены. @@ -488,27 +487,27 @@ C-_ ------- Чтобы созданный текст можно было редактировать позже, вы должны его -поместить в файл. Иначе, он исчезнет когда вы выйдите из Emacs. Вы помещаете -ваш текст в файл "открывая" файл. (Еще это называют "посетить" файл.) +поместить в файл. Иначе, он исчезнет, когда вы выйдите из Emacs. Вы помещаете +ваш текст в файл, "открывая" файл. (Еще это называют "посетить" файл.) -Открыть файл означает посмотреть его содержимое используя Emacs. Во многих -случаях, это происходит когда вы редактируете файл сами. Однако ваши +Открыть файл означает посмотреть его содержимое, используя Emacs. Во многих +случаях, это происходит, когда вы редактируете файл сами. Однако ваши изменения, сделанные с использованием Emacs не будут зафиксированы, пока вы не сохраните файл. Так вы можете не оставлять полуизмененный файл в системе, если вы не хотите этого. Даже когда вы сохраняете файл, Emacs оставляет -оригинальный файл с измененным именем, чтоб вы могли позже решить, что ваши +оригинальный файл с измененным именем, чтобы вы могли позже решить, что ваши изменения были ошибочны. Если вы посмотрите в нижнюю часть экрана, то вы увидите строку, которая начинается с тире и начинается с "--:-- TUTORIAL.ru" или чего-то -подобного. Эта часть экрана всегда показывает имя файла который вы -открыли. Итак, сейчас вы открыли файл с именем "TUTORIAL.ru" который -является вашей персональной копией учебника Emacs. Для любого файла который +подобного. Эта часть экрана всегда показывает имя файла, который вы +открыли. Итак, сейчас вы открыли файл с именем "TUTORIAL.ru", который +является вашей персональной копией учебника Emacs. Для любого файла, который вы откроете, имя этого файла появится в этом месте. -Одной из специальных вещей, которую вам нужно знать о команде открытия файла --- это то, что вы должны ввести имя файла, который нужно читать. Мы это -называем командой "читающая аргумент с терминала" (в этом случае, аргументом +Одной из специальных вещей, которую вам нужно знать о команде открытия файла, +это то, что вы должны ввести имя файла, который нужно читать. Мы это +называем командой, "читающей аргумент с терминала" (в этом случае, аргументом является имя файла). После ввода команды C-x C-f Открыть (найти) файл @@ -522,15 +521,15 @@ Emacs отменить команду нажав C-g. >> Нажмите C-x C-f, затем нажмите C-g. Это отменит мини-буфер, и команду - C-x C-f которая использовала мини-буфер. В итоге, вы не открыли ни одного + C-x C-f, которая использовала мини-буфер. В итоге, вы не открыли ни одного файла. Когда вы завершите ввод имени файла, нажмите . Далее сработает -команда C-x C-f, и откроет файл указанный вами. Мини-буфер исчезнет когда -команда C-x C-f завершится. +команда C-x C-f, которая откроет указанный вами файл. Мини-буфер исчезнет, +когда команда C-x C-f завершится. И мгновением позже содержимое файла появится на экране, и вы сможете его -редактировать. Когда вы закончите редактирование, чтобы сохранить изменения +редактировать. Когда вы закончите редактирование, чтобы сохранить изменения, наберите команду C-x C-s Сохранить файл @@ -541,18 +540,18 @@ Emacs имени файла. Когда сохранение завершится, Emacs напечатает имя записанного файла. Вы -должны сохранять изменения достаточно часто, так чтобы не потерять много -работы если вдруг система погибнет. +должны сохранять изменения достаточно часто, чтобы не потерять много +работы, если вдруг система зависнет. >> Наберите C-x C-s, сохраните вашу копию учебника. В нижней строке экрана должна появиться надпись "Wrote ...TUTORIAL.ru". ЗАМЕЧАНИЕ: На некоторых системах, ввод C-x C-s заблокирует экран и вы не -увидите последующего вывода Emacs`а. Это означает что операционная система -имеет "особенность" именуемую "flow control" перехватывающую C-s и не +увидите последующего вывода Emacs`а. Это означает, что операционная система +имеет "особенность", именуемую "flow control", перехватывающую C-s и не пропускающую этот символ к Emacs`у. Для разблокировки экрана, нажмите C-q. -Смотрите раздел "Spontaneous Entry to Incremental Search" руководства Emacs -чтобы узнать как бороться с этой "особенностью". +Смотрите раздел "Spontaneous Entry to Incremental Search" руководства Emacs, +чтобы узнать, как бороться с этой "особенностью". Вы можете открыть существующий файл для просмотра или редактирования. Вы также можете найти файл, которого еще не существует. Другими словами -- @@ -569,45 +568,45 @@ Emacs внутри Emacs. Вы можете переключиться назад, найдя его снова C-x C-f. Это способ загрузить несколько файлов в Emacs. ->> Создайте файл с именем "foo" набирая C-x C-f foo . - Вставьте какой-нибудь текст, отредактируйте его, и сохраните "foo" +>> Создайте файл с именем "foo", набирая C-x C-f foo . + Вставьте какой-нибудь текст, отредактируйте его, и сохраните "foo", набрав C-x C-s. - Наконец, наберите C-x C-f TUTORIAL.ru + Наконец, наберите C-x C-f TUTORIAL.ru , чтобы вернуться назад к учебнику. -Emacs сохраняет текст каждого файла внутри в объекте называемый "буфер" -("buffer"). Открытие файла создает новый буфер внутри Emacs. чтобы увидеть -список буферов созданных в текущем Emacs наберите +Emacs сохраняет текст каждого файла внутри в объекте, называемом "буфер" +("buffer"). Открытие файла создает новый буфер внутри Emacs. Чтобы увидеть +список буферов, созданных в текущем Emacs, наберите C-x C-b Список буферов >> Попробуйте C-x C-b сейчас. -Мы видим что каждый буфер имеет имя, и может иметь имя файла, содержимое +Мы видим, что каждый буфер имеет имя, и может иметь имя файла, содержимое которого в нем хранится. Некоторые буфера не соответствуют файлам. Например, -буфер названный "*Buffer List*" не содержит никакого файла. В этом буфере -содержится список буферов, который был создан командой C-x C-b. ЛЮБОЙ текст -который ви видите в окне Emacs всегда является частью какого-либо буфера. +буфер, названный "*Buffer List*", не содержит никакого файла. В этом буфере +содержится список буферов, который был создан командой C-x C-b. ЛЮБОЙ текст, +который вы видите в окне Emacs, всегда является частью какого-либо буфера. ->> Наберите C-x 1 чтобы избавиться от списка буферов. +>> Наберите C-x 1, чтобы избавиться от списка буферов. Если вы изменяете текст одного файла, потом открываете другой, то первый -остается не сохраненным. Изменения останутся внутри Emacs, в файловом -буфере. Создание или редактирование следующего файлового буфера не +остается несохраненным. Изменения останутся внутри Emacs, в файловом +буфере. Создание или редактирование следующего файлового буфера не сказывается на первом буфере. Это очень удобно, но имейте в виду, что вам нужно иметь удобный способ сохранить первый файловый буфер. Было бы неприятно каждый раз возвращаться назад с помощью C-x C-f и потом -использовать C-x C-s. Поэтому существует команда +использовать C-x C-s. Поэтому существует команда C-x s Сохранить некоторые буфера. (Save some buffers) -C-x s спрашивает вас о каждом буфере, который содержит не сохраненные -изменения. Для каждого такого буфера у вас спрашивают сохранять или не +C-x s спрашивает вас о каждом буфере, который содержит несохраненные +изменения. Для каждого такого буфера у вас спрашивают: сохранять или не сохранять изменения. >> Вставьте строку текста, потом наберите C-x s. - У вас должны спросить сохранять ли буфер с именем TUTORIAL.ru. - Ответьте на вопрос да набрав "y". + У вас должны спросить, сохранять ли буфер с именем TUTORIAL.ru. + Ответьте на вопрос да, набрав "y". * РАСШИРЕННЫЙ НАБОР КОМАНД @@ -624,28 +623,28 @@ C-x s Это команды, которые обычно используются, но вы уже выучили некоторые из них. Вы уже видели: команды работы с файлами C-x C-f -- открыть, и C-x C-s --- сохранить. Другой пример - завершения работы с Emacs -- это команда C-x +-- сохранить. Другой пример - завершения работы с Emacs -- это команда C-x C-c. (Не волнуйтесь о том, что вы потеряете сделанные изменения, C-x C-c -предлагает сохранить изменения перед тем как удалит буфер Emacs.) +предлагает сохранить изменения перед тем, как удалит буфер Emacs.) -C-z это команда *временного* выхода из Emacs -- вы можете вернуться в туже -сессию Emacs после. +C-z это команда *временного* выхода из Emacs -- вы можете вернуться в ту же +сессию Emacs позже. -На системах, которые допускают этого, C-z "приостанавливают" ("suspends") -Emacs; Возвращают в оболочку (shell), но не закрывают Emacs. В большинстве -оболочек вы можете продолжить работу в Emacs используя команду `fg' или +На системах, которые допускают это, C-z "приостанавливают" ("suspends") +Emacs; возвращают в оболочку (shell), но не закрывают Emacs. В большинстве +оболочек вы можете продолжить работу в Emacs, используя команду `fg' или `%emacs'. -В системах не поддерживающих приостановку процессов, C-z создает новую +В системах, не поддерживающих приостановку процессов, C-z создает новую оболочку (subshell), запущенную из-под Emacs, чтобы дать вам возможность -выполнить другую программу, и потом вернуться в Emacs; Это не настоящий +выполнить другую программу, и потом вернуться в Emacs; это не настоящий выход из Emacs. В этом случае, команда `exit' вернет вас в Emacs из оболочки. -Используйте C-x C-c если вы хотите выйти (log out) из системы. Это также -используется чтобы выйти из Emacs вызванного из почтовой программы, или другой -утилиты, которая может не знает как справиться с приостановленным Emacs. -Обычно, если вы не выходите из системы, лучше приостановить Emacs +Используйте C-x C-c, если вы хотите выйти (log out) из системы. Это также +используется, чтобы выйти из Emacs, вызванного из почтовой программы, или другой +утилиты, которая может не знать, как справиться с приостановленным Emacs. +Обычно, если вы не выходите из системы, лучше приостановить Emacs, используя C-z вместо выхода их него. Существует очень много C-x команд. Эти вы уже выучили: @@ -661,18 +660,18 @@ Emacs; только в определенных режимах. В качестве примера команда замена строки, которая заменяет одну строку на другую во всем тексте. Когда вы наберете M-x, Emacs предложит вам ввести имя команды в нижней строке экрана; в нашем -случае, "replace-string". Только наберите "repl s" и Emacs дополнит +случае, "replace-string". Только наберите "repl s", и Emacs дополнит имя. ( -- это клавиша табуляции, обычно находящаяся выше клавиш CapsLock или Shift слева на клавиатуре). Завершите имя вводом . -Команда замены строки (replace-string) требует два аргумента -- строку -которая будет заменена, и строка на которую нужно заменить. Вы должны +Команда замены строки (replace-string) требует два аргумента -- строку, +которая будет заменена, и строку, на которую нужно заменить. Вы должны завершать каждый аргумент вводом . >> Переместите курсор на две пустые строки ниже этой. Наберите M-x repl schangedaltered. - Заметьте как эта строка изменится: вы замените слово c-h-a-n-g-e-d + Заметьте, как эта строка изменится: вы замените слово c-h-a-n-g-e-d словом "altered" везде, где оно встретится, ниже позиции курсора. @@ -680,40 +679,40 @@ CapsLock ---------------- Когда вы изменяете файл, но не сохраняете его, то в случае краха системы -вы можете потерять информацию. чтобы защитить вас от этого, Emacs +вы можете потерять информацию. Чтобы защитить вас от этого, Emacs периодически сохраняет каждый файл, который вы редактируете. Автосохранение происходит в файл, имя которого такое же, но начинается и заканчивается символом "#"; например, если ваш файл называется "hello.c", то автосохраненный файл будет называться "#hello.c#". Когда вы сохраните файл -обычным способом. Emacs удалит автосохраненный файл. +обычным способом, Emacs удалит автосохраненный файл. -Если система подвисает, вы можете восстановить ваши изменения который были -сохранены автоматически, путем открытия нормального файла (файла который вы -редактировали, не автосохраненного) и затем набрав M-x recover-file. -Когда у вас спросят подтверждение, наберите yes чтобы восстановить +Если система зависла, вы можете восстановить ваши изменения, который были +сохранены автоматически, путем открытия нормального файла (файла, который вы +редактировали, не автосохраненного), и затем набрав M-x recover-file. +Когда у вас спросят подтверждение, наберите yes, чтобы восстановить автосохраненные данные. * ОБЛАСТЬ ЭХО (ECHO AREA) ------------------------- -Если Emacs видит что вы медленно набираете команды, он показывает их вам +Если Emacs видит, что вы медленно набираете команды, он показывает их вам внизу экрана, в области называемой "область эхо". Область эхо -- это самая нижняя строка экрана. * СТРОКА РЕЖИМА ------------------- +--------------- Строка сразу над областью эхо называется "строка состояния". Выглядит эта строка примерно так: ---:** TUTORIAL (Fundamental)--L670--58%---------------- +--:** TUTORIAL.ru (Fundamental)--L670--58%---------------- Эта строка сообщает полезную информацию о состоянии Emacs и текста, который вы редактируете. -Вы уже знаете что означает имя файла -- это файл, который вы открыли. -NN%-- +Вы уже знаете, что означает имя файла -- это файл, который вы открыли. -NN%-- показывает текущую позицию курсора в тексте; это означает что NN процентов текста выше, чем начало экрана. Если первая строка находится в первой строке экрана, вы там увидите --Top-- вместо --00%--. Если на экране отображается @@ -744,13 +743,13 @@ Emacs его. Например, M-x fundamental-mode - команда, которая переключает в базовый (Fundamental) режим. -Если вы редактируете английский текст, например как этот (//конечно не именно +Если вы редактируете русский текст, например как этот (конечно, не именно этот, а TUTORIAL) файл, вы вероятно должны переключиться в Text-режим. >> Наберите M-x text mode. Не волнуйтесь, ни одна из выученных вами команд Emacs не изменилась. Но вы -можите заметить, что M-f и M-b теперь различать апострофы как части слова. +можете заметить, что M-f и M-b теперь различают апострофы как части слова. Ранее, в базовом режиме (Fundamental mode), M-f и M-b понимали апострофы как разделители слов. @@ -762,8 +761,8 @@ Emacs >> Используйте C-u C-v один раз или более, чтобы расположить эту строку ближе к верху экрана. ->> Наберите C-h m, что посмотреть отличия Text-режима от базового. ->> Наберите C-x 1 чтобы убрать документацию с глаз долой :) +>> Наберите C-h m, чтобы посмотреть отличия Text-режима от базового. +>> Наберите C-x 1, чтобы убрать документацию с глаз долой :) Основной режим называется основным потому, что есть несколько дополнительных (minor) режимов. Дополнительные режимы не являются альтернативами основным, @@ -777,13 +776,13 @@ Emacs включен, Emacs разрывает строки между словами автоматически, когда вы вставляете текст и делаете строки слишком длинными. -Вы можете включить режим автозаполнения набрав M-x auto fill mode. +Вы можете включить режим автозаполнения, набрав M-x auto fill mode. Когда этот режим включен, его можно выключить - M-x auto fill mode. Если режим включен -- команда его выключит, если выключен -- включит. Мы называем это командой "переключения режима". >> Наберите M-x auto fill mode. Затем вводите строку из слов - "фыва " пока не увидите как она разделится на две строки. Вы должны + "фыва " пока не увидите, как она разделится на две строки. Вы должны помещать пробелы между словами, потому что режим автозаполнения разделяет строки только по пробелам. @@ -806,22 +805,22 @@ Emacs * ПОИСК ------- -Emacs умеет искать строки (это непрерывные группы символов или слова) вперед -по тексту, или назад. Поиск строки это команда перемещения курсора; она +Emacs умеет искать строки (непрерывные группы символов или слова) вперед +по тексту, или назад. Поиск строки - это команда перемещения курсора; она перемещает курсор в следующую точку, где найдена искомая строка. Команда поиска Emacs отличаются от аналогичных команд большинства других -редакторов тем, что она инкрементальная. Это означает что поиск происходит по -мере того как вы набираете искомую строку. +редакторов тем, что она инкрементальная. Это означает, что поиск происходит +по мере, того как вы набираете искомую строку. Команда, начинающая поиск вперед -- C-s, а C-r ищет назад. ПОДОЖДИТЕ! Не нужно пробовать прямо сейчас. -Когда вы нажмете C-s вы увидите строку "I-search", появившуюся в области эхо. -Вам сообщается что Emacs ждет ввода слова, которое вы хотите найти. +Когда вы нажмете C-s, вы увидите строку "I-search", появившуюся в области эхо. +Вам сообщается, что Emacs ждет ввода слова, которое вы хотите найти. завершает поиск. ->> Теперь, нажмите C-s для начала поиска. Медленно, одну букву за один раз, +>> Теперь нажмите C-s для начала поиска. Медленно, одну букву за один раз, набирайте слово 'курсор', останавливаясь после каждой введенной буквы и замечая что происходит с курсором. Сейчас вы нашли первое вхождение слова "курсор". @@ -829,38 +828,38 @@ Emacs >> Теперь нажмите четыре раза и проследите за перемещениями курсора. >> Нажмите для завершения поиска. -Вы видели что происходило? Emacs, в режиме инкрементального поиска, пытался -переходить к строкам совпадающим с набираемой вами, подсвечивая их для вас. +Вы видели, что происходило? Emacs в режиме инкрементального поиска пытался +переходить к строкам, совпадающим с набираемой вами, подсвечивая их для вас. Чтобы перейти к следующему вхождения слова 'курсор' просто нажмите C-s -снова. Если больше нет вхождений, Emacs издаст звуковой сигнал, и сообщит -что ваш поиск не удался ("failing"), C-g также должен отменить поиск. +снова. Если больше нет вхождений, Emacs издаст звуковой сигнал, и сообщит, +что ваш поиск не удался ("failing"), C-g также может отменить поиск. -ЗАМЕЧАНИЕ: На некоторых системах, ввод C-s заморозит экран и вы не увидите -последующего вывода Emacs`а. Это означает что операционная система имеет -"особенность" именуемую "flow control" перехватывающую C-s и не пропускающую -этот символ к Emacs`у. Для разморозки экрана, нажмите C-q. Смотрите раздел -"Spontaneous Entry to Incremental Search" руководства Emacs чтобы узнать как -бороться с этой "особенностью". +ЗАМЕЧАНИЕ: На некоторых системах ввод C-s заморозит экран, и вы не увидите +последующего вывода Emacs`а. Это означает, что операционная система имеет +"особенность", именуемую "flow control", перехватывающую C-s и не пропускающую +этот символ к Emacs`у. Для разморозки экрана, нажмите C-q. Смотрите раздел +"Spontaneous Entry to Incremental Search" руководства Emacs, чтобы узнать, +как бороться с этой "особенностью". -Если вы во время инкрементального поиска нажмете , вы можете заметить +Если вы во время инкрементального поиска нажмете , вы можете заметить, что последний символ в искомой строке удалился, и поиск вернулся к предыдущему -найденному месту. Например, предположим, что вы набрали "c", поиск перейдет к -первому вхождению символа "c". Теперь если вы наберете "u", курсор перейдет к -первому вхождению "cu". Нажатие удалит символ "u" их строки поиска, и -курсор вернется к первому вхождению "c". +найденному месту. Например, предположим, что вы набрали "к", поиск перейдет к +первому вхождению символа "к". Теперь, если вы наберете "у", курсор перейдет к +первому вхождению "ку". Нажатие удалит символ "у" из строки поиска, и +курсор вернется к первому вхождению "к". Если вы во время поиска введете control- или meta- символ (за некоторыми исключениями -- символы вызывающие поиск, а именно C-s и C-r), поиск прекратится. C-s начинает поиск и смотрит на любые вхождения искомой строки ПОСЛЕ текущей -позиции курсора. Если вы хотите найти что-то ранее в тексте, нажмите C-r. Все -что мы говорили о C-s применимо и к C-r, за исключением противоположного +позиции курсора. Если вы хотите найти что-то ранее в тексте, нажмите C-r. +Все, что мы говорили о C-s, применимо и к C-r, за исключением противоположного направления поиска. * МНОЖЕСТВО ОКОН (MULTIPLE WINDOWS) -------------------------------- +----------------------------------- Одна из приятных особенностей Emacs это то, что вы можете одновременно отображать на экране более чем одно окно. @@ -868,7 +867,7 @@ C-s >> Переместите курсор на эту линию, и наберите C-u 0 C-l (это CONTROL-L, а не CONTROL-1). ->> Теперь, наберите C-x 2, что разделит экран на два окна. +>> Теперь наберите C-x 2, что разделит экран на два окна. Оба окна отображают учебник. Курсор остался в верхнем окне. >> Нажмите C-M-v для прокрутки нижнего окна. @@ -876,10 +875,10 @@ C-s >> Нажмите C-x o ("o" от слова "other" - другое) для перемещения курсора в нижнее окно. ->> Используйте C-v и M-v в нижнем окне что прокручивать его. +>> Используйте C-v и M-v в нижнем окне, чтобы прокручивать его. Продолжите чтение этих инструкций в верхнем окне. ->> Нажмите C-x o снова чтобы переместить курсор назад в верхнее окно. +>> Нажмите C-x o снова, чтобы переместить курсор назад в верхнее окно. Курсор в верхнем окне там же, где и был до того. Вы можете продолжать переключаться между окнами, используя C-x o. Каждое @@ -892,9 +891,9 @@ C-s в окне редактирования и последовательно продвигаться во втором, используя C-M-v. -C-M-v пример CONTROL-META символа. Если у вас есть настоящая кнопка META -(Alt), то вы можете набрать C-M-v нажав одновременно CONTROL и META и не -отпуская их нажать v. И не важно какая из клавиш будет нажата первой, +C-M-v - пример CONTROL-META символа. Если у вас есть настоящая кнопка META +(Alt), то вы можете набрать C-M-v, нажав одновременно CONTROL и META и, +не отпуская их, нажать v. И не важно, какая из клавиш будет нажата первой, CONTROL или META, поскольку эти кнопки модифицируют тип символа. Если у вас нет настоящей кнопки META, и вы используете ESC вместо нее, @@ -902,43 +901,43 @@ CONTROL CONTROL-ESC v не будет работать. Потому, что ESC имеет свой собственный символ -- это не модифицирующая кнопка. ->> Нажмите C-x 1 (в верхнем окне) чтобы избавиться от нижнего. +>> Нажмите C-x 1 (в верхнем окне), чтобы избавиться от нижнего. (Если вы нажали C-x 1 в нижнем окне, то вы избавились от верхнего. Понимайте -эту команду как "Оставить только одно окно, то в котором я сейчас нахожусь"). +эту команду как "Оставить только одно окно, то, в котором я сейчас нахожусь"). -Вам не нужно отображать один и тот же буфер в обоих окнах. Если вы используете -C-x C-f чтобы открыть файл в одном окне, другое останется без изменения. Вы -можете открывать файлы в каждом окне независимо. +Вам не нужно отображать один и тот же буфер в обоих окнах. Если вы +используете C-x C-f, чтобы открыть файл в одном окне, другое останется без +изменения. Вы можете открывать файлы в каждом окне независимо. -Есть другой путь использовать два окна отображающих разные файлы: +Есть другой путь использовать два окна, отображающих разные файлы: ->> Наберите C-x 4 C-f затем имя одного и ваших файлов. Завершите . - Посмотрите что выбранный файл появился в нижнем окне. Курсор перешел +>> Наберите C-x 4 C-f, затем имя одного и ваших файлов. Завершите . + Посмотрите, что выбранный файл появился в нижнем окне. Курсор перешел туда же. ->> Наберите C-x o чтобы вернуться в верхнее окно, и C-x 1 чтобы удалить нижнее - окно. +>> Наберите C-x o, чтобы вернуться в верхнее окно, и C-x 1, чтобы удалить + нижнее окно. * РЕКУРСИВНЫЕ УРОВНИ РЕДАКТИРОВАНИЯ (RECURSIVE EDITING LEVELS) -------------------------------------------------------------- Иногда вы будете включать так называемые "рекурсивные уровни -редактирования". На это указывают прямоугольные скобки в строке -состояния, окружающие обычные скобки вокруг имени основного режима. Например -вы можете увидеть [(Fundamental)] вместо (Fundamental). +редактирования". На это указывают прямоугольные скобки в строке состояния, +окружающие обычные скобки вокруг имени основного режима. Например, вы можете +увидеть [(Fundamental)] вместо (Fundamental). -Чтобы выйти из рекурсивных уровней редактирования, нажмите ESC ESC ESC. Это -многоцелевая команда "выход". Вы так же можете использовать ее как для +Чтобы выйти из рекурсивных уровней редактирования, нажмите ESC ESC ESC. Это +многоцелевая команда "выход". Вы также можете использовать ее как для уничтожения лишних окон, так и для выхода из мини-буфера. ->> Нажмите M-x чтобы попасть в мини-буфер; затем нажмите ESC ESC ESC чтобы - покинуть его. +>> Нажмите M-x, чтобы попасть в мини-буфер; затем нажмите ESC ESC ESC, + чтобы покинуть его. -Вы не можете использовать C-g чтобы выйти из рекурсивных уровней -редактирования. Потому, что C-g используется для отмены команды и аргументов -БЕЗ рекурсивных уровней редактирования. +Вы не можете использовать C-g, чтобы выйти из рекурсивных уровней +редактирования. Потому, что C-g используется для отмены команды и +аргументов БЕЗ рекурсивных уровней редактирования. * КАК ПОЛУЧИТЬ ПОМОЩЬ (GETTING MORE HELP) @@ -953,10 +952,10 @@ C-x C-f помощи". Чтобы использовать особенности Помощи, нажмите C-h, и затем символ, который -расскажет какой именно вид помощи вы хотите получить. Если вы ДЕЙСТВИТЕЛЬНО -растерялись, наберите C-h ? и Emacs расскажет вам какую помощь он может вам +расскажет, какой именно вид помощи вы хотите получить. Если вы ДЕЙСТВИТЕЛЬНО +растерялись, наберите C-h ?, и Emacs расскажет вам какую помощь он может вам предоставить. Если вы нажали C-h и передумали обращаться к помощи, просто -нажмите C-g чтобы отменить эту команду. +нажмите C-g, чтобы отменить эту команду. (Кое-где переназначают символ C-h. Реальной необходимости в этом нет, сообщите о ней системному администратору. Тем временем, если C-h не вызывает @@ -971,35 +970,35 @@ C-x C-f Сообщение должно выглядеть примерно так C-p runs the command previous-line - (C-p выполняет команду previous-line {предыдущая-линия}) + (C-p выполняет команду previous-line {предыдущая-строка}) -Вам сообщают "имя функции". Имена функции используются в основном для -настройки и расширения Emacs. Имена функций выбраны так, чтобы показать что -именно команда делает, так же они позволяют с помощью этой краткой +Вам сообщают "имя функции". Имена функций используются в основном для +настройки и расширения Emacs. Имена функций выбраны так, чтобы показать, +что именно команда делает, также они позволяют с помощью этой краткой информации легче запомнить уже выученные команды. Многосимвольные команды, такие как C-x C-s и (если у вас нет кнопки META или -EDIT или ALT) v так же будут доступны после C-h c. +EDIT или ALT) v также будут доступны после C-h c. Получите больше информации о команде используя C-h k вместо C-h c. >> Наберите C-h k C-p. Вы увидите описание функции, а также ее имя в отдельном окне Emacs. Когда вы -завершите чтение, нажмите C-x 1 чтобы избавиться от текста помощи. Вы +завершите чтение, нажмите C-x 1, чтобы избавиться от текста помощи. Вы можете выполнить какое-то редактирование во время просмотра текста справки, -а только затем нажать C-x 1 +а только затем нажать C-x 1. Есть еще несколько полезных опций C-h: - C-h f Описывает функцию. Вам необходимо набрать имя функции. + C-h f Описывает функцию. Вам необходимо набрать имя функции. >> Попробуйте набрать C-h f previous-line. Это распечатает информацию Emacs о этой функции, которая выполняется командой C-p. Аналогичная команда C-h v отображает документацию о переменных, значение -которых вы можете изменить для настройки поведения Emacs. Вым нужно набрать +которых вы можете изменить для настройки поведения Emacs. Вам нужно набрать имя переменной, когда Emacs запросит его. C-h a Hyper Apropos. Введите ключевое слово и Emacs покажет вам @@ -1009,14 +1008,14 @@ EDIT >> Наберите C-h a file. -это отобразит полный список функций и переменных имена которых начинаются с -"newline". Нажмите или кликните средней кнопкой мышки чтобы -получить больше о функции или переменной. Нажмите `q' чтобы выйти из -hyper-apropos. +это отобразит полный список функций и переменных, имена которых начинаются +с "newline". Нажмите или кликните средней кнопкой мышки, чтобы +получить больше информации о функции или переменной. Нажмите `q', чтобы +выйти из hyper-apropos. Это отобразит в другом окне список всех команд M-x со словом "file" в их -именах. Также в списке, кроме команд, таких как find-file, вы увидите -соответствующие символьные команды, такие как C-x C-f. +именах. Также в списке кроме команд таких, как find-file, вы увидите +соответствующие символьные команды такие, как C-x C-f. >> Наберите C-M-v для прокрутки окна справки. Выполните это несколько раз. @@ -1024,29 +1023,28 @@ hyper-apropos. C-h i Читать интерактивные руководства (a.k.a. Info). Эта команда переходит в специальный буфер с именем `*info*', где вы - можете читать интерактивные руководства для пакетов + можете читать интерактивные руководства для пакетов, установленных в вашей системе. Наберите m emacs для чтения руководства по Emacs. Если вы никогда ранее не использовали Info, то наберите ? и Emacs откроет учебник по возможностям режима Info. Однажды ознакомившись с этим учебником, вы должны использовать руководство Emacs Info в - качетсве основной документации. - + качестве основной документации. * ЗАКЛЮЧЕНИЕ ------------ -Запомните, что чтобы выйти из Emacs насовсем используется сочетание C-x -C-c. А чтобы временно выйти в оболочку (shell) и потом вернуться обратно, -используйте C-z. +Запомните, чтобы совсем выйти из Emacs, используется сочетание клавиш +C-x C-c. А чтобы временно выйти в оболочку (shell) и потом вернуться +обратно, используйте C-z. -Этот учебник должен быть понятен всем новым пользователям, если вы найдете -что-нибудь неясное, не нужно сидеть и порицать себя -- жалуйтесь! +Этот учебник должен быть понятен всем новым пользователям, но если вы +найдете что-нибудь неясное, не нужно сидеть и порицать себя -- жалуйтесь! * COPYING -------- +--------- Этот учебник произошел из длинной серии учебников Emacs, начатой с однажды написанного by Stuart Cracraft для оригинального Emacs. @@ -1071,12 +1069,17 @@ Copyright (c) 1985, 1996 Free Software Foundation Условия копирования самого Emacs более сложные, но в том же духе. Пожалуйста, прочтите файл COPYING и затем дайте копию GNU Emacs вашим друзьям. Помогите уничтожить обструкционизм в области программного -обеспечения ("владение") используя, создавая и распространяя свободное +обеспечения ("владение"), используя, создавая и распространяя свободное программное обеспечение! -// замечания, исправления ошибок с нетерпением жду по адресу ottalex@beep.ru +// замечания, исправления ошибок с нетерпением жду по адресу ottalex@narod.ru // Alex Ott. // Большое спасибо Владимиру Бормотову, на базе перевода которого был сделан // этот перевод +;;; Local Variables: +;;; coding: cyrillic-koi8 +;;; sentence-end-double-space: nil +;;; End: + ;;; arch-tag: ad4e5698-ea8b-45b7-b236-ed5ad5b72d2b diff --git a/etc/TUTORIAL.sl b/etc/TUTORIAL.sl index ea901564a79..263019643db 100644 --- a/etc/TUTORIAL.sl +++ b/etc/TUTORIAL.sl @@ -1134,6 +1134,7 @@ pi ;;; Local Variables: ;;; coding: iso-latin-2 +;;; sentence-end-double-space: nil ;;; End: ;;; arch-tag: 985059e4-44c6-4ac9-b627-46c8db57acf6 diff --git a/etc/TUTORIAL.sv b/etc/TUTORIAL.sv index f4dcc842e5d..65d1548c378 100644 --- a/etc/TUTORIAL.sv +++ b/etc/TUTORIAL.sv @@ -1089,4 +1089,9 @@ same spirit. Please read the file COPYING and then do give copies of GNU Emacs to your friends. Help stamp out software obstructionism ("ownership") by using, writing, and sharing free software! +;;; Local Variables: +;;; coding: latin-1 +;;; sentence-end-double-space: nil +;;; End: + ;;; arch-tag: b352f774-622b-4cc6-85ce-43e3baf4fc1b diff --git a/etc/TUTORIAL.th b/etc/TUTORIAL.th index a5852296323..f3708c9d60f 100644 --- a/etc/TUTORIAL.th +++ b/etc/TUTORIAL.th @@ -1005,4 +1005,8 @@ virach@nectec.or.th Translate - January 1999 by Virach Sornlertlamvanich +;;; Local Variables: +;;; sentence-end-double-space: nil +;;; End: + ;;; arch-tag: 79ad252a-448a-4dc9-a4cb-2097dd1ec014 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c4fd4341c89..16de868d006 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,91 @@ +2004-04-18 Nick Roberts + + * progmodes/gdb-ui.el (gdb-goto-info): Require 'info. + (gdb-info-breakpoints-custom): Revert previous change. + (gdb-view-assembler): Update assembler if necessary. + (gdb-frame-handler): Parse correctly for gdb-current-frame. + (gdb-display-source-buffer): Update properly when both source and + assembler are visible. + +2004-04-17 John Wiegley + + * iswitchb.el (iswitchb-max-to-show): Added a new config variable + which limits the number of names shown in the minibuffer. Off by + default. + (iswitchb-completions): Use `iswitchb-max-to-show'. This speeds + up iswitchb for users with a multitude of open buffers by showing + only the first and last N/2 buffers in the completion list (which + is enough to aid C-s/C-r, and to know that more characters are + needed to refine the completion list). + +2004-04-17 Richard M. Stallman + + * files.el (locate-file-completion): Handle nil in path-and-suffixes. + (file-truename): Expand all ~ constructs directly. + (insert-directory): Delete any error msg output by the + `insert-directory-program'. + + * allout.el (allout-mode-exposure-menu, allout-mode-editing-menu): + (allout-mode-navigation-menu, allout-mode-misc-menu): New defvars. + (allout-prior-bindings, allout-added-bindings): Defvars deleted. + (allout-init): Use find-file-hook, not find-file-hooks. + (allout-mode): Eliminate Emacs 18 support. + Use write-contents-functions, not local-write-file-hooks. + +2004-04-17 Daniel Pfeiffer + + * progmodes/compile.el (compilation-error-properties): Fix for + adding messages when there are already markers for their file. + (compilation-fake-loc): New function. + +2004-04-16 Dave Love + + * progmodes/python.el (python-compilation-line-number): Fix braindamage. + (python-load-file): Fix python-orig-start setting. + + * progmodes/compile.el: Doc fixes. + (compilation-error-regexp-alist-alist) + (compilation-mode-font-lock-keywords): Allow non-ASCII where possible. + (compilation-assq): Wrap in eval-when-compile. + (compilation-mode-font-lock-keywords): Don't use list*. + (compilation-start): Avoid warning. + (compilation-compat-error-properties) + (compilation-directory-properties): Add keymap property. + (compilation-parsing-end): Make it a marker for better compatibility. + + * progmodes/python.el (python-after-info-look): Use with-no-warnings. + +2004-04-16 Mark A. Hershberger + + * xml.el: Doc fixes. + (xml-get-children): Only looks at sub-tags and ignore strings. + + * xml.el (xml-parse-tag): Avoid overwriting node-name. + +2004-04-16 Stefan Monnier + + * url/url-util.el (url-debug): Use with-current-buffer. + + * url/url-nfs.el (url-nfs-file-attributes): Add id-format parameter. + (url-nfs-create-wrapper): Use new backquote syntax. + + * url/url-https.el (url-https-file-attributes): Add id-format param. + + * url/url-http.el (url-http-head-file-attributes) + (url-http-file-attributes): Add id-format parameter. + + * url/url-handlers.el: Use new find-file-hook. + (url-file-attributes): Add id-format parameter. + + * url/url-file.el (url-file-create-wrapper): Use new backquote syntax. + (url-file-file-attributes): Add id-format parameter. + + * url/url-dav.el: Use with-current-buffer. + (url-dav-process-response): Fix regexps and spurious quote. + (url-dav-file-attributes): Add id-format param. + + * diff-mode.el (diff-end-of-hunk): Be more careful with unified hunks. + 2004-04-16 Andre Spiegel * vc-hooks.el (vc-default-workfile-unchanged-p): Quote signal. @@ -9,8 +97,7 @@ * simple.el (completion-setup-function): Set an initial value to `element-common-end' before entering loop. Set a value to `element-common-end' at the end of loop. - The bug is reported by Juri Linkov in emacs-devel - list. + The bug is reported by Juri Linkov in emacs-devel list. (completions-common-part): Rename from completion-de-emphasis. (completions-first-difference): Rename from completion-emphasis. Suggested by RMS. @@ -20,6 +107,12 @@ * bookmark.el (bookmark-send-edited-annotation): Fix docstring. (bookmark-edit-annotation-mode): Add mode name. +2004-04-15 Stefan Monnier + + * smerge-mode.el (smerge-match-conflict): Try to do something sensible + for nested conflict markers. + (smerge-find-conflict): Better handle errors in smerge-match-conflict. + 2004-04-15 Nick Roberts * progmodes/gdb-ui.el (gdb-goto-info): New function. @@ -119,7 +212,7 @@ in addition it also disables menu-bar, tool-bar, scroll-bars, tool-tips, and the blinking cursor. (command-line-1): Skip startup screen if -Q. - (fancy-splash-head): Use :align-to center prop to center splash image. + (fancy-splash-head): Use ":align-to center" prop to center splash image. * emulation/cua-base.el (cua-read-only-cursor-color) (cua-overwrite-cursor-color, cua-global-mark-cursor-color): Doc fix. @@ -154,6 +247,10 @@ * progmodes/python.el (run-python): Use compilation-shell-minor-mode. Set compilation-error-regexp-alist earlier. + * progmodes/compile.el (compilation-minor-mode-map) + (compilation-shell-minor-mode-map, compile-mouse-goto-error) + (compile-goto-error): Re-merge the mouse and non-mouse commands. + 2004-04-12 Stefan Monnier * progmodes/compile.el (compile-goto-error): Select the buffer/window diff --git a/lisp/allout.el b/lisp/allout.el index 04dcf88e91c..458db865535 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -83,7 +83,7 @@ dictated by `allout-layout' should be imposed on mode activation. With value t, auto-mode-activation and auto-layout are enabled. \(This also depends on `allout-find-file-hook' being installed in -`find-file-hooks', which is also done by `allout-init'.) +`find-file-hook', which is also done by `allout-init'.) With value `ask', auto-mode-activation is enabled, and endorsement for performing auto-layout is asked of the user each time. @@ -726,17 +726,12 @@ See doc string for allout-keybindings-list for format of binding list." (car (cdr cell))))))) keymap-list) map)) -;;;_ = allout-prior-bindings - being deprecated. -(defvar allout-prior-bindings nil - "Variable for use in V18, with `allout-added-bindings', for -resurrecting, on mode deactivation, bindings that existed before -activation. Being deprecated.") -;;;_ = allout-added-bindings - being deprecated -(defvar allout-added-bindings nil - "Variable for use in V18, with `allout-prior-bindings', for -resurrecting, on mode deactivation, bindings that existed before -activation. Being deprecated.") + ;;;_ : Menu bar +(defvar allout-mode-exposure-menu) +(defvar allout-mode-editing-menu) +(defvar allout-mode-navigation-menu) +(defvar allout-mode-misc-menu) (defun produce-allout-mode-menubar-entries () (require 'easymenu) (easy-menu-define allout-mode-exposure-menu @@ -909,7 +904,7 @@ mode from prop-line file-var activation. Used by `allout-mode' function to track repeats.") ;;;_ > allout-write-file-hook () (defun allout-write-file-hook () - "In `allout-mode', run as a `local-write-file-hooks' activity. + "In `allout-mode', run as a `write-contents-functions' activity. Currently just sets `allout-during-write-cue', so outline change-protection knows to keep inactive during file write." @@ -950,7 +945,7 @@ the `allout-layout' variable. (See `allout-layout' and `allout-expose-topic' docstrings for more details on auto layout). `allout-init' works by setting up (or removing) -`allout-find-file-hook' in `find-file-hooks', and giving +`allout-find-file-hook' in `find-file-hook', and giving `allout-auto-activation' a suitable setting. To prime your emacs session for full auto-outline operation, include @@ -979,16 +974,16 @@ the following two lines in your emacs init file: (curr-mode 'allout-auto-activation)) (cond ((not mode) - (setq find-file-hooks (delq hook find-file-hooks)) + (setq find-file-hook (delq hook find-file-hook)) (if (interactive-p) (message "Allout outline mode auto-activation inhibited."))) ((eq mode 'report) - (if (memq hook find-file-hooks) + (if (memq hook find-file-hook) ;; Just punt and use the reports from each of the modes: (allout-init (symbol-value curr-mode)) (allout-init nil) (message "Allout outline mode auto-activation inhibited."))) - (t (add-hook 'find-file-hooks hook) + (t (add-hook 'find-file-hook hook) (set curr-mode ; `set', not `setq'! (cond ((eq mode 'activate) (message @@ -1252,19 +1247,6 @@ OPEN: A topic that is not closed, though its offspring or body may be." ; active state or *de*activation ; specifically requested: (setq allout-explicitly-deactivated t) - (if (string-match "^18\." emacs-version) - ; Revoke those keys that remain - ; as we set them: - (let ((curr-loc (current-local-map))) - (mapcar (function - (lambda (cell) - (if (eq (lookup-key curr-loc (car cell)) - (car (cdr cell))) - (define-key curr-loc (car cell) - (assq (car cell) allout-prior-bindings))))) - allout-added-bindings) - (allout-resumptions 'allout-added-bindings) - (allout-resumptions 'allout-prior-bindings))) (if allout-old-style-prefixes (progn @@ -1273,9 +1255,9 @@ OPEN: A topic that is not closed, though its offspring or body may be." (allout-resumptions 'selective-display) (if (and (boundp 'before-change-functions) before-change-functions) (allout-resumptions 'before-change-functions)) - (setq local-write-file-hooks - (delq 'allout-write-file-hook - local-write-file-hooks)) + (setq write-contents-functions + (delq 'allout-write-file-hook + write-contents-functions)) (allout-resumptions 'paragraph-start) (allout-resumptions 'paragraph-separate) (allout-resumptions (if (string-match "^18" emacs-version) @@ -1315,13 +1297,6 @@ OPEN: A topic that is not closed, though its offspring or body may be." (cons '(allout-mode . allout-mode-map) minor-mode-map-alist)))) - ; V18 minor-mode key bindings: - ; Stash record of added bindings - ; for later revocation: - (allout-resumptions 'allout-added-bindings - (list allout-keybindings-list)) - (allout-resumptions 'allout-prior-bindings - (list (current-local-map))) ; and add them: (use-local-map (produce-allout-mode-map allout-keybindings-list (current-local-map))) @@ -1340,7 +1315,7 @@ OPEN: A topic that is not closed, though its offspring or body may be." ; Temporarily set by any outline ; functions that can be trusted to ; deal properly with concealed text. - (add-hook 'local-write-file-hooks 'allout-write-file-hook) + (add-hook 'write-contents-functions 'allout-write-file-hook) ; Custom auto-fill func, to support ; respect for topic headline, ; hanging-indents, etc: diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index f6b2520a112..d41bfcad58a 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -305,7 +305,11 @@ when editing big diffs)." (defvar diff-narrowed-to nil) (defun diff-end-of-hunk (&optional style) - (if (looking-at diff-hunk-header-re) (goto-char (match-end 0))) + (when (looking-at diff-hunk-header-re) + (unless style + ;; Especially important for unified (because headers are ambiguous). + (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context)))))) + (goto-char (match-end 0))) (let ((end (and (re-search-forward (case style ;; A `unified' header is ambiguous. (unified (concat "^[^-+# \\]\\|" diff --git a/lisp/files.el b/lisp/files.el index be40a0b595e..6a406b6fbf0 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -616,6 +616,8 @@ PATH-AND-SUFFIXES is a pair of lists (DIRECTORIES . SUFFIXES)." (suffix (concat (regexp-opt (cdr path-and-suffixes) t) "\\'")) (string-dir (file-name-directory string))) (dolist (dir (car path-and-suffixes)) + (unless dir + (setq dir default-directory)) (if string-dir (setq dir (expand-file-name string-dir dir))) (when (file-directory-p dir) (dolist (file (file-name-all-completions @@ -668,14 +670,17 @@ Do not specify them in other calls." ;; PREV-DIRS can be a cons cell whose car is an alist ;; of truenames we've just recently computed. - ;; The last test looks dubious, maybe `+' is meant here? --simon. - (if (or (string= filename "") (string= filename "~") - (and (string= (substring filename 0 1) "~") - (string-match "~[^/]*" filename))) - (progn - (setq filename (expand-file-name filename)) - (if (string= filename "") - (setq filename "/")))) + (cond ((or (string= filename "") (string= filename "~")) + (setq filename (expand-file-name filename)) + (if (string= filename "") + (setq filename "/"))) + ((and (string= (substring filename 0 1) "~") + (string-match "~[^/]*/?" filename)) + (let ((first-part + (substring filename 0 (match-end 0))) + (rest (substring filename (match-end 0)))) + (setq filename (concat (expand-file-name first-part) rest))))) + (or counter (setq counter (list 100))) (let (done ;; For speed, remove the ange-ftp completion handler from the list. @@ -4230,7 +4235,7 @@ This works by running a directory listing program whose name is in the variable `insert-directory-program'. If WILDCARD, it also runs the shell specified by `shell-file-name'. -When SWITCHES contains the long `--dired' option,this function +When SWITCHES contains the long `--dired' option, this function treats it specially, for the sake of dired. However, the normally equivalent short `-D' option is just passed on to `insert-directory-program', as any other option." @@ -4307,6 +4312,8 @@ normally equivalent short `-D' option is just passed on to ;; If `insert-directory-program' failed, signal an error. (unless (eq 0 result) + ;; Delete the error message it may have output. + (delete-region beg (point)) ;; On non-Posix systems, we cannot open a directory, so ;; don't even try, because that will always result in ;; the ubiquitous "Access denied". Instead, show the diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el index aab768387d0..0c43c270751 100644 --- a/lisp/iswitchb.el +++ b/lisp/iswitchb.el @@ -298,6 +298,13 @@ example functions that filter buffernames." :type '(repeat (choice regexp function)) :group 'iswitchb) +(defcustom iswitchb-max-to-show nil + "*If non-nil, limit the number of names shown in the minibuffer. +This can greatly speed up iswitchb if you have a multitude of +buffers open." + :type 'integer + :group 'iswitchb) + (defcustom iswitchb-cannot-complete-hook 'iswitchb-completion-help "*Hook run when `iswitchb-complete' can't complete any more. The most useful values are `iswitchb-completion-help', which pops up a @@ -1185,6 +1192,15 @@ Copied from `icomplete-exhibit' with two changes: contents (not minibuffer-completion-confirm))))))) +(defun iswitchb-output-completion (com) + (if (= (length com) most-len) + ;; Most is one exact match, + ;; note that and leave out + ;; for later indication: + (ignore + (setq most-is-exact t)) + (substring com most-len))) + (defun iswitchb-completions (name require-match) "Return the string that is displayed after the user's text. Modified from `icomplete-completions'." @@ -1224,28 +1240,23 @@ Modified from `icomplete-completions'." "") (if (not iswitchb-use-fonts) " [Matched]"))) (t ;multiple matches + (if (and iswitchb-max-to-show + (> (length comps) iswitchb-max-to-show)) + (setq comps + (append + (subseq comps 0 (/ iswitchb-max-to-show 2)) + (list "...") + (subseq comps (- (length comps) + (/ iswitchb-max-to-show 2)))))) (let* ( ;;(most (try-completion name candidates predicate)) (most nil) (most-len (length most)) most-is-exact - (alternatives - (apply - (function concat) - (cdr (apply - (function nconc) - (mapcar '(lambda (com) - (if (= (length com) most-len) - ;; Most is one exact match, - ;; note that and leave out - ;; for later indication: - (progn - (setq most-is-exact t) - ()) - (list "," - (substring com - most-len)))) - comps)))))) + (alternatives (if most + (mapconcat 'iswitchb-output-completion + comps ",") + (mapconcat 'identity comps ",")))) (concat diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ff4256192c4..71946dd02f5 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -100,7 +100,7 @@ in the compilation output, and should return a transformed file name.") ;;;###autoload (defvar compilation-process-setup-function nil "*Function to call to customize the compilation process. -This functions is called immediately before the compilation process is +This function is called immediately before the compilation process is started. It can be used to set any variables or functions that are used while processing the output of the compilation process. The function is called with variables `compilation-buffer' and `compilation-window' @@ -187,8 +187,9 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) "^\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) :\ \\(?:warnin\\(g\\)\\|informationa\\(l\\)\\)?" 1 2 3 (4 . 5)) + ;; fixme: should be `mips' (irix - "^[a-z0-9/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\ + "^[-[:alnum:]_/]+: \\(?:[eE]rror\\|[wW]arnin\\(g\\)\\|[iI]nf\\(o\\)\\)[0-9 ]*:\ \\([^,\" \n\t]+\\)\\(?:, line\\|:\\) \\([0-9]+\\):" 3 4 nil (1 . 2)) (java @@ -206,7 +207,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) \\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\)\\)?" 1 2 nil (3 . 4)) (gnu - "^\\(?:[a-zA-Z][-a-zA-Z0-9.]+: ?\\)?\ + "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\)?\ \\([/.]*[a-zA-Z]:?[^ \t\n:]*\\): ?\ \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\ @@ -228,6 +229,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) (1 (compilation-error-properties 2 3 nil nil nil 0 nil) append))) + ;; Should be lint-1, lint-2 (SysV lint) (mips-1 " (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1) (mips-2 @@ -261,15 +263,16 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) nil 1 nil (3) nil (2 (compilation-face '(3)))) (sun - ": \\(?:ERROR\\|WARNIN\\(G\\)\\|REMAR\\(K\\)\\) \\(?:[a-zA-Z0-9 ]+, \\)?\ + ": \\(?:ERROR\\|WARNIN\\(G\\)\\|REMAR\\(K\\)\\) \\(?:[[:alnum:] ]+, \\)?\ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?" 3 4 5 (1 . 2)) (sun-ada "^\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2 3) - (ultrix - "^\\(?:cfe\\|fort\\): \\(Warning\\)?[^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3 nil (1)) + ;; Redundant with `mips' +;; (ultrix +;; "^\\(?:cfe\\|fort\\): \\(Warning\\)?[^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3 nil (1)) (4bsd "\\(?:^\\|:: \\|\\S ( \\)\\(/[^ \n\t()]+\\)(\\([0-9]+\\))\ @@ -279,14 +282,14 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?" (defcustom compilation-error-regexp-alist (mapcar 'car compilation-error-regexp-alist-alist) "Alist that specifies how to match errors in compiler output. -Note that on Unix exerything is a valid filename, so these +Note that on Unix everything is a valid filename, so these matchers must make some common sense assumptions, which catch normal cases. A shorter list will be lighter on resource usage. Instead of an alist element, you can use a symbol, which is looked up in `compilation-error-regexp-alist-alist'. You can see the predefined symbols and their effects in the file -`etc/compilation.txt' (linked below if your are customizing this). +`etc/compilation.txt' (linked below if you are customizing this). Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK HIGHLIGHT...]). If REGEXP matches, the FILE'th subexpression @@ -357,7 +360,7 @@ you may also want to change `compilation-page-delimiter'.") (1 font-lock-variable-name-face) (2 (compilation-face '(4 . 3)))) ;; Command output lines. Recognize `make[n]:' lines too. - ("^\\([A-Za-z_0-9/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:" + ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:" (1 font-lock-function-name-face) (3 compilation-line-face nil t)) (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1) ("^Compilation finished" . compilation-info-face) @@ -427,7 +430,7 @@ You might also use mode hooks to specify it in certain modes, like this: (defvar compilation-locs ()) (defvar compilation-debug nil - "*Set this to `t' before creating a *compilation* buffer. + "*Set this to t before creating a *compilation* buffer. Then every error line will have a debug text property with the matcher that fit this line and the match data. Use `describe-text-properties'.") @@ -494,7 +497,7 @@ Faces `compilation-error-face', `compilation-warning-face', ;; Used for compatibility with the old compile.el. -(defvar compilation-parsing-end nil) +(defvar compilation-parsing-end (make-marker)) (defvar compilation-parse-errors-function nil) (defvar compilation-error-list nil) (defvar compilation-old-error-list nil) @@ -518,6 +521,7 @@ Faces `compilation-error-face', `compilation-warning-face', '(nil)) ; nil only isn't a property-change (cons (match-string-no-properties idx) dir)) mouse-face highlight + keymap compilation-button-map help-echo "mouse-2: visit current directory"))) ;; Data type `reverse-ordered-alist' retriever. This function retrieves the @@ -528,6 +532,7 @@ Faces `compilation-error-face', `compilation-warning-face', ;; may be nil. The other KEYs are ordered backwards so that growing line ;; numbers can be inserted in front and searching can abort after half the ;; list on average. +(eval-when-compile ;Don't keep it at runtime if not needed. (defmacro compilation-assq (key alist) `(let* ((l1 ,alist) (l2 (cdr l1))) @@ -538,7 +543,7 @@ Faces `compilation-error-face', `compilation-warning-face', l2 (cdr l1))) (if l2 (eq ,key (caar l2)))) l2 - (setcdr l1 (cons (list ,key) l2)))))) + (setcdr l1 (cons (list ,key) l2))))))) ;; This function is the central driver, called when font-locking to gather @@ -564,7 +569,7 @@ Faces `compilation-error-face', `compilation-warning-face', file (or (if file (nth 2 (car (or (get-text-property (1- file) 'message) (get-text-property file 'message))))) - ;; no previous either -- let font-lock continue + ;; no previous either -- but don't let font-lock fail (gethash (setq file '("*unknown*")) compilation-locs) (puthash file (list file fmt) compilation-locs)))) ;; All of these fields are optional, get them only if we have an index, and @@ -581,15 +586,54 @@ Faces `compilation-error-face', `compilation-warning-face', (if (and end-col (setq end-col (match-string-no-properties end-col))) (setq end-col (- (string-to-number end-col) compilation-first-column)) (if end-line (setq end-col -1))) - (if (consp type) ; not a preset type, check what it is. + (if (consp type) ; not a static type, check what it is. (setq type (or (and (car type) (match-end (car type)) 1) (and (cdr type) (match-end (cdr type)) 0) 2))) - ;; Get any (first) already existing marker (if any has one, all have one). - ;; Do this first, as the next assq`s may create new nodes. - (let ((marker (nth 3 (car (cdar (cddr file))))) - (loc (compilation-assq line (cdr file))) - end-loc) + ;; Get first already existing marker (if any has one, all have one). + ;; Do this first, as the compilation-assq`s may create new nodes. + (let* ((marker-line (car (cddr file))) ; a line structure + (marker (nth 3 (cadr marker-line))) ; its marker + (compilation-error-screen-columns compilation-error-screen-columns) + end-marker loc end-loc) + (if (not (and marker (marker-buffer marker))) + (setq marker) ; no valid marker for this file + (setq loc (or line 1) ; normalize no linenumber to line 1 + marker-line) + (catch 'marker ; find nearest loc, at least one exists + (dolist (x (cddr file)) ; loop over lines + (if (> (or (car x) 1) loc) ; still bigger + (setq marker-line x) + (if (or (not marker-line) ; first in list + (> (- (or (car marker-line) 1) loc) + (- loc (or (car x) 1)))) ; current line is nearer + (setq marker-line x)) + (throw 'marker t)))) + (setq marker (nth 3 (cadr marker-line)) + marker-line (car marker-line)) + (with-current-buffer (marker-buffer marker) + (save-restriction + (widen) + (goto-char (marker-position marker)) + (when (or end-col end-line) + (beginning-of-line (- (or end-line line) marker-line -1)) + (if (< end-col 0) + (end-of-line) + (if compilation-error-screen-columns + (move-to-column end-col) + (forward-char end-col))) + (setq end-marker (list (point-marker)))) + (beginning-of-line (if end-line + (- end-line line -1) + (- loc marker-line -1))) + (if col + (if compilation-error-screen-columns + (move-to-column col) + (forward-char col)) + (forward-to-indentation 0)) + (setq marker (list (point-marker)))))) + + (setq loc (compilation-assq line (cdr file))) (if end-line (setq end-loc (compilation-assq end-line (cdr file)) end-loc (compilation-assq end-col end-loc)) @@ -597,44 +641,10 @@ Faces `compilation-error-face', `compilation-warning-face', (setq end-loc (compilation-assq end-col loc)))) (setq loc (compilation-assq col loc)) ;; If they are new, make the loc(s) reference the file they point to. - (or (cdr loc) (setcdr loc (list line file))) + (or (cdr loc) (setcdr loc `(,line ,file ,@marker))) (if end-loc - (or (cdr end-loc) (setcdr end-loc (list (or end-line line) file)))) - ;; If we'd found a marker, ensure that the new locs also get markers - (when (and marker - (not (or (cddr loc) (cddr end-loc))) ; maybe new node w/o marker - (marker-buffer marker)) ; other marker still valid - (or line (setq line 1)) ; normalize no linenumber to line 1 - (catch 'marker ; find nearest loc, at least one exists - (dolist (x (cddr file)) - (if (> (or (car x) 1) line) - (setq marker x) - (if (eq (or (car x) 1) line) - (if (cdr (cddr x)) ; at least one other column - (throw 'marker (setq marker x)) - (if marker (throw 'marker t))) - (throw 'marker (or marker (setq marker x))))))) - (setq marker (if (eq (car (cddr marker)) col) - (nthcdr 3 marker) - (cddr marker)) - file compilation-error-screen-columns) - (with-current-buffer (marker-buffer (cddr marker)) - (save-restriction - (widen) - (goto-char (marker-position (cddr marker))) - (beginning-of-line (- line (car (cadr marker)) -1)) - (if file ; original c.-error-screen-columns - (move-to-column (car loc)) - (forward-char (car loc))) - (setcdr (cdr loc) (point-marker)) - (when end-loc - (beginning-of-line (- end-line line -1)) - (if (< end-col 0) - (end-of-line) - (if file ; original c.-error-screen-columns - (move-to-column (car end-loc)) - (forward-char (car end-loc)))) - (setcdr (cdr end-loc) (point-marker)))))) + (or (cdr end-loc) (setcdr end-loc `(,(or end-line line) ,file ,@end-marker)))) + ;; Must start with face `(face ,compilation-message-face message (,loc ,type ,end-loc) @@ -686,9 +696,9 @@ Faces `compilation-error-face', `compilation-warning-face', ;; error location. Let's do our best. `(,(car item) (0 (compilation-compat-error-properties - (funcall ',line (list* (match-string ,file) - default-directory - ',(nthcdr 4 item)) + (funcall ',line (cons (match-string ,file) + (cons default-directory + ',(nthcdr 4 item))) ,(if col `(match-string ,col))))) (,file compilation-error-face t)) @@ -729,7 +739,7 @@ Faces `compilation-error-face', `compilation-warning-face', Runs COMMAND, a shell command, in a separate process asynchronously with output going to the buffer `*compilation*'. -If optional second arg COMINT is t the buffer will be in comint mode with +If optional second arg COMINT is t the buffer will be in Comint mode with `compilation-shell-minor-mode'. You can then use the command \\[next-error] to find the next error message @@ -762,8 +772,8 @@ to a function that generates a unique name." ;; run compile with the default command line (defun recompile () "Re-compile the program including the current buffer. -If this is run in a compilation-mode buffer, re-use the arguments from the -original use. Otherwise, it recompiles using `compile-command'." +If this is run in a Compilation mode buffer, re-use the arguments from the +original use. Otherwise, recompile using `compile-command'." (interactive) (save-some-buffers (not compilation-ask-about-save) nil) (let ((default-directory (or compilation-directory default-directory))) @@ -773,9 +783,9 @@ original use. Otherwise, it recompiles using `compile-command'." (defcustom compilation-scroll-output nil "*Non-nil to scroll the *compilation* buffer window as output appears. -Setting it causes the compilation-mode commands to put point at the +Setting it causes the Compilation mode commands to put point at the end of their output window so that the end of the output is always -visible rather than the begining." +visible rather than the beginning." :type 'boolean :version "20.3" :group 'compilation) @@ -822,11 +832,11 @@ Otherwise, construct a buffer name from MODE-NAME." The rest of the arguments are optional; for them, nil means use the default. MODE is the major mode to set in the compilation buffer. Mode -may also be `t' meaning `compilation-shell-minor-mode' under `comint-mode'. +may also be t meaning use `compilation-shell-minor-mode' under `comint-mode'. NAME-FUNCTION is a function called to name the buffer. If HIGHLIGHT-REGEXP is non-nil, `next-error' will temporarily highlight -matching section of the visited source line; the default is to use the +the matching section of the visited source line; the default is to use the global value of `compilation-highlight-regexp'. Returns the compilation buffer created." @@ -838,8 +848,8 @@ Returns the compilation buffer created." (process-environment (append compilation-environment - (if (and (boundp 'system-uses-terminfo) - system-uses-terminfo) + (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning + system-uses-terminfo) (list "TERM=dumb" "TERMCAP=" (format "COLUMNS=%d" (window-width))) (list "TERM=emacs" @@ -1136,7 +1146,9 @@ The global commands next/previous/first-error/goto-error use this.") (defconst compilation-turn-on-font-lock 'turn-on-font-lock) (defun compilation-setup (&optional minor) - "Prepare the buffer for the compilation parsing commands to work." + "Prepare the buffer for the compilation parsing commands to work. +Optional argument MINOR indicates this is called from +`compilation-minor-mode'." (make-local-variable 'compilation-current-error) (make-local-variable 'compilation-error-screen-columns) (make-local-variable 'overlay-arrow-position) @@ -1145,7 +1157,7 @@ The global commands next/previous/first-error/goto-error use this.") '(directory message help-echo mouse-face debug)) (set (make-local-variable 'compilation-locs) (make-hash-table :test 'equal :weakness 'value)) - ;; lazy-lock would never find the message unless it's scrolled to + ;; lazy-lock would never find the message unless it's scrolled to. ;; jit-lock might fontify some things too late. (set (make-local-variable 'font-lock-support-mode) nil) (set (make-local-variable 'font-lock-maximum-size) nil) @@ -1193,7 +1205,7 @@ Turning the mode on runs the normal hook `compilation-minor-mode-hook'." (font-lock-fontify-buffer))) (defun compilation-handle-exit (process-status exit-status msg) - "Write msg in the current buffer and hack its mode-line-process." + "Write MSG in the current buffer and hack its mode-line-process." (let ((buffer-read-only nil) (status (if compilation-exit-message-function (funcall compilation-exit-message-function @@ -1338,7 +1350,7 @@ select the source buffer." (pop-to-buffer compilation-last-buffer)) (defun previous-error-no-select (n) - "Move point to the previous error in the compilation buffer and highlight match. + "Move point to previous error in compilation buffer and highlight match. Prefix arg N says how many error messages to move backwards (or forwards, if negative). Finds and highlights the source line like \\[previous-error], but does not @@ -1449,7 +1461,7 @@ See variable `compilation-error-regexp-alist' for customization ideas." ;; If loc contains no marker, no error in that file has been visited. If ;; the marker is invalid the buffer has been killed. So, recalculate all ;; markers for that file. - (unless (and (nthcdr 3 loc) (marker-buffer (nth 3 loc))) + (unless (and (nth 3 loc) (marker-buffer (nth 3 loc))) (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) (or (cdar (nth 2 loc)) default-directory)) @@ -1472,7 +1484,7 @@ See variable `compilation-error-regexp-alist' for customization ideas." (forward-char (car col)))) (beginning-of-line) (skip-chars-forward " \t")) - (if (nthcdr 3 col) + (if (nth 3 col) (set-marker (nth 3 col) (point)) (setcdr (nthcdr 2 col) `(,(point-marker))))))))) (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) @@ -1499,6 +1511,32 @@ This operates on the output from the \\[compile] command." (setq compilation-current-error nil) (next-error n)) +(defun compilation-fake-loc (marker file &optional line col) + "Preassociate MARKER with FILE. +This is useful when you compile temporary files, but want +automatic translation of the messages to the real buffer from +which the temporary file came. This only works if done before a +message about FILE appears! + +Optional args LINE and COL default to 1 and beginning of +indentation respectively. The marker is expected to reflect +this. In the simplest case the marker points to the first line +of the region that was saved to the temp file. + +If you concatenate several regions into the temp file (e.g. a +header with variable assignments and a code region), you must +call this several times, once each for the last line of one +region and the first line of the next region." + (or (consp file) (setq file (list file))) + (setq file (or (gethash file compilation-locs) + (puthash file (list file nil) compilation-locs))) + (let ((loc (compilation-assq (or line 1) (cdr file)))) + (setq loc (compilation-assq col loc)) + (if (cdr loc) + (setcdr (cddr loc) (list marker)) + (setcdr loc (list (or line 1) file marker))) + loc)) + (defcustom compilation-context-lines next-screen-context-lines "*Display this many lines of leading context before message." :type 'integer @@ -1506,7 +1544,7 @@ This operates on the output from the \\[compile] command." :version "21.4") (defsubst compilation-set-window (w mk) - ;; Align the compilation output window W with marker MK near top. + "Align the compilation output window W with marker MK near top." (set-window-start w (save-excursion (goto-char mk) (beginning-of-line (- 1 compilation-context-lines)) @@ -1514,8 +1552,8 @@ This operates on the output from the \\[compile] command." (set-window-point w mk)) (defun compilation-goto-locus (msg mk end-mk) - "Jump to an error MESSAGE and SOURCE. -All arguments are markers. If SOURCE-END is non nil, mark is set there." + "Jump to an error corresponding to MSG at MK. +All arguments are markers. If END-MK is non nil, mark is set there." (if (eq (window-buffer (selected-window)) (marker-buffer msg)) ;; If the compilation buffer window is selected, @@ -1623,7 +1661,7 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." buffer))) (defun compilation-normalize-filename (filename) - "Convert a filename string found in an error message to make it usable." + "Convert FILENAME string found in an error message to make it usable." ;; Check for a comint-file-name-prefix and prepend it if ;; appropriate. (This is very useful for @@ -1691,7 +1729,7 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." (defun compile-buffer-substring (n) (if n (match-string n))) (defun compilation-compat-error-properties (err) - ;; Map old-style ERROR to new-style MESSAGE. + "Map old-style error ERR to new-style message." (let* ((dst (cdr err)) (loc (cond ((markerp dst) (list nil nil nil dst)) ((consp dst) @@ -1701,6 +1739,7 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." `(face nil message ,(list loc 2) help-echo "mouse-2: visit the source location" + keymap compilation-button-map mouse-face highlight))) (defun compilation-compat-parse-errors (limit) diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 8446266b2f3..b33f8f3f239 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -222,6 +222,7 @@ speedbar." (defun gdb-goto-info () (interactive) (select-frame (make-frame)) + (require 'info) (Info-goto-node "(emacs)GDB Graphical Interface")) (defconst gdb-var-create-regexp @@ -688,9 +689,9 @@ This filter may simply queue output for a later time." (string-to-int (match-string 2 args)))) (setq gdb-current-address (match-string 3 args)) (setq gdb-view-source t) -;; cover for auto-display output which comes *before* -;; stopped annotation - (if (eq (gdb-get-output-sink) 'inferior) (gdb-set-output-sink 'user))) + ;; cover for auto-display output which comes *before* + ;; stopped annotation + (if (eq (gdb-get-output-sink) 'inferior) (gdb-set-output-sink 'user))) (defun gdb-send-item (item) (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log)) @@ -1112,7 +1113,8 @@ static char *magick[] = { (save-excursion (goto-line (string-to-number line)) (gdb-put-breakpoint-icon (eq flag ?y))))))))) - (end-of-line)))))) + (end-of-line))))) + (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom))) (defun gdb-mouse-toggle-breakpoint (event) "Toggle breakpoint with mouse click in left margin." @@ -1532,11 +1534,9 @@ the source buffer." (defun gdb-display-source-buffer (buffer) (if (eq gdb-selected-view 'source) - (progn (gdb-display-buffer buffer) - (get-buffer-window buffer)) - (gdb-display-buffer (gdb-get-buffer 'gdb-assembler-buffer)) - nil)) + (gdb-display-buffer (gdb-get-buffer 'gdb-assembler-buffer))) + (get-buffer-window buffer)) ;;; Shared keymap initialization: @@ -1612,6 +1612,7 @@ the source buffer." (defun gdb-view-assembler() (interactive) (gdb-display-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)) + (gdb-invalidate-assembler) (setq gdb-selected-view 'assembler)) ;(defun gdb-view-both() @@ -1964,7 +1965,7 @@ BUFFER nil or omitted means use the current buffer." (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer) (goto-char (point-min)) (forward-line) - (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*\\)") + (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") (progn (setq gdb-current-frame (match-string 2)) (let ((address (match-string 1))) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index bfa507b851a..7a7e62d06ee 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2003, 04 Free Software Foundation, Inc. ;; Author: Dave Love +;; Maintainer: FSF ;; Created: Nov 2003 ;; Keywords: languages @@ -66,10 +67,8 @@ (require 'comint) (eval-when-compile (require 'compile) - (autoload 'Info-last "info") - (autoload 'Info-exit "info") (autoload 'info-lookup-maybe-add-help "info-look")) -(autoload 'compilation-start "compile") ; spurious compiler warning anyway +(autoload 'compilation-start "compile") (defgroup python nil "Silly walks in the Python language" @@ -829,7 +828,8 @@ move and return nil. Otherwise return t." Makes nested Imenu menus from nested `class' and `def' statements. The nested menus are headed by an item referencing the outer definition; it has a space prepended to the name so that it sorts -first with `imenu--sort-by-name'." +first with `imenu--sort-by-name' (though, unfortunately, sub-menus +precede it)." (unless (boundp 'python-recursing) ; dynamically bound below (goto-char (point-min))) ; normal call from Imenu (let (index-alist ; accumulated value to return @@ -937,32 +937,37 @@ Additional arguments are added when the command is used by `run-python' et al.") (defvar python-buffer nil - "*The current python process buffer. -To run multiple Python processes, start the first with \\[run-python]. -It will be in a buffer named *Python*. Rename that with -\\[rename-buffer]. Now start a new process with \\[run-python]. It -will be in a new buffer, named *Python*. Switch between the different -process buffers with \\[switch-to-buffer]. + "The current python process buffer." + ;; Fixme: a single process is currently assumed, so that this doc + ;; is misleading. -Commands that send text from source buffers to Python processes have -to choose a process to send to. This is determined by global variable -`python-buffer'. Suppose you have three inferior Pythons running: - Buffer Process - foo python - bar python<2> - *Python* python<3> -If you do a \\[python-send-region-and-go] command on some Python source -code, what process does it go to? +;; "*The current python process buffer. +;; To run multiple Python processes, start the first with \\[run-python]. +;; It will be in a buffer named *Python*. Rename that with +;; \\[rename-buffer]. Now start a new process with \\[run-python]. It +;; will be in a new buffer, named *Python*. Switch between the different +;; process buffers with \\[switch-to-buffer]. -- In a process buffer (foo, bar, or *Python*), send it to that process. -- In some other buffer (e.g. a source file), send it to the process - attached to `python-buffer'. -Process selection is done by function `python-proc'. +;; Commands that send text from source buffers to Python processes have +;; to choose a process to send to. This is determined by global variable +;; `python-buffer'. Suppose you have three inferior Pythons running: +;; Buffer Process +;; foo python +;; bar python<2> +;; *Python* python<3> +;; If you do a \\[python-send-region-and-go] command on some Python source +;; code, what process does it go to? -Whenever \\[run-python] starts a new process, it resets `python-buffer' -to be the new process's buffer. If you only run one process, this will -do the right thing. If you run multiple processes, you can change -`python-buffer' to another process buffer with \\[set-variable].") +;; - In a process buffer (foo, bar, or *Python*), send it to that process. +;; - In some other buffer (e.g. a source file), send it to the process +;; attached to `python-buffer'. +;; Process selection is done by function `python-proc'. + +;; Whenever \\[run-python] starts a new process, it resets `python-buffer' +;; to be the new process's buffer. If you only run one process, this will +;; do the right thing. If you run multiple processes, you can change +;; `python-buffer' to another process buffer with \\[set-variable]." + ) (defconst python-compilation-regexp-alist `((,(rx (and line-start (1+ (any " \t")) "File \"" @@ -971,6 +976,9 @@ do the right thing. If you run multiple processes, you can change 1 python-compilation-line-number)) "`compilation-error-regexp-alist' for inferior Python.") +;; Fixme: This should inherit some stuff from python-mode, but I'm not +;; sure how much: at least some keybindings, like C-c C-f; syntax?; +;; font-locking, e.g. for triple-quoted strings? (define-derived-mode inferior-python-mode comint-mode "Inferior Python" "Major mode for interacting with an inferior Python process. A Python process can be started with \\[run-python]. @@ -997,7 +1005,8 @@ For running multiple processes in multiple buffers, see `python-buffer'. (add-hook 'comint-input-filter-functions 'python-input-filter nil t) (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter nil t) - ;; Still required by `comint-redirect-send-command', for instance: + ;; Still required by `comint-redirect-send-command', for instance + ;; (and we need to match things like `>>> ... >>> '): (set (make-local-variable 'comint-prompt-regexp) "^\\([>.]\\{3\\} \\)+") (set (make-local-variable 'compilation-error-regexp-alist) python-compilation-regexp-alist) @@ -1037,11 +1046,15 @@ Used as line-number hook function in `python-compilation-regexp-alist'." (cons (point-marker) (if (and (markerp python-orig-start) (marker-buffer python-orig-start)) - (with-current-buffer (marker-buffer python-orig-start) - (goto-char python-orig-start) - (forward-line (1- line))) - (list (if (stringp python-orig-start) python-orig-start file) - line nil))))) + (let ((start python-orig-start)) + (with-current-buffer (marker-buffer python-orig-start) + (goto-char start) + (forward-line (1- line)) + (point-marker))) + (list (if (stringp python-orig-start) + (list python-orig-start default-directory) + file) + line col))))) (defvar python-preoutput-result nil "Data from output line last `_emacs_out' line seen by the preoutput filter.") @@ -1234,17 +1247,17 @@ module-qualified names." ;; (set (make-local-variable 'compilation-old-error-list) nil) (let ((comint-input-filter-functions (delete 'python-input-filter comint-input-filter-functions))) + (set (make-local-variable 'python-orig-start) nil) + ;; Fixme: I'm not convinced by this logic from python-mode.el. (python-send-string (if (string-match "\\.py\\'" file-name) ;; Fixme: make sure the directory is in the path list (let ((module (file-name-sans-extension (file-name-nondirectory file-name)))) - (set (make-local-variable 'python-orig-start) nil) (format "\ if globals().has_key(%S): reload(%s) else: import %s " module module module)) - (set (make-local-variable 'python-orig-start) file-name) (format "execfile('%s')" file-name)))) (set-marker compilation-parsing-end end) (setq compilation-last-buffer (current-buffer)))))) @@ -1329,13 +1342,14 @@ Used with `eval-after-load'." (string-match "^Python \\([0-9]+\\.[0-9]+\\>\\)" s) (match-string 1 s))) ;; Whether info files have a Python version suffix, e.g. in Debian. - (versioned + (versioned (with-temp-buffer - (Info-mode) + (with-no-warnings (Info-mode)) (condition-case () ;; Don't use `info' because it would pop-up a *info* buffer. - (Info-goto-node (format "(python%s-lib)Miscellaneous Index" - version)) + (with-no-warnings + (Info-goto-node (format "(python%s-lib)Miscellaneous Index" + version))) (error nil))))) (info-lookup-maybe-add-help :mode 'python-mode diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el index b54d9f52c01..d6c5ffffa43 100644 --- a/lisp/url/url-dav.el +++ b/lisp/url/url-dav.el @@ -386,8 +386,7 @@ XML document." (overall-status nil)) (when buffer (unwind-protect - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (goto-char url-http-end-of-headers) (setq overall-status url-http-response-status) @@ -396,13 +395,13 @@ XML document." ;; them. (if (and url-http-content-type - (or (string-match "^text/xml" url-http-content-type) - (string-match "^application/xml" url-http-content-type))) + (string-match "\\`\\(text\\|application\\)/xml" + url-http-content-type)) (setq tree (xml-parse-region (point) (point-max))))) ;; Clean up after ourselves. - '(kill-buffer buffer))) + (kill-buffer buffer))) - ;; We should now be + ;; We should now be (if (eq (xml-node-name (car tree)) 'DAV:multistatus) (url-dav-dispatch-node (car tree)) (url-debug 'dav "Got back singleton response for URL(%S)" url) @@ -577,8 +576,7 @@ Returns t iff the lock was successfully released." (result nil)) (when buffer (unwind-protect - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (setq result (url-dav-http-success-p url-http-response-status))) (kill-buffer buffer))) result)) @@ -627,7 +625,7 @@ Returns t iff the lock was successfully released." (autoload 'url-http-head-file-attributes "url-http") ;;;###autoload -(defun url-dav-file-attributes (url) +(defun url-dav-file-attributes (url &optional id-format) (let ((properties (cdar (url-dav-get-properties url))) (attributes nil)) (if (and properties @@ -679,7 +677,7 @@ Returns t iff the lock was successfully released." ;; device number - meaningless nil)) ;; Fall back to just the normal http way of doing things. - (setq attributes (url-http-head-file-attributes url))) + (setq attributes (url-http-head-file-attributes url id-format))) attributes)) ;;;###autoload @@ -695,8 +693,7 @@ OBJ may be a buffer or a string." (url-request-data (cond ((bufferp obj) - (save-excursion - (set-buffer obj) + (with-current-buffer obj (buffer-string))) ((stringp obj) obj) @@ -719,8 +716,7 @@ OBJ may be a buffer or a string." ;; Sanity checking (when buffer (unwind-protect - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (setq result (url-dav-http-success-p url-http-response-status))) (kill-buffer buffer))) result)) @@ -849,8 +845,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (result nil)) (when buffer (unwind-protect - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (case url-http-response-status (201 ; Collection created in its entirety (setq result t)) diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 4dfac46b651..77c2e74555f 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el @@ -220,14 +220,14 @@ to them." buffer)) (defmacro url-file-create-wrapper (method args) - (` (defalias (quote (, (intern (format "url-ftp-%s" method)))) - (defun (, (intern (format "url-file-%s" method))) (, args) - (, (format "FTP/FILE URL wrapper around `%s' call." method)) - (setq url (url-file-build-filename url)) - (and url ((, method) (,@ (remove '&rest (remove '&optional args))))))))) + `(defalias ',(intern (format "url-ftp-%s" method)) + (defun ,(intern (format "url-file-%s" method)) ,args + ,(format "FTP/FILE URL wrapper around `%s' call." method) + (setq url (url-file-build-filename url)) + (and url (,method ,@(remove '&rest (remove '&optional args))))))) (url-file-create-wrapper file-exists-p (url)) -(url-file-create-wrapper file-attributes (url)) +(url-file-create-wrapper file-attributes (url &optional id-format)) (url-file-create-wrapper file-symlink-p (url)) (url-file-create-wrapper file-readable-p (url)) (url-file-create-wrapper file-writable-p (url)) diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index eb0bec9ae92..6c540e8d61b 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -225,7 +225,7 @@ accessible." ,@(remove '&rest (remove '&optional args)))))) (url-handlers-create-wrapper file-exists-p (url)) -(url-handlers-create-wrapper file-attributes (url)) +(url-handlers-create-wrapper file-attributes (url &optional id-format)) (url-handlers-create-wrapper file-symlink-p (url)) (url-handlers-create-wrapper file-writable-p (url)) (url-handlers-create-wrapper file-directory-p (url)) @@ -244,7 +244,7 @@ accessible." (url-handlers-create-wrapper file-truename (url &optional counter prev-dirs))) -(add-hook 'find-file-hooks 'url-handlers-set-buffer-mode) +(add-hook 'find-file-hook 'url-handlers-set-buffer-mode) (defun url-handlers-set-buffer-mode () "Set correct modes for the current buffer if visiting a remote file." diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index b2f797d09c7..200025c3804 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -4,6 +4,7 @@ ;; Author: Bill Perry ;; Keywords: comm, data, processes + ;; This file is part of GNU Emacs. ;; ;; GNU Emacs is free software; you can redistribute it and/or modify @@ -1120,7 +1121,7 @@ CBARGS as the arguments." ;;;###autoload (defalias 'url-http-file-readable-p 'url-http-file-exists-p) -(defun url-http-head-file-attributes (url) +(defun url-http-head-file-attributes (url &optional id-format) (let ((buffer (url-http-head url)) (attributes nil)) (when buffer @@ -1136,10 +1137,10 @@ CBARGS as the arguments." attributes)) ;;;###autoload -(defun url-http-file-attributes (url) +(defun url-http-file-attributes (url &optional id-format) (if (url-dav-supported-p url) - (url-dav-file-attributes url) - (url-http-head-file-attributes url))) + (url-dav-file-attributes url id-format) + (url-http-head-file-attributes url id-format))) ;;;###autoload (defun url-http-options (url) diff --git a/lisp/url/url-https.el b/lisp/url/url-https.el index 0ea11a45b79..11b2593ea80 100644 --- a/lisp/url/url-https.el +++ b/lisp/url/url-https.el @@ -1,26 +1,29 @@ ;;; url-https.el --- HTTP over SSL routines + +;; Copyright (c) 1999, 2004 Free Software Foundation, Inc. + ;; Keywords: comm, data, processes -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Copyright (c) 1999 Free Software Foundation, Inc. -;;; -;;; This file is part of GNU Emacs. -;;; -;;; GNU Emacs is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 2, or (at your option) -;;; any later version. -;;; -;;; GNU Emacs is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Emacs; see the file COPYING. If not, write to the -;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;;; Boston, MA 02111-1307, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: (require 'url-gw) (require 'url-util) @@ -45,8 +48,9 @@ (url-https-create-secure-wrapper nil (url callback cbargs)) (url-https-create-secure-wrapper file-exists-p (url)) (url-https-create-secure-wrapper file-readable-p (url)) -(url-https-create-secure-wrapper file-attributes (url)) +(url-https-create-secure-wrapper file-attributes (url &optional id-format)) (provide 'url-https) -;;; arch-tag: c3645ac5-c248-4d12-ad41-7c4b6f7b6d19 +;; arch-tag: c3645ac5-c248-4d12-ad41-7c4b6f7b6d19 +;;; url-https.el ends here diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el index c0ac4f5cb45..d068341b1c2 100644 --- a/lisp/url/url-nfs.el +++ b/lisp/url/url-nfs.el @@ -1,27 +1,30 @@ ;;; url-nfs.el --- NFS URL interface + +;; Copyright (c) 1996,97,98,1999,2004 Free Software Foundation, Inc. +;; Copyright (c) 1996 by William M. Perry + ;; Keywords: comm, data, processes -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Copyright (c) 1996 by William M. Perry -;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc. -;;; -;;; This file is part of GNU Emacs. -;;; -;;; GNU Emacs is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 2, or (at your option) -;;; any later version. -;;; -;;; GNU Emacs is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Emacs; see the file COPYING. If not, write to the -;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;;; Boston, MA 02111-1307, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: (eval-when-compile (require 'cl)) (require 'url-parse) @@ -72,14 +75,14 @@ Each can be used any number of times.") (url-file (url-nfs-build-filename url) callback cbargs)) (defmacro url-nfs-create-wrapper (method args) - (` (defun (, (intern (format "url-nfs-%s" method))) (, args) - (, (format "NFS URL wrapper around `%s' call." method)) - (setq url (url-nfs-build-filename url)) - (and url ((, (intern (format "url-file-%s" method))) - (,@ (remove '&rest (remove '&optional args)))))))) + `(defun ,(intern (format "url-nfs-%s" method)) ,args + ,(format "NFS URL wrapper around `%s' call." method) + (setq url (url-nfs-build-filename url)) + (and url (,(intern (format "url-file-%s" method)) + ,@(remove '&rest (remove '&optional args)))))) (url-nfs-create-wrapper file-exists-p (url)) -(url-nfs-create-wrapper file-attributes (url)) +(url-nfs-create-wrapper file-attributes (url &optional id-format)) (url-nfs-create-wrapper file-symlink-p (url)) (url-nfs-create-wrapper file-readable-p (url)) (url-nfs-create-wrapper file-writable-p (url)) @@ -93,4 +96,5 @@ Each can be used any number of times.") (provide 'url-nfs) -;;; arch-tag: cdf9c9ba-b7d2-4c29-8b48-7ae9bbc0d437 +;; arch-tag: cdf9c9ba-b7d2-4c29-8b48-7ae9bbc0d437 +;;; url-nfs.el ends here diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 49e805086fb..d4a3733eab5 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -1,28 +1,31 @@ ;;; url-util.el --- Miscellaneous helper routines for URL library + +;; Copyright (c) 1996,97,98,99,2001,2004 Free Software Foundation, Inc. +;; Copyright (c) 1993 - 1996 by William M. Perry + ;; Author: Bill Perry ;; Keywords: comm, data, processes -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Copyright (c) 1993 - 1996 by William M. Perry -;;; Copyright (c) 1996, 97, 98, 99, 2001 Free Software Foundation, Inc. -;;; -;;; This file is part of GNU Emacs. -;;; -;;; GNU Emacs is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 2, or (at your option) -;;; any later version. -;;; -;;; GNU Emacs is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Emacs; see the file COPYING. If not, write to the -;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;;; Boston, MA 02111-1307, USA. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;;; Code: (require 'url-parse) (autoload 'timezone-parse-date "timezone") @@ -63,8 +66,7 @@ If a list, it is a list of the types of messages to be logged." (if (or (eq url-debug t) (numberp url-debug) (and (listp url-debug) (memq tag url-debug))) - (save-excursion - (set-buffer (get-buffer-create "*URL-DEBUG*")) + (with-current-buffer (get-buffer-create "*URL-DEBUG*") (goto-char (point-max)) (insert (symbol-name tag) " -> " (apply 'format args) "\n") (if (numberp url-debug) @@ -173,7 +175,7 @@ Strips out default port numbers, etc." ;;;###autoload (defun url-lazy-message (&rest args) "Just like `message', but is a no-op if called more than once a second. -Will not do anything if url-show-status is nil." +Will not do anything if `url-show-status' is nil." (if (or (null url-show-status) (active-minibuffer-window) (= url-lazy-message-time @@ -502,4 +504,5 @@ Has a preference for looking backward when not directly on a symbol." (provide 'url-util) -;;; arch-tag: 24352abc-5a5a-412e-90cd-313b26bed5c9 +;; arch-tag: 24352abc-5a5a-412e-90cd-313b26bed5c9 +;;; url-util.el ends here diff --git a/lisp/xml.el b/lisp/xml.el index 408c13ab39b..ab87125356d 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -27,13 +27,13 @@ ;; This file contains a somewhat incomplete non-validating XML parser. It ;; parses a file, and returns a list that can be used internally by -;; any other lisp libraries. +;; any other Lisp libraries. ;;; FILE FORMAT ;; The document type declaration may either be ignored or (optionally) ;; parsed, but currently the parsing will only accept element -;; declarations. The XML file is assumed to be well-formed. In case +;; declarations. The XML file is assumed to be well-formed. In case ;; of error, the parsing stops and the XML file is shown where the ;; parsing stopped. ;; @@ -44,7 +44,7 @@ ;; value2 ;; value3 ;; -;; Of course, the name of the nodes and attributes can be anything. There can +;; Of course, the name of the nodes and attributes can be anything. There can ;; be any number of attributes (or none), as well as any number of children ;; below the nodes. ;; @@ -86,7 +86,18 @@ (defsubst xml-node-name (node) "Return the tag associated with NODE. -The tag is a lower-case symbol." +Without namespace-aware parsing, the tag is a symbol. + +With namespace-aware parsing, the tag is a cons of a string +representing the uri of the namespace with the local name of the +tag. For example, + + + +would be represented by + + '(\"\" . \"foo\")." + (car node)) (defsubst xml-node-attributes (node) @@ -101,17 +112,17 @@ This is a list of nodes, and it can be nil." (defun xml-get-children (node child-name) "Return the children of NODE whose tag is CHILD-NAME. -CHILD-NAME should be a lower case symbol." +CHILD-NAME should match the value returned by `xml-node-name'." (let ((match ())) (dolist (child (xml-node-children node)) - (if child - (if (equal (xml-node-name child) child-name) - (push child match)))) + (if (and (listp child) + (equal (xml-node-name child) child-name)) + (push child match))) (nreverse match))) (defun xml-get-attribute-or-nil (node attribute) "Get from NODE the value of ATTRIBUTE. -Return `nil' if the attribute was not found. +Return nil if the attribute was not found. See also `xml-get-attribute'." (cdr (assoc attribute (xml-node-attributes node)))) @@ -236,7 +247,8 @@ If PARSE-NS is non-nil, then QNAMES are expanded." (nreverse xml))))))) (defun xml-maybe-do-ns (name default xml-ns) - "Perform any namespace expansion. NAME is the name to perform the expansion on. + "Perform any namespace expansion. +NAME is the name to perform the expansion on. DEFAULT is the default namespace. XML-NS is a cons of namespace names to uris. When namespace-aware parsing is off, then XML-NS is nil. @@ -325,10 +337,8 @@ Returns one of: (push (cons (cdar attr) (intern (concat ":" (cdr attr)))) xml-ns)))) - ;; expand element names - (setq node-name (list (xml-maybe-do-ns node-name "" xml-ns))) + (setq children (list attrs (xml-maybe-do-ns node-name "" xml-ns))) - (setq children (list attrs node-name)) ;; is this an empty element ? (if (looking-at "/>") (progn @@ -383,8 +393,8 @@ Returns one of: (error "XML: Invalid character"))))) (defun xml-parse-attlist (&optional xml-ns) - "Return the attribute-list after point. Leave point at the -first non-blank character after the tag." + "Return the attribute-list after point. +Leave point at the first non-blank character after the tag." (let ((attlist ()) end-pos name) (skip-syntax-forward " ") @@ -575,7 +585,7 @@ This follows the rule [28] in the XML specifications." ;; Fixme: Take declared entities from the DTD when they're available. (defun xml-substitute-entity (match) - "Subroutine of xml-substitute-special." + "Subroutine of `xml-substitute-special'." (save-match-data (let ((match1 (match-string 1 str))) (cond ((string= match1 "lt") "<") diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 6637064af48..1e04943f4f2 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2004-04-16 Luc Teirlinck + + * sequences.texi: Various clarifications. + 2004-04-14 Luc Teirlinck * buffers.texi (Read Only Buffers): Mention optional ARG to diff --git a/lispref/keymaps.texi b/lispref/keymaps.texi index 9b2df2b2045..ee50855bef3 100644 --- a/lispref/keymaps.texi +++ b/lispref/keymaps.texi @@ -1864,7 +1864,7 @@ function should return the binding to use instead. @cindex menu separators A menu separator is a kind of menu item that doesn't display any -text--instead, it divides the menu into subparts with a horizontal line. +text---instead, it divides the menu into subparts with a horizontal line. A separator looks like this in the menu keymap: @example diff --git a/lispref/lists.texi b/lispref/lists.texi index 41b3918de06..7c369633c2e 100644 --- a/lispref/lists.texi +++ b/lispref/lists.texi @@ -327,6 +327,7 @@ x @end example @end defmac +@anchor{Definition of nth} @defun nth n list This function returns the @var{n}th element of @var{list}. Elements are numbered starting with zero, so the @sc{car} of @var{list} is @@ -391,6 +392,7 @@ this link is the list's last element. If @var{list} is null, if @var{n} is bigger than @var{list}'s length. @end defun +@anchor{Definition of safe-length} @defun safe-length list This function returns the length of @var{list}, with no risk of either an error or an infinite loop. @@ -565,7 +567,7 @@ object. The final argument is not copied or converted; it becomes the @sc{cdr} of the last cons cell in the new list. If the final argument is itself a list, then its elements become in effect elements of the result list. If the final element is not a list, the result is a -``dotted list'' since its final @sc{cdr} is not @code{nil} as required +dotted list since its final @sc{cdr} is not @code{nil} as required in a true list. In Emacs 20 and before, the @code{append} function also allowed @@ -708,7 +710,7 @@ x @end defun @defun copy-tree tree &optional vecp -This function returns a copy the tree @code{tree}. If @var{tree} is a +This function returns a copy of the tree @code{tree}. If @var{tree} is a cons cell, this makes a new cons cell with the same @sc{car} and @sc{cdr}, then recursively copies the @sc{car} and @sc{cdr} in the same way. @@ -732,7 +734,7 @@ All arguments can be integers or floating point numbers. However, floating point arguments can be tricky, because floating point arithmetic is inexact. For instance, depending on the machine, it may quite well happen that @code{(number-sequence 0.4 0.6 0.2)} returns -the one element list @code{(0.4)}, whereas +the one element list @code{(0.4)}, whereas @code{(number-sequence 0.4 0.8 0.2)} returns a list with three elements. The @var{n}th element of the list is computed by the exact formula @code{(+ @var{from} (* @var{n} @var{separation}))}. Thus, if diff --git a/lispref/processes.texi b/lispref/processes.texi index 27721efee45..a4166ee29a0 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi @@ -933,7 +933,7 @@ primitive that waits. streams of the subprocess, because Emacs normally spawns the subprocess inside a pseudo-TTY, and a pseudo-TTY has only one output channel. If you want to keep the output to those streams separate, you should -redirect one of them to a file--for example, by using an appropriate +redirect one of them to a file---for example, by using an appropriate shell command. @menu diff --git a/lispref/sequences.texi b/lispref/sequences.texi index 06ac8c5f569..a9f997a5b2c 100644 --- a/lispref/sequences.texi +++ b/lispref/sequences.texi @@ -69,8 +69,8 @@ elements. This section describes functions that accept any kind of sequence. @defun sequencep object -Returns @code{t} if @var{object} is a list, vector, -string, bool-vector, or char-table, @code{nil} otherwise. +Returns @code{t} if @var{object} is a list, vector, string, +bool-vector, or char-table, @code{nil} otherwise. @end defun @defun length sequence @@ -80,12 +80,12 @@ string, bool-vector, or char-table, @code{nil} otherwise. @cindex sequence length @cindex char-table length This function returns the number of elements in @var{sequence}. If -@var{sequence} is a cons cell that is not a list (because the final -@sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is -signaled. For a char-table, the value returned is always one more -than the maximum Emacs character code. +@var{sequence} is a dotted list, a @code{wrong-type-argument} error is +signaled. Circular lists may cause an infinite loop. For a +char-table, the value returned is always one more than the maximum +Emacs character code. -@xref{List Elements}, for the related function @code{safe-length}. +@xref{Definition of safe-length}, for the related function @code{safe-length}. @example @group @@ -121,10 +121,11 @@ If @var{string} is a multibyte string, this is greater than @defun elt sequence index @cindex elements of sequences This function returns the element of @var{sequence} indexed by -@var{index}. Legitimate values of @var{index} are integers ranging from -0 up to one less than the length of @var{sequence}. If @var{sequence} -is a list, then out-of-range values of @var{index} return @code{nil}; -otherwise, they trigger an @code{args-out-of-range} error. +@var{index}. Legitimate values of @var{index} are integers ranging +from 0 up to one less than the length of @var{sequence}. If +@var{sequence} is a list, out-of-range values behave as for +@code{nth}. @xref{Definition of nth}. Otherwise, out-of-range values +trigger an @code{args-out-of-range} error. @example @group @@ -151,7 +152,7 @@ otherwise, they trigger an @code{args-out-of-range} error. @end example This function generalizes @code{aref} (@pxref{Array Functions}) and -@code{nth} (@pxref{List Elements}). +@code{nth} (@pxref{Definition of nth}). @end defun @defun copy-sequence sequence @@ -171,6 +172,9 @@ the copy is itself a copy, not shared with the original's property list. However, the actual values of the properties are shared. @xref{Text Properties}. +This function does not work for dotted lists. Trying to copy a +circular list may cause an infinite loop. + See also @code{append} in @ref{Building Lists}, @code{concat} in @ref{Creating Strings}, and @code{vconcat} in @ref{Vector Functions}, for other ways to copy sequences. @@ -472,9 +476,9 @@ each initialized to @var{object}. @defun vconcat &rest sequences @cindex copying vectors This function returns a new vector containing all the elements of the -@var{sequences}. The arguments @var{sequences} may be any kind of -arrays, including lists, vectors, or strings. If no @var{sequences} are -given, an empty vector is returned. +@var{sequences}. The arguments @var{sequences} may be true lists, +vectors, strings or bool-vectors. If no @var{sequences} are given, an +empty vector is returned. The value is a newly constructed vector that is not @code{eq} to any existing vector. diff --git a/lispref/text.texi b/lispref/text.texi index bb57da746bf..c6e5aa34d05 100644 --- a/lispref/text.texi +++ b/lispref/text.texi @@ -3875,7 +3875,7 @@ changes, like this: If an error (or other nonlocal exit) occurs inside the body of @code{atomic-change-group}, it unmakes all the changes in that buffer that were during the execution of the body. This kind of change group -has no effect on any other buffers--any such changes remain. +has no effect on any other buffers---any such changes remain. If you need something more sophisticated, such as to make changes in various buffers constitute one atomic group, you must directly call diff --git a/src/ChangeLog b/src/ChangeLog index c9cf12dc159..702f3be6046 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,39 @@ +2004-04-16 Luc Teirlinck + + * buffer.c (Fbuffer_base_buffer): Doc fix. + +2004-04-17 Kim F. Storm + + * keymap.c (Fkey_description): Add optional PREFIX arg. + Combine prefix with KEYS to make up the full key sequence to describe. + Correlate meta_prefix_char and following (simple) key to describe + as meta modifier. All callers changed. + (describe_map): Rename arg `keys' to `prefix'. Remove local + `elt_prefix' var. Use Fkey_description with prefix instead of + elt_prefix combined with Fsingle_key_description. + (describe_vector): Declare static. Replace arg `elt_prefix' with + `prefix'. Add KEYMAP_P arg. Add local var `elt_prefix'; use it + if !KEYMAP_P. Use Fkey_description with prefix instead of + Fsingle_key_description. + + * keymap.h (Fkey_description): Fix prototype. + (describe_vector): Remove prototype. + + * xdisp.c (update_overlay_arrows): Fix handling of up_to_date < 0. + + * image.c (PNG_BG_COLOR_SHIFT): Remove. + (png_load): Fix calculation of transparent background color on X + and W32 platforms. + +2004-04-16 Juanma Barranquero + + * xdisp.c (try_scrolling): Make sure `scroll-conservatively' is + not too large before computing how much to scroll. + +2004-04-15 Stefan Monnier + + * dired.c (Ffile_attributes): Don't pass extra nil arg to file-handler. + 2004-04-14 Luc Teirlinck * fileio.c (Fverify_visited_file_modtime, Fvisited_file_modtime): @@ -30,6 +66,11 @@ centering_position = 0. Clear desired matrix before retrying with centering_position = 0. +2004-04-13 Stefan Monnier + + * syntax.c (scan_lists): Simplify backward string scan. + Fix off-by-one boundary check for string and comment fences. + 2004-04-13 Joe Buehler * sheap.c, unexcw.c: New files. diff --git a/src/buffer.c b/src/buffer.c index ca74dda73bf..6e67f07cf38 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -832,7 +832,8 @@ No argument or nil as argument means use the current buffer. */) DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, 0, 1, 0, doc: /* Return the base buffer of indirect buffer BUFFER. -If BUFFER is not indirect, return nil. */) +If BUFFER is not indirect, return nil. +BUFFER defaults to the current buffer. */) (buffer) register Lisp_Object buffer; { diff --git a/src/callint.c b/src/callint.c index 50090db8b28..a3e4984fd16 100644 --- a/src/callint.c +++ b/src/callint.c @@ -612,7 +612,7 @@ supply if the command inquires which events were used to invoke it. */) Qnil, Qnil, Qnil, Qnil); unbind_to (speccount1, Qnil); teml = args[i]; - visargs[i] = Fkey_description (teml); + visargs[i] = Fkey_description (teml, Qnil); /* If the key sequence ends with a down-event, discard the following up-event. */ @@ -639,7 +639,7 @@ supply if the command inquires which events were used to invoke it. */) args[i] = Fread_key_sequence (build_string (callint_message), Qnil, Qt, Qnil, Qnil); teml = args[i]; - visargs[i] = Fkey_description (teml); + visargs[i] = Fkey_description (teml, Qnil); unbind_to (speccount1, Qnil); /* If the key sequence ends with a down-event, diff --git a/src/doc.c b/src/doc.c index d4d749ab585..a0b840637e0 100644 --- a/src/doc.c +++ b/src/doc.c @@ -808,7 +808,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int } else { /* function is on a key */ - tem = Fkey_description (tem); + tem = Fkey_description (tem, Qnil); goto subst_string; } } diff --git a/src/image.c b/src/image.c index 34db5e53367..66b004220d1 100644 --- a/src/image.c +++ b/src/image.c @@ -51,7 +51,6 @@ Boston, MA 02111-1307, USA. */ typedef struct x_bitmap_record Bitmap_Record; #define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y) #define NO_PIXMAP None -#define PNG_BG_COLOR_SHIFT 0 #define RGB_PIXEL_COLOR unsigned long @@ -69,7 +68,6 @@ typedef struct x_bitmap_record Bitmap_Record; typedef struct w32_bitmap_record Bitmap_Record; #define GET_PIXEL(ximg, x, y) GetPixel(ximg, x, y) #define NO_PIXMAP 0 -#define PNG_BG_COLOR_SHIFT 0 #define RGB_PIXEL_COLOR COLORREF @@ -104,7 +102,6 @@ typedef struct mac_bitmap_record Bitmap_Record; #define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y) #define NO_PIXMAP 0 -#define PNG_BG_COLOR_SHIFT 8 #define RGB_PIXEL_COLOR unsigned long @@ -1172,7 +1169,7 @@ four_corners_best (ximg, width, height) /* Return the `background' field of IMG. If IMG doesn't have one yet, it is guessed heuristically. If non-zero, XIMG is an existing XImage object (or device context with the image selected on W32) to - use for the heuristic. */ + use for the heuristic. */ RGB_PIXEL_COLOR image_background (img, f, ximg) @@ -1205,7 +1202,7 @@ image_background (img, f, ximg) if (free_ximg) Destroy_Image (ximg, prev); - + img->background_valid = 1; } @@ -2990,7 +2987,7 @@ xbm_load_image (f, img, contents, end) non_default_colors = 1; } - Create_Pixmap_From_Bitmap_Data (f, img, data, + Create_Pixmap_From_Bitmap_Data (f, img, data, foreground, background, non_default_colors); xfree (data); @@ -3857,7 +3854,7 @@ lookup_rgb_color (f, r, g, b) /* Assemble the pixel color. */ return pr | pg | pb; } - + for (p = ct_table[i]; p; p = p->next) if (p->r == r && p->g == g && p->b == b) break; @@ -4968,7 +4965,7 @@ pbm_load (f, img) x_destroy_x_image (ximg); /* X and W32 versions did it here, MAC version above. ++kfs - img->width = width; + img->width = width; img->height = height; */ UNGCPRO; @@ -5412,9 +5409,9 @@ png_load (f, img) png_color_16 user_bg; bzero (&user_bg, sizeof user_bg); - user_bg.red = color.red >> PNG_BG_COLOR_SHIFT; - user_bg.green = color.green >> PNG_BG_COLOR_SHIFT; - user_bg.blue = color.blue >> PNG_BG_COLOR_SHIFT; + user_bg.red = color.red >> 8; + user_bg.green = color.green >> 8; + user_bg.blue = color.blue >> 8; fn_png_set_background (png_ptr, &user_bg, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); @@ -5438,9 +5435,9 @@ png_load (f, img) x_query_color (f, &color); bzero (&frame_background, sizeof frame_background); - frame_background.red = color.red; - frame_background.green = color.green; - frame_background.blue = color.blue; + frame_background.red = color.red >> 8; + frame_background.green = color.green >> 8; + frame_background.blue = color.blue >> 8; #endif /* HAVE_X_WINDOWS */ #ifdef HAVE_NTGUI @@ -5451,9 +5448,9 @@ png_load (f, img) x_query_color (f, &color); #endif bzero (&frame_background, sizeof frame_background); - frame_background.red = 256 * GetRValue (color); - frame_background.green = 256 * GetGValue (color); - frame_background.blue = 256 * GetBValue (color); + frame_background.red = GetRValue (color); + frame_background.green = GetGValue (color); + frame_background.blue = GetBValue (color); #endif /* HAVE_NTGUI */ #ifdef MAC_OS diff --git a/src/keyboard.c b/src/keyboard.c index dc9bcd7f4f3..330eef60c1e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -7479,7 +7479,7 @@ parse_menu_item (item, notreal, inmenubar) newcache = chkcache; if (chkcache) { - tem = Fkey_description (tem); + tem = Fkey_description (tem, Qnil); if (CONSP (prefix)) { if (STRINGP (XCAR (prefix))) @@ -9878,7 +9878,7 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ int count = SPECPDL_INDEX (); record_unwind_protect (pop_message_unwind, Qnil); - binding = Fkey_description (bindings); + binding = Fkey_description (bindings, Qnil); newmessage = (char *) alloca (SCHARS (SYMBOL_NAME (function)) diff --git a/src/keymap.c b/src/keymap.c index 4cea62c10fb..0e68c38d677 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -122,6 +122,9 @@ static void describe_translation P_ ((Lisp_Object, Lisp_Object)); static void describe_map P_ ((Lisp_Object, Lisp_Object, void (*) P_ ((Lisp_Object, Lisp_Object)), int, Lisp_Object, Lisp_Object*, int)); +static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object, + void (*) (Lisp_Object, Lisp_Object), int, + Lisp_Object, Lisp_Object, int *, int, int)); static void silly_event_symbol_error P_ ((Lisp_Object)); /* Keymap object support - constructors and predicates. */ @@ -688,7 +691,7 @@ map_keymap (map, fun, args, data, autoload) tail = XCDR (tail)) { Lisp_Object binding = XCAR (tail); - + if (CONSP (binding)) map_keymap_item (fun, args, XCAR (binding), XCDR (binding), data); else if (VECTORP (binding)) @@ -1161,7 +1164,7 @@ binding KEY to DEF is added at the front of KEYMAP. */) /* We must use Fkey_description rather than just passing key to error; key might be a vector, not a string. */ error ("Key sequence %s uses invalid prefix characters", - SDATA (Fkey_description (key))); + SDATA (Fkey_description (key, Qnil))); } } @@ -1792,9 +1795,9 @@ accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized) int meta_bit = meta_modifier; Lisp_Object last = make_number (XINT (Flength (thisseq)) - 1); tem = Fcopy_sequence (thisseq); - + Faset (tem, last, make_number (XINT (key) | meta_bit)); - + /* This new sequence is the same length as thisseq, so stick it in the list right after this one. */ @@ -1945,78 +1948,109 @@ Lisp_Object Qsingle_key_description, Qkey_description; /* This function cannot GC. */ -DEFUN ("key-description", Fkey_description, Skey_description, 1, 1, 0, +DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, doc: /* Return a pretty description of key-sequence KEYS. +Optional arg PREFIX is the sequence of keys leading up to KEYS. Control characters turn into "C-foo" sequences, meta into "M-foo" spaces are put between sequence elements, etc. */) - (keys) - Lisp_Object keys; + (keys, prefix) + Lisp_Object keys, prefix; { int len = 0; int i, i_byte; - Lisp_Object sep; - Lisp_Object *args = NULL; + Lisp_Object *args; + int size = Flength (keys); + Lisp_Object list; + Lisp_Object sep = build_string (" "); + Lisp_Object key; + int add_meta = 0; - if (STRINGP (keys)) + if (!NILP (prefix)) + size += Flength (prefix); + + /* This has one extra element at the end that we don't pass to Fconcat. */ + args = (Lisp_Object *) alloca (size * 4 * sizeof (Lisp_Object)); + + /* In effect, this computes + (mapconcat 'single-key-description keys " ") + but we shouldn't use mapconcat because it can do GC. */ + + next_list: + if (!NILP (prefix)) + list = prefix, prefix = Qnil; + else if (!NILP (keys)) + list = keys, keys = Qnil; + else { - Lisp_Object vector; - vector = Fmake_vector (Flength (keys), Qnil); - for (i = 0, i_byte = 0; i < SCHARS (keys); ) + if (add_meta) + { + args[len] = Fsingle_key_description (meta_prefix_char, Qnil); + len += 2; + } + else if (len == 0) + return empty_string; + return Fconcat (len - 1, args); + } + + if (STRINGP (list)) + size = SCHARS (list); + else if (VECTORP (list)) + size = XVECTOR (list)->size; + else if (CONSP (list)) + size = Flength (list); + else + wrong_type_argument (Qarrayp, list); + + i = i_byte = 0; + + while (i < size) + { + if (STRINGP (list)) { int c; - int i_before = i; - - FETCH_STRING_CHAR_ADVANCE (c, keys, i, i_byte); + FETCH_STRING_CHAR_ADVANCE (c, list, i, i_byte); if (SINGLE_BYTE_CHAR_P (c) && (c & 0200)) c ^= 0200 | meta_modifier; - XSETFASTINT (AREF (vector, i_before), c); + XSETFASTINT (key, c); } - keys = vector; - } - - if (VECTORP (keys)) - { - /* In effect, this computes - (mapconcat 'single-key-description keys " ") - but we shouldn't use mapconcat because it can do GC. */ - - len = XVECTOR (keys)->size; - sep = build_string (" "); - /* This has one extra element at the end that we don't pass to Fconcat. */ - args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object)); - - for (i = 0; i < len; i++) + else if (VECTORP (list)) { - args[i * 2] = Fsingle_key_description (AREF (keys, i), Qnil); - args[i * 2 + 1] = sep; + key = AREF (list, i++); } - } - else if (CONSP (keys)) - { - /* In effect, this computes - (mapconcat 'single-key-description keys " ") - but we shouldn't use mapconcat because it can do GC. */ - - len = XFASTINT (Flength (keys)); - sep = build_string (" "); - /* This has one extra element at the end that we don't pass to Fconcat. */ - args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object)); - - for (i = 0; i < len; i++) + else { - args[i * 2] = Fsingle_key_description (XCAR (keys), Qnil); - args[i * 2 + 1] = sep; - keys = XCDR (keys); + key = XCAR (list); + list = XCDR (list); + i++; } - } - else - keys = wrong_type_argument (Qarrayp, keys); - if (len == 0) - return empty_string; - return Fconcat (len * 2 - 1, args); + if (add_meta) + { + if (!INTEGERP (key) + || EQ (key, meta_prefix_char) + || (XINT (key) & meta_modifier)) + { + args[len++] = Fsingle_key_description (meta_prefix_char, Qnil); + args[len++] = sep; + if (EQ (key, meta_prefix_char)) + continue; + } + else + XSETINT (key, (XINT (key) | meta_modifier) & ~0x80); + add_meta = 0; + } + else if (EQ (key, meta_prefix_char)) + { + add_meta = 1; + continue; + } + args[len++] = Fsingle_key_description (key, Qnil); + args[len++] = sep; + } + goto next_list; } + char * push_key_description (c, p, force_multibyte) register unsigned int c; @@ -2938,7 +2972,7 @@ key binding\n\ if (!NILP (prefix)) { insert_string (" Starting With "); - insert1 (Fkey_description (prefix)); + insert1 (Fkey_description (prefix, Qnil)); } insert_string (":\n"); } @@ -3063,7 +3097,7 @@ describe_translation (definition, args) } else if (STRINGP (definition) || VECTORP (definition)) { - insert1 (Fkey_description (definition)); + insert1 (Fkey_description (definition, Qnil)); insert_string ("\n"); } else if (KEYMAPP (definition)) @@ -3073,20 +3107,19 @@ describe_translation (definition, args) } /* Describe the contents of map MAP, assuming that this map itself is - reached by the sequence of prefix keys KEYS (a string or vector). + reached by the sequence of prefix keys PREFIX (a string or vector). PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */ static void -describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) +describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu) register Lisp_Object map; - Lisp_Object keys; + Lisp_Object prefix; void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); int partial; Lisp_Object shadow; Lisp_Object *seen; int nomenu; { - Lisp_Object elt_prefix; Lisp_Object tail, definition, event; Lisp_Object tem; Lisp_Object suppress; @@ -3096,15 +3129,6 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) suppress = Qnil; - if (!NILP (keys) && XFASTINT (Flength (keys)) > 0) - { - /* Call Fkey_description first, to avoid GC bug for the other string. */ - tem = Fkey_description (keys); - elt_prefix = concat2 (tem, build_string (" ")); - } - else - elt_prefix = Qnil; - if (partial) suppress = intern ("suppress-keymap"); @@ -3114,7 +3138,7 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) kludge = Fmake_vector (make_number (1), Qnil); definition = Qnil; - GCPRO3 (elt_prefix, definition, kludge); + GCPRO3 (prefix, definition, kludge); for (tail = map; CONSP (tail); tail = XCDR (tail)) { @@ -3123,13 +3147,13 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) if (VECTORP (XCAR (tail)) || CHAR_TABLE_P (XCAR (tail))) describe_vector (XCAR (tail), - elt_prefix, Qnil, elt_describer, partial, shadow, map, - (int *)0, 0); + prefix, Qnil, elt_describer, partial, shadow, map, + (int *)0, 0, 1); else if (CONSP (XCAR (tail))) { event = XCAR (XCAR (tail)); - /* Ignore bindings whose "keys" are not really valid events. + /* Ignore bindings whose "prefix" are not really valid events. (We get these in the frames and buffers menu.) */ if (!(SYMBOLP (event) || INTEGERP (event))) continue; @@ -3168,11 +3192,8 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) first = 0; } - if (!NILP (elt_prefix)) - insert1 (elt_prefix); - /* THIS gets the string to describe the character EVENT. */ - insert1 (Fsingle_key_description (event, Qnil)); + insert1 (Fkey_description (kludge, prefix)); /* Print a description of the definition of this character. elt_describer will take care of spacing out far enough @@ -3185,9 +3206,9 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) using an inherited keymap. So skip anything we've already encountered. */ tem = Fassq (tail, *seen); - if (CONSP (tem) && !NILP (Fequal (XCAR (tem), keys))) + if (CONSP (tem) && !NILP (Fequal (XCAR (tem), prefix))) break; - *seen = Fcons (Fcons (tail, keys), *seen); + *seen = Fcons (Fcons (tail, prefix), *seen); } } @@ -3215,7 +3236,7 @@ This is text showing the elements of vector matched against indices. */) specbind (Qstandard_output, Fcurrent_buffer ()); CHECK_VECTOR_OR_CHAR_TABLE (vector); describe_vector (vector, Qnil, describer, describe_vector_princ, 0, - Qnil, Qnil, (int *)0, 0); + Qnil, Qnil, (int *)0, 0, 0); return unbind_to (count, Qnil); } @@ -3250,28 +3271,32 @@ This is text showing the elements of vector matched against indices. */) indices at higher levels in this char-table, and CHAR_TABLE_DEPTH says how many levels down we have gone. + KEYMAP_P is 1 if vector is known to be a keymap, so map ESC to M-. + ARGS is simply passed as the second argument to ELT_DESCRIBER. */ -void -describe_vector (vector, elt_prefix, args, elt_describer, +static void +describe_vector (vector, prefix, args, elt_describer, partial, shadow, entire_map, - indices, char_table_depth) + indices, char_table_depth, keymap_p) register Lisp_Object vector; - Lisp_Object elt_prefix, args; + Lisp_Object prefix, args; void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); int partial; Lisp_Object shadow; Lisp_Object entire_map; int *indices; int char_table_depth; + int keymap_p; { Lisp_Object definition; Lisp_Object tem2; + Lisp_Object elt_prefix = Qnil; register int i; Lisp_Object suppress; Lisp_Object kludge; int first = 1; - struct gcpro gcpro1, gcpro2, gcpro3; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; /* Range of elements to be handled. */ int from, to; /* A flag to tell if a leaf in this level of char-table is not a @@ -3287,11 +3312,23 @@ describe_vector (vector, elt_prefix, args, elt_describer, definition = Qnil; + if (!keymap_p) + { + /* Call Fkey_description first, to avoid GC bug for the other string. */ + if (!NILP (prefix) && XFASTINT (Flength (prefix)) > 0) + { + Lisp_Object tem; + tem = Fkey_description (prefix, Qnil); + elt_prefix = concat2 (tem, build_string (" ")); + } + prefix = Qnil; + } + /* This vector gets used to present single keys to Flookup_key. Since that is done once per vector element, we don't want to cons up a fresh vector every time. */ kludge = Fmake_vector (make_number (1), Qnil); - GCPRO3 (elt_prefix, definition, kludge); + GCPRO4 (elt_prefix, prefix, definition, kludge); if (partial) suppress = intern ("suppress-keymap"); @@ -3384,12 +3421,13 @@ describe_vector (vector, elt_prefix, args, elt_describer, else character = i; + ASET (kludge, 0, make_number (character)); + /* If this binding is shadowed by some other map, ignore it. */ if (!NILP (shadow) && complete_char) { Lisp_Object tem; - ASET (kludge, 0, make_number (character)); tem = shadow_lookup (shadow, kludge, Qt); if (!NILP (tem)) continue; @@ -3401,7 +3439,6 @@ describe_vector (vector, elt_prefix, args, elt_describer, { Lisp_Object tem; - ASET (kludge, 0, make_number (character)); tem = Flookup_key (entire_map, kludge, Qt); if (!EQ (tem, definition)) @@ -3442,7 +3479,7 @@ describe_vector (vector, elt_prefix, args, elt_describer, else if (CHAR_TABLE_P (vector)) { if (complete_char) - insert1 (Fsingle_key_description (make_number (character), Qnil)); + insert1 (Fkey_description (kludge, prefix)); else { /* Print the information for this character set. */ @@ -3458,7 +3495,7 @@ describe_vector (vector, elt_prefix, args, elt_describer, } else { - insert1 (Fsingle_key_description (make_number (character), Qnil)); + insert1 (Fkey_description (kludge, prefix)); } /* If we find a sub char-table within a char-table, @@ -3467,9 +3504,9 @@ describe_vector (vector, elt_prefix, args, elt_describer, if (CHAR_TABLE_P (vector) && SUB_CHAR_TABLE_P (definition)) { insert ("\n", 1); - describe_vector (definition, elt_prefix, args, elt_describer, + describe_vector (definition, prefix, args, elt_describer, partial, shadow, entire_map, - indices, char_table_depth + 1); + indices, char_table_depth + 1, keymap_p); continue; } @@ -3507,6 +3544,8 @@ describe_vector (vector, elt_prefix, args, elt_describer, { insert (" .. ", 4); + ASET (kludge, 0, make_number (i)); + if (!NILP (elt_prefix)) insert1 (elt_prefix); @@ -3514,7 +3553,7 @@ describe_vector (vector, elt_prefix, args, elt_describer, { if (char_table_depth == 0) { - insert1 (Fsingle_key_description (make_number (i), Qnil)); + insert1 (Fkey_description (kludge, prefix)); } else if (complete_char) { @@ -3533,7 +3572,7 @@ describe_vector (vector, elt_prefix, args, elt_describer, } else { - insert1 (Fsingle_key_description (make_number (i), Qnil)); + insert1 (Fkey_description (kludge, prefix)); } } diff --git a/src/keymap.h b/src/keymap.h index 2a34061593f..214ba605c76 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -30,15 +30,12 @@ EXFUN (Fdefine_key, 3); EXFUN (Flookup_key, 3); EXFUN (Fcommand_remapping, 1); EXFUN (Fkey_binding, 3); -EXFUN (Fkey_description, 1); +EXFUN (Fkey_description, 2); EXFUN (Fsingle_key_description, 2); EXFUN (Fwhere_is_internal, 5); extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); extern Lisp_Object get_keymap P_ ((Lisp_Object, int, int)); -extern void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object, - void (*) (Lisp_Object, Lisp_Object), int, - Lisp_Object, Lisp_Object, int *, int)); extern void describe_map_tree P_ ((Lisp_Object, int, Lisp_Object, Lisp_Object, char *, int, int, int)); extern int current_minor_maps P_ ((Lisp_Object **, Lisp_Object **)); diff --git a/src/xdisp.c b/src/xdisp.c index 16bdf7a8768..3c144f4f5f4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9424,7 +9424,7 @@ update_overlay_arrows (up_to_date) if (!SYMBOLP (var)) continue; - if (up_to_date) + if (up_to_date > 0) { Lisp_Object val = find_symbol_value (var); Fput (var, Qlast_arrow_position, @@ -10875,6 +10875,12 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, else this_scroll_margin = 0; + /* Force scroll_conservatively to have a reasonable value so it doesn't + cause an overflow while computing how much to scroll. */ + if (scroll_conservatively) + scroll_conservatively = min (scroll_conservatively, + MOST_POSITIVE_FIXNUM / FRAME_LINE_HEIGHT (f)); + /* Compute how much we should try to scroll maximally to bring point into view. */ if (scroll_step || scroll_conservatively || temp_scroll_step)