Отключить автоматическое заполнение-режим локально (или заполнить параграф ООН) с Emacs
Вопрос
Я использую MQ для заполнения в заполнении, могу ли я сделать абзац не заполнить в режиме автозаполнения?
С режимом ORG я иногда вводю [Очень длинный HTML] [имя с пробелами], И для «имени пробелов» режим автоматического заполнения разбивает всю линию на основе вставленного пространства, что делает его очень уродливым.
Есть ли команда что-то вроде абзаквана en-Fill? Или есть ли способ временно отключить автозаполнение временно / локально?
Решение
Emacs не записывает, какова была ваша линия перед вызовом fill-paragraph
. Отказ Так что единственное, что вы можете сделать, это C-_ который запускает команду отменить. Это может отменить свой fill-paragraph
Команда, но только если это предыдущий звонок команд.
Если вы хотите поставить многострочный абзац на одну строку, вы можете поделать это:
- Выберите регион
- СМ-% CQ CJ. Рентген ПРОСТРАНСТВО Рентген !
Другие советы
Xah Lee обновила свой код с монотусящего ответа, и я несколько некорризовал для чтения:
(defun my-toggle-fill-paragraph ()
;; Based on http://xahlee.org/emacs/modernization_fill-paragraph.html
"Fill or unfill the current paragraph, depending upon the current line length.
When there is a text selection, act on the region.
See `fill-paragraph' and `fill-region'."
(interactive)
;; We set a property 'currently-filled-p on this command's symbol
;; (i.e. on 'my-toggle-fill-paragraph), thus avoiding the need to
;; create a variable for remembering the current fill state.
(save-excursion
(let* ((deactivate-mark nil)
(line-length (- (line-end-position) (line-beginning-position)))
(currently-filled (if (eq last-command this-command)
(get this-command 'currently-filled-p)
(< line-length fill-column)))
(fill-column (if currently-filled
most-positive-fixnum
fill-column)))
(if (region-active-p)
(fill-region (region-beginning) (region-end))
(fill-paragraph))
(put this-command 'currently-filled-p (not currently-filled)))))
Чтобы переделать длинную строку из абзаца в режиме ORG, я дал себе новую команду. Вот связанный код LISC EMACS:
(defun fp-unfill-paragraph (&optional justify region)
(interactive (progn
(barf-if-buffer-read-only)
(list (if current-prefix-arg 'full) t)))
(interactive)
(let ((fill-column 100000))
(fill-paragraph justify region)))
(global-set-key "\C-ceu" 'fp-unfill-paragraph)
Конечно, вы настраиваете команду Keybinding, как видите в форме!
Я использую следующий фрагмент для заполнения и необъяснимых абзац (используя только M-q
), это действительно, действительно удобно. Я одолжил его от Xah Lee, но удалил некоторые комментарии и пробелы, чтобы заставить его вписаться здесь. Ссылка в первом комментарии идет к его первоначальному коду.
;; http://xahlee.org/emacs/modernization_fill-paragraph.html
(defun compact-uncompact-block ()
"Remove or add line endings on the current block of text.
This is similar to a toggle for fill-paragraph and unfill-paragraph
When there is a text selection, act on the region.
When in text mode, a paragraph is considered a block. When in programing
language mode, the block defined by between empty lines.
Todo: The programing language behavior is currently not done.
Right now, the code uses fill* functions, so does not work or work well
in programing lang modes. A proper implementation to compact is replacing
newline chars by space when the newline char is not inside string.
"
(interactive)
(let (bds currentLineCharCount currentStateIsCompact
(bigFillColumnVal 4333999) (deactivate-mark nil))
(save-excursion
(setq currentLineCharCount
(progn
(setq bds (bounds-of-thing-at-point 'line))
(length (buffer-substring-no-properties (car bds) (cdr bds)))))
(setq currentStateIsCompact
(if (eq last-command this-command)
(get this-command 'stateIsCompact-p)
(if (> currentLineCharCount fill-column) t nil)))
(if (and transient-mark-mode mark-active)
(if currentStateIsCompact
(fill-region (region-beginning) (region-end))
(let ((fill-column bigFillColumnVal))
(fill-region (region-beginning) (region-end)))
)
(if currentStateIsCompact
(fill-paragraph nil)
(let ((fill-column bigFillColumnVal))
(fill-paragraph nil))))
(put this-command 'stateIsCompact-p
(if currentStateIsCompact
nil t)))))
(global-set-key (kbd "M-q") 'compact-uncompact-block)