all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Searching for lines longer than x characters possible?
@ 2002-11-08 16:03 David List
  2002-11-08 16:52 ` Barry Margolin
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: David List @ 2002-11-08 16:03 UTC (permalink / raw)


I would like to go through some program source files before converting them 
to ps, to check for lines longer than, for instance, 80 characters, so that 
I don't get strange looking ps files.

Is this possible with emacs?

-- 
Med venlig hilsen / Best regards,
David List

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Searching for lines longer than x characters possible?
  2002-11-08 16:03 David List
@ 2002-11-08 16:52 ` Barry Margolin
  2002-11-08 17:12 ` Stefan Monnier <foo@acm.com>
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Barry Margolin @ 2002-11-08 16:52 UTC (permalink / raw)


In article <h8ngqa.ppu.ln@davidlist.dk>,
David List  <david@davidlist.dk> wrote:
>I would like to go through some program source files before converting them 
>to ps, to check for lines longer than, for instance, 80 characters, so that 
>I don't get strange looking ps files.
>
>Is this possible with emacs?

M-x occur RET C-u 81 . RET

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Searching for lines longer than x characters possible?
  2002-11-08 16:03 David List
  2002-11-08 16:52 ` Barry Margolin
@ 2002-11-08 17:12 ` Stefan Monnier <foo@acm.com>
  2002-11-08 17:28 ` Alex Schroeder
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-11-08 17:12 UTC (permalink / raw)


>>>>> "David" == David List <david@davidlist.dk> writes:
> I would like to go through some program source files before converting them
> to ps, to check for lines longer than, for instance, 80 characters, so that
> I don't get strange looking ps files.

If you really mean 80chars, then C-u C-s ^.\{81\} should do the trick.
If you mean 80columns, it's trickier (unless you have no TABs or things
like that, such that it reduces to the 80chars problem).


        Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Searching for lines longer than x characters possible?
  2002-11-08 16:03 David List
  2002-11-08 16:52 ` Barry Margolin
  2002-11-08 17:12 ` Stefan Monnier <foo@acm.com>
