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 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

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 16:03 Searching for lines longer than x characters possible? 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
  -- strict thread matches above, loose matches on Subject: below --
2002-11-08 18:50 Bingham, Jay

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.