From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#19362: 25.0.50; Fix `pp.el' in line with new `elisp-mode.el' Date: Wed, 06 Jul 2016 20:26:49 -0400 Message-ID: <87bn2acmye.fsf@users.sourceforge.net> References: <7cb215b9-a70d-472a-ba85-15a9bc613a5e@default> <87h9ejkqqs.fsf@gnus.org> <3fe660b7-2b95-4e4a-a2c6-f03c751135d8@default> <87eg9nf0vu.fsf@gnus.org> <7a1d1091-78cc-4e88-b2d4-95d36e641ee5@default> <87poqyi05f.fsf@gmail.com> <126bba1e-3f86-4ae3-b7b5-59532f62e4f6@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1467851252 16863 80.91.229.3 (7 Jul 2016 00:27:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Jul 2016 00:27:32 +0000 (UTC) Cc: Lars Ingebrigtsen , 19362@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 07 02:27:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bKx9z-0005U1-MG for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Jul 2016 02:27:19 +0200 Original-Received: from localhost ([::1]:36499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKx9y-0006Hd-Pp for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Jul 2016 20:27:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKx9n-0006De-AT for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 20:27:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKx9i-0000Vx-Ve for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 20:27:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKx9i-0000Vp-RM for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 20:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bKx9i-0006Ua-FC for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2016 20:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Jul 2016 00:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 19362-submit@debbugs.gnu.org id=B19362.146785121024934 (code B ref 19362); Thu, 07 Jul 2016 00:27:02 +0000 Original-Received: (at 19362) by debbugs.gnu.org; 7 Jul 2016 00:26:50 +0000 Original-Received: from localhost ([127.0.0.1]:40040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKx9V-0006U1-VV for submit@debbugs.gnu.org; Wed, 06 Jul 2016 20:26:50 -0400 Original-Received: from mail-it0-f41.google.com ([209.85.214.41]:37960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKx9S-0006Ti-Vy; Wed, 06 Jul 2016 20:26:47 -0400 Original-Received: by mail-it0-f41.google.com with SMTP id h190so9041353ith.1; Wed, 06 Jul 2016 17:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=/mIR2JOO2U93ajQZF3evH6vRCWhi4oo2Iz03A/5RbLA=; b=LGrLfbXabp3z07D8bXx7hX5Lc9bRjDxoozI0Dfeypz6ZybyRLBK7aUpiyv0bUPE08H Lc5DCZqmdUpXBsqo6zvGwQu+wQmNJAZGhRX7x1pZMqa/G2x07h2JT7iQ6lSzleTGAq1g J7HERS04o55JJUqCUJooD/MtDjx/2bdiYDzgPm2CooATJXJ0i50nSxp2ebxDZ5INBxpj VY4vGOLFHBZbP9cjXkHigOQ3/3bswzbtxuxRMT0Aft1ikZA9AJl+Odeb+qCU4oJyKHJn oT/1gcixxiQfbbfB9XBnUyqhfd6gPGOHuEIZIQFWA7iJ9b0jkhChxGJFSv20JmS+fFp2 wpqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=/mIR2JOO2U93ajQZF3evH6vRCWhi4oo2Iz03A/5RbLA=; b=FuATsNqCHaIT4Ih+u0cL2LBYn3D8VHJwl4naiDlF4cZTNxUxtK+AaMdAeyNvBEelRR wmqHl6nwcchQWLoV4cD9YmRDGGToJuaRhzLghjOfz/vaTIyjAT7EsVJXjrk8Q2cT8Rl7 RxhMRykhCEXrRU5fAVN1EV5+YWM2M60ij88ZCnGdDdU1f3Wj97nh6aetB6t8DJrYn3gZ ipEE++7M4Ce7L591T9Mry9I1Sh+VW0Epnq6FWbo2j+oP2EYCCCrfyUmo7TMtHHoWVK7Y T0pXBg19nkq8aLSFyHG22U95SN1XGHUkw4KcwVX9InAP/KeekZhA4edP9sMjAhUNts/X kn4w== X-Gm-Message-State: ALyK8tLTjBdPwl21u8vdBKH/I3Q27jqgNR0ippLyz3aUyJv/7RohYhvQDwIPh4pwEU8lbw== X-Received: by 10.36.227.68 with SMTP id d65mr21886380ith.75.1467851201525; Wed, 06 Jul 2016 17:26:41 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id d71sm79240ith.2.2016.07.06.17.26.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 17:26:40 -0700 (PDT) In-Reply-To: <126bba1e-3f86-4ae3-b7b5-59532f62e4f6@default> (Drew Adams's message of "Wed, 6 Jul 2016 23:51:47 +0000 (UTC)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120546 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tags 19362 notabug close 19362 quit Drew Adams writes: > > Sorry, but I have no more time to devote to this. I pointed to a > time where the code was more or less the same between the two, and > to a time where it had been changed to be really quite different. Well, we could have all saved some time if you had taken your own advice to diff the code; not pp.el vs elisp-mode.el, but emacs-24.5's lisp-mode.el vs the new elisp-mode.el. You can see in the attached diff (exerpted to leave only the relevant functions) that the only changes are renaming of functions, and some minor refactoring in elisp--preceding-sexp (it now handles =E2=80=98foo=E2=80=99 as well as `foo= '). --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=elisp-lisp-mode.diff Content-Transfer-Encoding: quoted-printable Content-Description: diff excerpts --- /home/npostavs/src/emacs/emacs-24.5/lisp/emacs-lisp/lisp-mode.el 2016-0= 5-21 14:56:43.119505998 -0400 +++ /home/npostavs/src/emacs/emacs-25/lisp/progmodes/elisp-mode.el 2016-06-= 27 00:32:51.740892449 -0400 @@ -879,14 +970,14 @@ =20 =20 (defun last-sexp-setup-props (beg end value alt1 alt2) - "Set up text properties for the output of `eval-last-sexp-1'. + "Set up text properties for the output of `elisp--eval-last-sexp'. BEG and END are the start and end of the output in current-buffer. VALUE is the Lisp value printed, ALT1 and ALT2 are strings for the alternative printed representations that can be displayed." (let ((map (make-sparse-keymap))) - (define-key map "\C-m" 'last-sexp-toggle-display) + (define-key map "\C-m" 'elisp-last-sexp-toggle-display) (define-key map [down-mouse-2] 'mouse-set-point) - (define-key map [mouse-2] 'last-sexp-toggle-display) + (define-key map [mouse-2] 'elisp-last-sexp-toggle-display) (add-text-properties beg end `(printed-value (,value ,alt1 ,alt2) @@ -897,7 +988,7 @@ printed-value))))) =20 =20 -(defun last-sexp-toggle-display (&optional _arg) +(defun elisp-last-sexp-toggle-display (&optional _arg) "Toggle between abbreviated and unabbreviated printed representations." (interactive "P") (save-restriction @@ -920,7 +1011,7 @@ (nth 1 value)) (goto-char (min (point-max) point))))))) =20 -(defun prin1-char (char) +(defun prin1-char (char) ;FIXME: Move it, e.g. to simple.el. "Return a string representing CHAR as a character rather than as an inte= ger. If CHAR is not a character, return nil." (and (integerp char) @@ -956,19 +1047,20 @@ (=3D (car (read-from-string string)) char) string)))) =20 - -(defun preceding-sexp () +(defun elisp--preceding-sexp () "Return sexp before the point." (let ((opoint (point)) - ignore-quotes + (left-quote ?=E2=80=98) expr) (save-excursion (with-syntax-table emacs-lisp-mode-syntax-table - ;; If this sexp appears to be enclosed in `...' + ;; If this sexp appears to be enclosed in `...' or =E2=80=98...=E2=80=99 ;; then ignore the surrounding quotes. - (setq ignore-quotes - (or (eq (following-char) ?\') - (eq (preceding-char) ?\'))) + (cond ((eq (preceding-char) ?=E2=80=99) + (progn (forward-char -1) (setq opoint (point)))) + ((or (eq (following-char) ?\') + (eq (preceding-char) ?\')) + (setq left-quote ?\`))) (forward-sexp -1) ;; If we were after `?\e' (or similar case), ;; use the whole thing, not just the `e'. @@ -992,43 +1084,37 @@ (forward-sexp -1)))) =20 (save-restriction - ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in - ;; `variable' so that the value is returned, not the - ;; name - (if (and ignore-quotes - (eq (following-char) ?`)) + (if (eq (following-char) left-quote) + ;; vladimir@cs.ualberta.ca 30-Jul-1997: Skip ` in `variable'= so + ;; that the value is returned, not the name. (forward-char)) + (when (looking-at ",@?") (goto-char (match-end 0))) (narrow-to-region (point-min) opoint) (setq expr (read (current-buffer))) - ;; If it's an (interactive ...) form, it's more - ;; useful to show how an interactive call would - ;; use it. - (and (consp expr) - (eq (car expr) 'interactive) + ;; If it's an (interactive ...) form, it's more useful to show h= ow an + ;; interactive call would use it. + ;; FIXME: Is it really the right place for this? + (when (eq (car-safe expr) 'interactive) (setq expr - (list 'call-interactively - (list 'quote - (list 'lambda - '(&rest args) - expr - 'args))))) + `(call-interactively + (lambda (&rest args) ,expr args)))) expr))))) +(define-obsolete-function-alias 'preceding-sexp 'elisp--preceding-sexp "25= .1") =20 - -(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) +(defun elisp--eval-last-sexp (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area. -With argument, print output into current buffer. -With a zero prefix arg, print output with no limit on the length -and level of lists, and include additional formats for integers -\(octal, hexadecimal, and character)." +If EVAL-LAST-SEXP-ARG-INTERNAL is non-nil, print output into +current buffer. If EVAL-LAST-SEXP-ARG-INTERNAL is `0', print +output with no limit on the length and level of lists, and +include additional formats for integers \(octal, hexadecimal, and +character)." (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) = t))) ;; Setup the lexical environment if lexical-binding is enabled. - (eval-last-sexp-print-value - (eval (eval-sexp-add-defvars (preceding-sexp)) lexical-binding) + (elisp--eval-last-sexp-print-value + (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding) eval-last-sexp-arg-internal))) =20 - -(defun eval-last-sexp-print-value (value &optional eval-last-sexp-arg-inte= rnal) +(defun elisp--eval-last-sexp-print-value (value &optional eval-last-sexp-a= rg-internal) (let ((unabbreviated (let ((print-length nil) (print-level nil)) (prin1-to-string value))) (print-length (and (not (zerop (prefix-numeric-value @@ -1055,7 +1141,7 @@ )))) =20 =20 -(defvar eval-last-sexp-fake-value (make-symbol "t")) +(defvar elisp--eval-last-sexp-fake-value (make-symbol "t")) =20 (defun eval-sexp-add-defvars (exp &optional pos) "Prepend EXP with all the `defvar's that precede it in the buffer. @@ -1092,16 +1178,16 @@ this command arranges for all errors to enter the debugger." (interactive "P") (if (null eval-expression-debug-on-error) - (eval-last-sexp-1 eval-last-sexp-arg-internal) + (elisp--eval-last-sexp eval-last-sexp-arg-internal) (let ((value - (let ((debug-on-error eval-last-sexp-fake-value)) - (cons (eval-last-sexp-1 eval-last-sexp-arg-internal) + (let ((debug-on-error elisp--eval-last-sexp-fake-value)) + (cons (elisp--eval-last-sexp eval-last-sexp-arg-internal) debug-on-error)))) - (unless (eq (cdr value) eval-last-sexp-fake-value) + (unless (eq (cdr value) elisp--eval-last-sexp-fake-value) (setq debug-on-error (cdr value))) (car value)))) =20 -(defun eval-defun-1 (form) +(defun elisp--eval-defun-1 (form) "Treat some expressions specially. Reset the `defvar' and `defcustom' variables to the initial value. \(For `defcustom', use the :set function if there is one.) @@ -1144,17 +1230,17 @@ (put face-symbol 'face-override-spec nil)) form) ((eq (car form) 'progn) - (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) + (cons 'progn (mapcar #'elisp--eval-defun-1 (cdr form)))) (t form))) =20 -(defun eval-defun-2 () +(defun elisp--eval-defun () "Evaluate defun that point is in or before. The value is displayed in the echo area. If the current defun is actually a call to `defvar', then reset the variable using the initial value expression even if the variable already has some other value. \(Normally `defvar' does not change the variable's value -if it already has a value.\) +if it already has a value.) =20 Return the result of evaluation." ;; FIXME: the print-length/level bindings should only be applied while @@ -1177,7 +1263,7 @@ (setq end (point))) ;; Alter the form if necessary. (let ((form (eval-sexp-add-defvars - (eval-defun-1 (macroexpand form))))) + (elisp--eval-defun-1 (macroexpand form))))) (eval-region beg end standard-output (lambda (_ignore) ;; Skipping to the end of the specified region @@ -1220,563 +1306,269 @@ (eval-defun (not edebug-all-defs))) (t (if (null eval-expression-debug-on-error) - (eval-defun-2) - (let ((old-value (make-symbol "t")) new-value value) - (let ((debug-on-error old-value)) - (setq value (eval-defun-2)) + (elisp--eval-defun) + (let (new-value value) + (let ((debug-on-error elisp--eval-last-sexp-fake-value)) + (setq value (elisp--eval-defun)) (setq new-value debug-on-error)) - (unless (eq old-value new-value) + (unless (eq elisp--eval-last-sexp-fake-value new-value) (setq debug-on-error new-value)) value))))) =20 -;; May still be used by some external Lisp-mode variant. -(define-obsolete-function-alias 'lisp-comment-indent - 'comment-indent-default "22.1") -(define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1") +;;; ElDoc Support --=-=-=--