@ 2002-11-08 17:28 ` Alex Schroeder
  2002-11-09 10:20 ` David List
  2002-11-11 11:47 ` Phillip Lord
  4 siblings, 0 replies; 8+ messages in thread
From: Alex Schroeder @ 2002-11-08 17:28 UTC (permalink / raw)


David List <david@davidlist.dk> writes:

> I would like to go through some program source files before converting them 
> to ps, to check for lines longer than, for instance, 80 characters, so that 
> I don't get strange looking ps files.
>
> Is this possible with emacs?

M-x occur RET C-u 81 . RET

Alex.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Searching for lines longer than x characters possible?
@ 2002-11-08 18:50 Bingham, Jay
  0 siblings, 0 replies; 8+ messages in thread
From: Bingham, Jay @ 2002-11-08 18:50 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]

You are talking about emacs aren't you?  Of course it is possible. :)

I looked at the other suggestions and found them lacking.  So I wrote a little function that puts the cursor (point) on the desired column of any line longer that the desired maximum column.  
Here it is:
 <<find-long-line.el>> 

Hope you enjoy it.
-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Product Assurance
.    Austin, TX
. Language is the apparel in which your thoughts parade in public.
. Never clothe them in vulgar and shoddy attire.          -Dr. George W. Crane-

 -----Original Message-----
From: 	Barry Margolin [mailto:barmar@genuity.net] 
Sent:	Friday, November 08, 2002 10:53 AM
To:	help-gnu-emacs@gnu.org
Subject:	Re: Searching for lines longer than x characters possible?

In article <h8ngqa.ppu.ln@davidlist.dk>,
David List  <david@davidlist.dk> wrote:
>I would like to go through some program source files before converting them 
>to ps, to check for lines longer than, for instance, 80 characters, so that 
>I don't get strange looking ps files.
>
>Is this possible with emacs?

M-x occur RET C-u 81 . RET

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs


[-- Attachment #2: find-long-line.el --]
[-- Type: application/octet-stream, Size: 3346 bytes --]

;;; find-long-line.el --- Find the next long line in the buffer

;;-----------------------------------------------------------------------------
;; Last Modified Time-stamp: <08Nov2002 12:44:36 CST by JCBingham>
;;-----------------------------------------------------------------------------

;; Copyright 2002 JCBingham
;;
;; Author: jay.bingham@hp.com
;; Version: $Id: find-long-line.el,v 0.01 2002/11/08 17:41:33 JCBingham Exp $
;; Keywords: find long lines
;; Requirements: tested in v21.2
;; Status: not yet part of EMACS

;; This program 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.
;;
;; This program 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 this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


;;; Commentary:

;; This package contains a function that finds the next long line in the
;; buffer and positions the cursor (point) at the maximum column desired on
;; the line.
;;
;; The interactive functions in this package are:
;;	find-long-line

;; To load this package in all your emacs sessions put this file into your 
;; load-path and put the following line (without the comment delimiter) 
;; into your ~/.emacs:
;;   (require 'find-long-line)

;; To auto-load this package in your emacs sessions (loaded only when needed)
;; put this file into your load-path and put the following lines (without the
;; comment delimiters) into your ~/.emacs:
;;   (autoload 'func-name "find-long-line"
;;  "func-desc"
;;  t nil)


;;;++ Module History ++

;; 08 Nov 2002 - JCBingham - 
;;	 Initial version containing the following -
;;	interactive functions:
;;	 find-long-line
;;	 

;;;-- Module History end --


;;; Code:

(provide 'find-long-line)

\f
;;;;##########################################################################
;;;;  Interactive Functions
;;;;##########################################################################

;;;======<Interactive Function>===============================================
;; Function: interactive-function-name
;;  Find the next long line in the current buffer.
;;
;; Psuedo code:
;;  set the default maximum column to 80
;;  if the numeric argument is a whole number greater than 0
;;    set the maximum column to the numeric argumnet
;;  endif
;;  while end of this line is not greater than the maximum column
;;    go to next line
;;  endwhile
;;  position cursor at the maximum column on this line.
;;
(defun find-long-line (max-col-arg)
  "Find the next long line in the current buffer."
  (interactive "P")
  (let ((max-col 80))
    (if (and (wholenump max-col-arg) (> max-col-arg 0))
	(setq max-col max-col-arg))
    (progn
      (while
	  (and
	   (not (end-of-line))
	   (< (current-column) max-col))
	(forward-char))
      (move-to-column max-col))))

;;; END OF find-long-line.el

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Searching for lines longer than x characters possible?
  2002-11-08 16:03 David List
                   ` (2 preceding siblings ...)
  2002-11-08 17:28 ` Alex Schroeder
@ 2002-11-09 10:20 ` David List
  2002-11-11 11:47 ` Phillip Lord
  4 siblings, 0 replies; 8+ messages in thread
From: David List @ 2002-11-09 10:20 UTC (permalink / raw)


Friday 08 November 2002 17:03, David List wrote in 
<h8ngqa.ppu.ln@davidlist.dk> to gnu.emacs.help:

> I would like to go through some program source files before converting
> them to ps, to check for lines longer than, for instance, 80 characters,
> so that I don't get strange looking ps files.
> 
> Is this possible with emacs?

Thank you very much for the answers.

-- 
Med venlig hilsen / Best regards,
David List

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Searching for lines longer than x characters possible?
  2002-11-08 16:03 David List
                   ` (3 preceding siblings ...)
  2002-11-09 10:20 ` David List
@ 2002-11-11 11:47 ` Phillip Lord
  2002-11-12 16:44   ` Lee Sau Dan
  4 siblings, 1 reply; 8+ messages in thread
From: Phillip Lord @ 2002-11-11 11:47 UTC (permalink / raw)


>>>>> "David" == David List <david@davidlist.dk> writes:

  David> I would like to go through some program source files before
  David> converting them to ps, to check for lines longer than, for
  David> instance, 80 characters, so that I don't get strange looking
  David> ps files.

  David> Is this possible with emacs?


If I can be allowed a little plug, I would suggest looking at my own
"wide-column.el" package. It doesn't do what you want, but it might
mean that you don't need to do what you want in the first place....

http://www.cs.man.ac.uk/~phillord/emacs.html

Cheers

Phil

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Searching for lines longer than x characters possible?
  2002-11-11 11:47 ` Phillip Lord
@ 2002-11-12 16:44   ` Lee Sau Dan
  0 siblings, 0 replies; 8+ messages in thread
From: Lee Sau Dan @ 2002-11-12 16:44 UTC (permalink / raw)


>>>>> "Phillip" == Phillip Lord <p.lord@russet.org.uk> writes:

>>>>> "David" == David List <david@davidlist.dk> writes:
    David> I would like to go through some program source files before
    David> converting them to ps, to check for lines longer than, for
    David> instance, 80 characters, so that I don't get strange
    David> looking ps files.

    David> Is this possible with emacs?

Doesn't 'grep' do this already?
        grep '.\{80\}' ~/archive/viag.tex

Use the "-l" flag if you only want the filenames, not file contents.
Moreover, you can invoke grep from within Emacs: M-x grep


-- 
Lee Sau Dan                     李守敦(Big5)                    ~{@nJX6X~}(HZ) 

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-11-12 16:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-08 18:50 Searching for lines longer than x characters possible? Bingham, Jay
  -- strict thread matches above, loose matches on Subject: below --
2002-11-08 16:03 David List
2002-11-08 16:52 ` Barry Margolin
2002-11-08 17:12 ` Stefan Monnier <foo@acm.com>
2002-11-08 17:28 ` Alex Schroeder
2002-11-09 10:20 ` David List
2002-11-11 11:47 ` Phillip Lord
2002-11-12 16:44   ` Lee Sau Dan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.