Questions tagged [lines]

11 questions
15
votes
2 answers

How to count the number of lines in the region?

Is there a command similar to count-words-region to count the total number of lines of a selected region?
Name
  • 7,689
  • 4
  • 38
  • 84
3
votes
3 answers

Delete duplicate lines, with partial match

Sample text: This is first line.a This is over_second line. This is over_fourth line. This is third line. This is over_fourth delete it. This is over_fourth and one more. This is over_second with another text. Need to delete lines where partial…
msinfo
  • 177
  • 1
  • 6
2
votes
1 answer

Unrestricted movement of lines Alt-Up/Down

I'm learning Orgmode and moving lines (headers, checkbox items) up and down. These movement are restrited to a tree part of the line (header section, checkbox list): * Here is a list - Item 1 - Item 2 - Item 3 - Alt-down stops here * Another…
Evgeny
  • 133
  • 7
1
vote
1 answer

What is the default value of TRY-VSCROLL in `(previous-line &optional ARG TRY-VSCROLL)`?

The documentation shown with Ctrl h k up states: runs the command previous-line (found in global-map), which is an interactive byte-compiled Lisp function in ‘simple.el’. It is bound to C-p and . (previous-line &optional ARG…
Claudio
  • 410
  • 2
  • 11
1
vote
1 answer

delete backwards until indentation

In my config I have (bind-keys* ("C-" . (lambda () (interactive) (kill-line 0)))) which deletes the entire line backwards until column position 0. I would like to only delete backwards until the indentation. How do I have to change…
CD86
  • 543
  • 2
  • 9
1
vote
3 answers

Show only one or two lines of a buffer

I need to check numbers in a buffer each on a line against an external paper sheet To make this easier I would like to make the window very narrow to see only one (or max. two) lines. However shrink-window stops at three lines. Any way to overcome…
halloleo
  • 1,215
  • 9
  • 23
0
votes
1 answer

Count unhidden lines from hide-lines?

I want to count the number of lines shown with hide-lines-matching. count-lines seems to return the wrong number. (length hide-lines-invisible-areas) seems to be related in that we hide the regions between the lines.
Att Righ
  • 725
  • 4
  • 14
0
votes
1 answer

Undo one specific line in a text file within Emacs

Usually when doing the normal undo it will undo all code changes since you went into insert-mode (for me it's evil-undo). I was wondering if it were possible to implement a function that will only undo the line your cursor is currently hovering over…
0
votes
2 answers

Sorting lines based on numbers in unicode

I want to sort some text in emacs that is based on a field that contains verse numbers in unicode (devanagari). The text is like this: Verse text bla १०.३ #10.3 Verse text blah This is १.१९ #1.19 Verse text ble १०.१३ #10.13 Verse text bleh ६.२७…
linuxfan
  • 199
  • 7
0
votes
1 answer

How to get line number for a given buffer position in a performant way?

I have list of buffer positions and I want to get the numbers of the lines at those positions. Is there a better way to do that then using with-current-buffer, goto-point and get-thing-at-point 'line? I want the code to be as fast as possible.
jm4562
  • 89
  • 2
0
votes
1 answer

Is arbitrary buffer position at the beginning of a line?

What's the simplest way to check whether a given point value p is at the beginning of some line or not? Is there anything simpler than (save-excursion (goto-char p) (= p (point-at-bol))) or (member (char-before p) '(nil \n))?
Lassi
  • 377
  • 1
  • 7