1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-27 10:54:40 +00:00
Commit Graph

4439 Commits

Author SHA1 Message Date
Lars Ingebrigtsen
ae56c9674b Make combinations of :width/:max-height image specs work reliably
* doc/lispref/display.texi (ImageMagick Images): Document
:width/:max-height combinations (etc) (bug #25583).

* src/image.c (compute_image_size): Handle :width/:max-height
(etc) combinations consistently (by letting "max" win and
preserve ratio).

* test/manual/image-size-tests.el (image-size-tests): Add
tests for :width/:max-height (etc) combinations.
2017-07-15 02:48:17 +02:00
Ted Zlatanov
583995c62d
GnuTLS HMAC and symmetric cipher support
* etc/NEWS: Add news for new feature.

    * doc/lispref/text.texi (GnuTLS Cryptography): Add
    documentation.

    * configure.ac: Add macros HAVE_GNUTLS3_DIGEST,
    HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_AEAD, HAVE_GNUTLS3_HMAC.

    * src/fns.c (Fsecure_hash_algorithms): Add function to list
    supported `secure-hash' algorithms.
    (extract_data_from_object): Add data extraction function that
    can operate on buffers and strings.
    (secure_hash): Use it.
    (Fsecure_hash): Mention `secure-hash-algorithms'.

    * src/gnutls.h: Include gnutls/crypto.h.

    * src/gnutls.c (Fgnutls_ciphers, gnutls_symmetric_aead)
    (gnutls_symmetric, Fgnutls_symmetric_encrypt, Fgnutls_symmetric_decrypt)
    (Fgnutls_macs, Fgnutls_digests, Fgnutls_hash_mac, Fgnutls_hash_digest)
    (Fgnutls_available_p): Implement GnuTLS cryptographic integration.

    * test/lisp/net/gnutls-tests.el: Add tests.
2017-07-14 11:06:16 -04:00
Paul Eggert
1e09f8d379 Do not convert ij and IJ to compatibility chars
* lisp/leim/quail/latin-alt.el: Omit lines for ij and IJ in Dutch.
Problem reported by James Cloos (Bug#518#10).
2017-07-14 06:20:44 -07:00
Toon Claes
3bdf5b2149 Remove Turkish ligatures from Dutch input method
* lisp/leim/quail/latin-alt.el: Remove Turkish ligatures (Bug#518).
2017-07-14 06:00:47 -07:00
Martin Rudalics
01a98e918d Minor tweaks of new line number display variables
* src/xdisp.c (Vdisplay_line_numbers): Tweak doc-string.
(Vdisplay_line_number_width): Rename to
Vdisplay_line_numbers_width.
(maybe_produce_line_number): Comply with above rename.
* lisp/cus-start.el (standard):
* lisp/frame.el (top-level):
* etc/NEWS: Comply with renaming of
`display-line-number-width' to `display-line-numbers-width'.
2017-07-12 17:35:31 +02:00
Nicolas Petton
0bece6c681 Add an optional testfn parameter to assoc
* src/fns.c (assoc): New optional testfn parameter used for comparison
when provided.
* test/src/fns-tests.el (test-assoc-testfn): Add tests for the new
'testfn' parameter.
* src/buffer.c:
* src/coding.c:
* src/dbusbind.c:
* src/font.c:
* src/fontset.c:
* src/gfilenotify.c:
* src/image.c:
* src/keymap.c:
* src/process.c:
* src/w32fns.c:
* src/w32font.c:
* src/w32notify.c:
* src/w32term.c:
* src/xdisp.c:
* src/xfont.c: Add a third argument to Fassoc calls.
* etc/NEWS:
* doc/lispref/lists.texi: Document the new 'testfn' parameter.
2017-07-11 10:07:16 +02:00
Eli Zaretskii
b56727e727 ; * etc/NEWS: Fix a typo. 2017-07-09 17:42:16 +03:00
Eli Zaretskii
5df239fc6f Support display of line numbers natively
This merges branch 'line-numbers'.
* src/buffer.c (disable_line_numbers_overlay_at_eob): New
function.
* src/lisp.h (disable_line_numbers_overlay_at_eob): Add prototype.
* src/dispextern.h (struct it): New members pt_lnum, lnum,
lnum_bytepos, lnum_width, and lnum_pixel_width.
* src/indent.c (line_number_display_width): New function,
refactored from line-number width calculations in vertical-motion.
(Fvertical_motion): Call line_number_display_width when the width
of line-number display is needed.
(Fline_number_display_width): New defun.
(syms_of_indent): Defsubr it.
* src/indent.c (Fvertical_motion): Help C-n/C-p estimate correctly
the width used up by line numbers by looking near the window-start
point.  If window-start is outside of the accessible portion,
temporarily widen the buffer.
* src/term.c (produce_glyphs): Adjust tab stops for the horizontal
space taken by the line-number display.
* src/xdisp.c (display_count_lines_logically)
(display_count_lines_visually, maybe_produce_line_number)
(should_produce_line_number, row_text_area_empty): New functions.
(try_window_reusing_current_matrix): Don't use this method when
display-line-numbers is in effect.
(try_window_id, try_cursor_movement): Disable these optimizations
when the line-number-current-line face is different from
line-number face and for relative line numbers.
(try_window_id, redisplay_window, try_cursor_movement): For
visual line-number display, disable the same redisplay
optimizations as for relative.
(x_produce_glyphs): Adjust tab stops for the horizontal
space taken by the line-number display.
(hscroll_window_tree): Adjust hscroll calculations to line-number
display.
(DISP_INFINITY): Renamed from INFINITY to avoid clashes with
math.h; all users changed.
(set_cursor_from_row): Fix calculation of cursor X coordinate in
R2L rows with display-produced glyphs at the beginning.
(display_line): Use should_produce_line_number to determine
whether a line number should be produced for each glyph row, and
maybe_produce_line_number to produce line numbers.
Don't display line numbers in the minibuffer and in tooltip
frames.
Call row_text_area_empty to verify that a glyph
row's text area is devoid of any glyphs that came from a buffer or
a string.  This fixes a bug with empty-lines indication
disappearing when line numbers or line-prefix are displayed.
(syms_of_xdisp) <display-line-numbers, display-line-numbers-widen>
<display-line-number-width>: New buffer-local variables.
<display-line-numbers-current-absolute>: New variable.

* lisp/cus-start.el (standard): Provide customization forms for
display-line-numbers and its sub-features.
* lisp/faces.el (line-number, line-number-current-line): New faces.
* lisp/frame.el: Add display-line-numbers, display-line-numbers-widen,
display-line-numbers-current-absolute, and
display-line-number-width to the list of variables that should
trigger redisplay of the current buffer.
* lisp/menu-bar.el (menu-bar-showhide-menu): Add menu-bar item to
turn display-line-numbers on and off.
(toggle-display-line-numbers): New function.
* lisp/simple.el (last--line-number-width): New internal variable.
(line-move-visual): Use it to adjust temporary-goal-column when
line-number display changes its width.

* doc/emacs/basic.texi (Position Info): Add cross-reference to
"Display Custom", for line-number display.
* doc/emacs/custom.texi (Init Rebinding):
* doc/emacs/modes.texi (Minor Modes): Remove references to
linum-mode.
* doc/emacs/display.texi (Display Custom): Describe the
line-number display.
* doc/lispref/display.texi (Size of Displayed Text): Document
line-number-display-width.

* etc/NEWS: Document display-line-numbers and its customizations.
2017-07-08 10:49:36 +03:00
Eli Zaretskii
4caf65d4de Fix vertical-motion across the place where line-number width changes
* src/indent.c (line_number_display_width): New function,
refactored from line-number width calculations in vertical-motion.
(Fvertical_motion): Call line_number_display_width when the width
of line-number display is needed.
(Fline_number_display_width): New defun.
(syms_of_indent): Defsubr it.

* doc/lispref/display.texi (Size of Displayed Text): Document
line-number-display-width.

* etc/NEWS: Mention line-number-display-width.

* lisp/simple.el (last--line-number-width): New internal variable.
(line-move-visual): Use it to adjust temporary-goal-column when
line-number display changes its width.
2017-07-07 12:21:10 +03:00
Noam Postavsky
e832febfb4 Allow comment-indent-functions to specify exact indentation (Bug#385)
* lisp/newcomment.el (comment-choose-indent): Interpret a cons of two
integers as indicating a range of acceptable indentation.
(comment-indent): Don't apply `comment-inline-offset',
`comment-choose-indent' already does that.
(comment-indent-function):
* doc/emacs/programs.texi (Options for Comments): Document new
acceptable return values.
* etc/NEWS: Announce it.
2017-07-05 22:52:35 -04:00
Philipp Stephani
4cd0db3d6e Use hook instead of face list to inhibit electric quoting
This is more flexible and doesn't couple electric quoting to font
locking.
Give that 'electric-quote-code-faces' was just introduced, remove it
without formal deprecation.

* lisp/electric.el (electric-quote-inhibit-functions): New abnormal
hook variable.
(electric-quote-post-self-insert-function): Run the hook.  Remove
use of old 'electric-quote-code-faces' variable.

* test/lisp/electric-tests.el (electric-quote-markdown-in-text)
(electric-quote-markdown-in-code): Adapt unit tests.
2017-07-03 20:59:31 +02:00
Ingo Lohmar
9ac7dccc51 Offer non-aligned indentation in lists in js-mode (Bug#27503)
* lisp/progmodes/js.el (js--proper-indentation):
New customization option 'js-indent-align-list-continuation'.
Affects argument lists as well as arrays and object properties.
* test/manual/indent/js-indent-align-list-continuation-nil.js:
Test the change.
2017-07-03 20:06:27 +02:00
Damien Cassou
a7754a250b Add absolute optional parameter to line-number-at-pos (Bug#26417)
* lisp/simple.el (line-number-at-pos): Add a second optional
  argument 'absolute'.
* test/list/simple-tests.el: Add tests for 'line-number-at-pos'.
2017-07-03 14:43:02 +02:00
Noam Postavsky
1b4f0a92ff Split shr-copy-url dwim behavior into separate functions (Bug#26826)
* lisp/net/shr.el (shr-url-at-point, shr-probe-url)
(shr-probe-and-copy-url, shr-maybe-probe-and-copy-url): New functions,
split out from `shr-copy-url'.
(shr-copy-url): Only copy the url, don't fetch it.
(shr-map): Bind 'w' and 'u' to `shr-maybe-probe-and-copy-url', which
has the same behavior as the old `shr-copy-url'.
* etc/NEWS: Announce changes.
2017-07-02 16:19:58 -04:00
Philipp Stephani
34d4720f83 Electric quotes: Improve support for Markdown mode (Bug#24709)
Introduce a new user option 'electric-quote-context-sensitive'.  If
non-nil, have ' insert an opening quote if sensible.

Also introduce a new variable 'electric-quote-code-faces'.  Major
modes such as 'markdown-mode' can add faces to this list to treat text
as inline code and disable electric quoting.

* lisp/electric.el (electric-quote-context-sensitive): New user
option.
(electric-quote-code-faces): New variable.
(electric-quote-post-self-insert-function): Treat ' as ` if
desired and applicable; disable electric quoting for given faces.

* test/lisp/electric-tests.el (electric-quote-opening-single)
(electric-quote-closing-single, electric-quote-opening-double)
(electric-quote-closing-double)
(electric-quote-context-sensitive-backtick)
(electric-quote-context-sensitive-bob-single)
(electric-quote-context-sensitive-bob-double)
(electric-quote-context-sensitive-bol-single)
(electric-quote-context-sensitive-bol-double)
(electric-quote-context-sensitive-after-space-single)
(electric-quote-context-sensitive-after-space-double)
(electric-quote-context-sensitive-after-letter-single)
(electric-quote-context-sensitive-after-letter-double)
(electric-quote-context-sensitive-after-paren-single)
(electric-quote-context-sensitive-after-paren-double)
(electric-quote-markdown-in-text)
(electric-quote-markdown-in-code): New unit tests.
2017-07-02 17:48:23 +02:00
Tino Calancha
a8b71b3dc5 Extend dired-do-shell-command substitutions
Substitute "`?`" inside command with the current file name.
See details in:
https://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00618.html
* lisp/dired-aux.el (dired-quark-subst-regexp, dired-star-subst-regexp):
Mark as obsolete.
(dired-isolated-string-re): New defun.
(dired--star-or-qmark-p): New predicate.
(dired-do-shell-command): Use dired--star-or-qmark-p.  Substitute "`?`"
with the current file name.
* doc/emacs/dired.texi (Shell Commands in Dired): Update manual.
; * etc/NEWS: Mention it.
2017-07-02 22:09:02 +09:00
Noam Postavsky
e620bbe38e Ignore mouse-movement for describe-key-briefly (Bug#12204)
* lisp/help.el (help-read-key-sequence): Add optional argument ot
ignore `mouse-movement' events.
(describe-key-briefly): Use it.
* doc/emacs/help.texi (Key Help):
* etc/NEWS: Mention that mouse movement is ignored.
2017-07-01 09:40:29 -04:00
Eli Zaretskii
e83b128a81 Add documentation for display-line-numbers
* doc/emacs/custom.texi (Init Rebinding):
* doc/emacs/modes.texi (Minor Modes): Remove references to
linum-mode.
* doc/emacs/display.texi (Display Custom): Describe the
line-number display.
(Optional Mode Line): Fix the index entry to not conflict with
that in "Display Custom".
* doc/emacs/basic.texi (Position Info): Add cross-reference to
"Display Custom", for line-number display.

* src/xdisp.c (syms_of_xdisp): <display-line-numbers>: Mention
display-line-numbers-disable in the doc string.

* lisp/cus-start.el (standard): Fix lst change.
2017-06-30 17:33:06 +03:00
Eli Zaretskii
7a762fbbfc Support displaying zero as the number of the current line
* src/xdisp.c (syms_of_xdisp)
<display-line-numbers-current-absolute>: New variable.
<display-line-numbers>: Doc fix.
(maybe_produce_line_number): Support nil value of
display-line-numbers-current-absolute.

* lisp/cus-start.el (standard): Add customization form for
display-line-numbers-current-absolute.

* etc/NEWS: Document recently introduced features.
2017-06-30 16:37:57 +03:00
Noam Postavsky
c87c87fcc3 Escape NUL bytes in X selections (Bug#6991)
* lisp/term/w32-win.el (w32--set-selection):
* lisp/select.el (xselect--encode-string): Replace NUL bytes with
"\0".
* doc/emacs/killing.texi: Document new behavior.
* etc/NEWS (times): Announce it.
2017-06-29 19:40:23 -04:00
Noam Postavsky
0ae28c71c7 Hide byte code in backtraces (Bug#6991)
* lisp/emacs-lisp/debug.el (debugger-print-function): New defcustom,
defaulting to `cl-print'.
(debugger-insert-backtrace, debugger-setup-buffer): Use it instead of
`prin1'.
* etc/NEWS: Announce it.
2017-06-29 19:40:23 -04:00
Noam Postavsky
e06b547e93 Make tcl-auto-fill-mode obsolete (Bug#10772)
* lisp/progmodes/tcl.el (tcl-auto-fill-mode): Declare obsolete.
* etc/NEWS: Announce it.
2017-06-27 20:34:14 -04:00
Martin Rudalics
1886246f6f Provide additional support for child frames
Provide mouse dragging and resizing of frames.  Allow resizing
frames proportionally.  Provide additional functionality for
child frames.  Minor bug fixes.

* lisp/frame.el (frame-border-width, frame-pixel-width)
(frame-pixel-height): Alias to `frame-internal-border-width',
`frame-native-width' and `frame-native-height'.
(frame-inner-width, frame-inner-height, frame-outer-width)
(frame-outer-height): New functions.
* lisp/minibuffer.el (completion-auto-help): Fix typo.
* lisp/mouse.el (mouse-drag-line, mouse-drag-mode-line)
(mouse-drag-header-line): Allow moving a frame by dragging the
mode line of its bottommost window (on a minibuffer-less frame)
or the header line of its topmost window.
(mouse-drag-vertical-line): Mention argument in doc-string.
(mouse-resize-frame, mouse-drag-frame, mouse-drag-left-edge)
(mouse-drag-top-left-corner, mouse-drag-top-edge)
(mouse-drag-top-right-corner, mouse-drag-right-edge)
(mouse-drag-bottom-right-corner, mouse-drag-bottom-edge)
(mouse-drag-bottom-left-corner): New functions for resizing a
frame by dragging its internal border together with
corresponding key bindings.
* lisp/tooltip.el (tooltip-frame-parameters): Add
'no-special-glyphs' to default parameters and update version
tag.
* lisp/window.el (frame-auto-hide-function): Add choice to make
frame invisible and update version tag.
(window--delete): Handle 'auto-hide-function' frame parameter.
(window--maybe-raise-frame): Respect 'no-focus-on-map' and
'no-accept-focus' frame parameters.
(display-buffer--action-function-custom-type): Add
`display-buffer-in-child-frame'.
(display-buffer): Mention `display-buffer-in-child-frame' in
doc-string.
(display-buffer-in-child-frame): New action function for
`display-buffer'.
(window--sanitize-margin): Return zero when MARGIN cannot be
sanitized.
(fit-frame-to-buffer): Major rewrite to handle child frames and
'fit-frame-to-buffer-sizes' and 'fit-frame-to-buffer-margins'
frame parameters.
(window-largest-empty-rectangle--maximums-1)
(window-largest-empty-rectangle--maximums)
(window-largest-empty-rectangle--disjoint-maximums)
(window-largest-empty-rectangle): New functions.

* src/dispextern.h (WINDOW_WANTS_MODELINE_P)
(WINDOW_WANTS_HEADER_LINE_P): Remove.  Functionality is now
provided by corresponding functions window_wants_modeline and
window_wants_header_line in window.c.  Adjust users.
* src/dispnew.c (adjust_glyph_matrix)
(buffer_posn_from_coords): Use window_wants_modeline and
window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and
WINDOW_WANTS_HEADER_LINE_P.
* src/frame.c (keep_ratio): New function.
(adjust_frame_size): Call keep_ratio for each of F's child
frames.
(make_frame): Initialize no_special_glyphs slot.
(frame_internal_border_part): New function.
(Fframe_pixel_width, Fframe_pixel_height, Fborder_width): Rename
to Fframe_native_width, Fframe_native_height mand
Fframe_internal_border_width.
(frame_parm_table): Add Qno_special_glyphs entry.
(frame_float_type): New enumeration type.
(frame_float): New function to handle frame size and position
ratios.
(x_set_frame_parameters): Handle size and position ratios.
(x_set_no_special_glyphs): New function
(x_figure_window_size): Handle size and position ratios.
(syms_of_frame): Add Qdisplay_monitor_attributes_list,
Qno_special_glyphs, Qframe_edges, Qkeep_ratio, Qwidth_only,
Qheight_only, Qleft_only and Qtop_only.
* src/frame.h (internal_border_part): New enumeration type.
(struct frame): New slot no_special_glyphs.
(FRAME_NO_SPECIAL_GLYPHS): New macro.
* src/gtkutil.c (xg_frame_restack): Return immediately for
GTK versions before 2.18.0.
* src/keyboard.c (internal_border_parts): New array constant.
(make_lispy_position): For frames with border dragging enabled
return internal border part.
(syms_of_keyboard): New symbols Qdrag_internal_border,
Qleft_edge, Qtop_left_corner, Qtop_edge, Qtop_right_corner,
Qright_edge, Qbottom_right_corner, Qbottom_edge and
Qbottom_left_corner.
* src/minibuf.c (read_minibuf_unwind): When exiting the
minibuffer deal with frames that have the 'minibuffer-exit'
parameter set.
(syms_of_minibuf): New symbol Qminibuffer_exit.
* src/nsfns.m (frame_parm_handler): Add entry for
x_set_no_special_glyphs.
(Fx_create_frame): Handle 'no-special-glyphs' parameter.
Intitialize new cursor types for dragging frame borders.
* src/nsterm.h (struct ns_output): Add new cursor types for
dragging frame borders.
* src/w32fns.c (w32_frame_parm_handlers): Add entry for
x_set_no_special_glyphs.
(Fx_create_frame): Handle 'no-special-glyphs' parameter.
Intitialize new cursor types for dragging frame borders.
* src/w32term.h (struct w32_output): Add new cursor types for
dragging frame borders.
* src/window.c (coordinates_in_window)
(Fwindow_line_height, window_internal_height): Use
window_wants_modeline and window_wants_header_line instead of
WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P.
(Fwindow_lines_pixel_dimensions): New function.
(window_parameter): New function.
(Fwindow_parameter): Call window_parameter.
(window_wants_mode_line, window_wants_header_line): New
functions replacing the macros WINDOW_WANTS_MODELINE_P and
WINDOW_WANTS_HEADER_LINE_P from dispextern.h.
(syms_of_window): New symbols Qmode_line_format and
Qheader_line_format.
* src/window.h: Reorganize and re-comment macros.  Use
window_wants_modeline and window_wants_header_line instead of
WINDOW_WANTS_MODELINE_P and WINDOW_WANTS_HEADER_LINE_P.
(MINI_NON_ONLY_WINDOW_P, MINI_ONLY_WINDOW_P): Minor rewrite.
(WINDOW_BUFFER): New macro.
(WINDOW_BOX_LEFT_EDGE_COL, WINDOW_BOX_RIGHT_EDGE_COL): Remove.
* src/xdisp.c (window_text_bottom_y, window_box_height)
(window_box, start_display)
(compute_window_start_on_continuation_line)
(try_cursor_movement, redisplay_window)
(try_window_reusing_current_matrix, try_window_id)
(display_line, expose_window): Use window_wants_modeline and
window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and
WINDOW_WANTS_HEADER_LINE_P.
(pos_visible_p, display_mode_lines): Respect W's
'mode-line-format' and 'header-line-format' window parameters.
(init_iterator): Use window_wants_modeline and
window_wants_header_line instead of WINDOW_WANTS_MODELINE_P and
WINDOW_WANTS_HEADER_LINE_P.  For tip frames respect
no_special_glyphs value.
(note_mouse_highlight): Set frame border cursors when on
internal border.
(x_draw_right_divider, x_draw_bottom_divider): Try to improve
drawing of window dividers.
* src/xfns.c (mouse_cursor): Add entries for border parts.
(mouse_cursor_types): Add entries for cursor types to drag
frame borders.
(INSTALL_CURSOR): Add entries for new cursor types to drag
frame borders.
(Fx_create_frame): Handle 'no-special-glyphs' parameter.
(x_frame_parm_handlers): Add entry for
x_set_no_special_glyphs.
(Vx_window_left_edge_shape, Vx_window_top_left_corner_shape)
(Vx_window_top_edge_shape, Vx_window_top_right_corner_shape)
(Vx_window_right_edge_shape)
(Vx_window_bottom_right_corner_shape)
(Vx_window_bottom_edge_shape)
(Vx_window_bottom_left_corner_shape): New variables.
(x_frame_restack): Call xg_frame_restack only for GTK versions
starting with 2.18.0.
* src/xterm.c (x_free_frame_resources): Remove new cursors for
dragging frame borders.
* src/xterm.h (struct x_output): Add new cursor types for
dragging frame borders.

* doc/lispref/display.texi (Size of Displayed Text): Document
`window-lines-pixel-dimensions'.
* doc/lispref/elisp.texi (Top): Add entry for "Mouse Dragging
Parameters".
* doc/lispref/frames.texi (Frame Size): Replace
frame-pixel-width/-height by frame-native-width/-height.  Add
frame-inner-width/-height and frame-outer-width/-height docs.
(Position Parameters): Describe specifying position as ratios.
Clarify remark about positions relative to bottom/ridge display
edge.
(Size Parameters): Describe specifying sizes as ratios.
Describe 'fit-frame-to-buffer-margins' and
'fit-frame-to-buffer-sizes' parameters.
(Layout Parameters): Describe 'no-special-glyphs' parameter.
(Frame Interaction Parameters): Describe 'auto-hide-function',
'minibuffer-exit' and 'keep-ratio' parameters.
(Mouse Dragging Parameters): New section describing
'drag-internal-border', 'drag-with-header-line',
'drag-with-mode-line', 'snap-width', 'top-visible' and
'bottom-visible' parameters.
(Management Parameters): Mention that `override-redirect' has
no effect on MS Windows.
(Font and Color Parameters): Mention child frames for `alpha'
parameter.
(Child Frames): Rewrite section with description and cross
references to new frame parameters added.
* doc/lispref/modes.texi (Mode Line Basics): Mention
'mode-line-format' and 'header-line-format' window parameters.
* doc/lispref/windows.texi (Resizing Windows): Mention effect
of `fit-frame-to-buffer-margins' for child frames.
(Display Action Functions): New action function
`display-buffer-in-child-frame'.
(Quitting Windows): Mention `make-frame-invisible' as optional
value of `frame-auto-hide-function' and `auto-hide-function'
frame paameter.
(Coordinates and Windows): Describe new function
`window-largest-empty-rectangle'.
(Window Parameters): Describe new parameters 'mode-line-format'
and 'header-line-format'.  Index all window parameters described
in this section.
2017-06-25 11:33:25 +02:00
Eli Zaretskii
16d2695674 Minor change in NEWS. 2017-06-24 21:10:04 +03:00
Eli Zaretskii
ead4ab6359 Improve documentation in NEWS. 2017-06-24 20:11:56 +03:00
Eli Zaretskii
6e18841b17 Allow Lisp program to disable line-number display for specific lines
* etc/NEWS: Update the documentation.

* src/xdisp.c (syms_of_xdisp) <display-line-numbers-disable>: New
symbol.
(should_produce_line_number): New function.
(display_line): Use should_produce_line_number to determine
whether a line number should be produced for each glyph row.
2017-06-24 16:58:01 +03:00
Stefan Monnier
4bd4df4047 * lisp/net/html2text.el: Move to obsolete/. 2017-06-24 08:59:20 -04:00
Eli Zaretskii
efedb66466 Rename display-line-width
* etc/NEWS:
* src/xdisp.c (syms_of_xdisp, maybe_produce_line_number):
* lisp/cus-start.el: Rename display-line-width to
display-line-number-width.
2017-06-24 14:53:35 +03:00
Glenn Morris
65b323e14e Don't put deleted packages in the trash (bug#14967)
* lisp/emacs-lisp/package.el (package-delete):
Don't pay attention to delete-by-moving-to-trash.

; * etc/NEWS: Mention this.
2017-06-19 14:39:25 -04:00
Eli Zaretskii
f8cc7a8300 Improve documentation of replace-buffer-contents
* etc/NEWS (replace-buffer-contents): Fix formatting.

* src/editfns.c (Freplace_buffer_contents): Doc fix.
2017-06-17 19:03:30 +03:00
Eli Zaretskii
7277c0fca7 Finish up native display of line numbers
* src/xdisp.c (maybe_produce_line_number): Produce a blank before
the number, for R2L rows.  Increment 'g' in the loop even if
glyph_row is NULL.  Accept 2nd argument FORCE and produce the
line-number glyphs if it is non-zero.
(move_it_in_display_line_to): Account for the space taken by the
line-number glyphs.  Call maybe_produce_line_number with 2nd
argument non-zero.
(set_cursor_from_row): Fix calculation of cursor X coordinate in
R2L rows with display-produced glyphs at the beginning.
(syms_of_xdisp) <line-number>: New face symbol.
<relative, display-line-width>: New symbols.
(maybe_produce_line_number): Use the line-number face for
displaying line numbers.  Support relative line-number display.
Support user-defined width for displaying line numbers.
(try_cursor_movement, try_window_id): Disable these optimizations
when displaying relative line numbers.
* src/dispextern.h (struct it): New member 'pt_lnum'.

* lisp/faces.el (line-number): New face.
* lisp/cus-start.el (standard): Provide customization forms for
display-line-numbers and display-line-width.
* lisp/menu-bar.el (menu-bar-showhide-menu): Add menu-bar item to
turn display-line-numbers on and off.

* etc/NEWS: Document the new feature.
2017-06-17 17:42:44 +03:00
Tino Calancha
8e44350ee2 ; * etc/NEWS (Editing Changes in Emacs 26.1): Fix typo in last commit. 2017-06-17 22:58:27 +09:00
Philipp Stephani
d682f0daa3 Add command to replace buffer contents
Add a new command 'replace-buffer-contents' that uses the Myers diff
algorithm to non-destructively replace the accessible portion of the
current buffer.  The Myers algorithm is implemented in Gnulib.

* src/editfns.c (Freplace_buffer_contents): New command.
(set_bit, bit_is_set, buffer_chars_equal): New helper functions.
(syms_of_editfns): Define new command.

* test/src/editfns-tests.el (replace-buffer-contents-1)
(replace-buffer-contents-2): New unit tests.

* src/buffer.h (BUF_FETCH_CHAR_AS_MULTIBYTE): New helper macro.

* admin/merge-gnulib (GNULIB_MODULES): Add diffseq.h and minmax.h.
2017-06-17 15:40:58 +02:00
Noam Postavsky
5647c4a2c6 Give a fixed default value for icomplete-prospects-height (Bug#26939)
* lisp/icomplete.el (icomplete-prospects-height): Default to 2.
(icomplete-prospects-length): Remove.
* etc/NEWS: Announce removal.
2017-06-14 07:03:05 -04:00
Philipp Stephani
cf97132764 Implement module assertions for users
Add a new command-line option '-module-assertions' that users can
enable developing or debugging a module.  If this option is present,
Emacs performs additional checks to verify that modules fulfill their
requirements.  These checks are expensive and crash Emacs if modules
are invalid, so disable them by default.

This is a command-line option instead of an ordinary variable because
changing it while Emacs is running would cause data structure
imbalances.

* src/emacs.c (main): New command line option '-module-assertions'.

* src/emacs-module.c (module_assert_main_thread)
(module_assert_runtime, module_assert_env, module_assert_value):
New functions to assert module requirements.
(syms_of_module): New uninterned variable 'module-runtimes'.
(init_module_assertions, in_main_thread, module_abort): New helper
functions.
(initialize_environment): Initialize value list.  If assertions are
enabled, use a heap-allocated environment object.
(finalize_environment): Add assertion that environment list is never
empty.
(finalize_runtime_unwind): Pop module runtime object stack.
(value_to_lisp): Assert that the value is valid.
(lisp_to_value): Record new value if assertions are enabled.
(mark_modules): Mark allocated object list.
(MODULE_FUNCTION_BEGIN_NO_CATCH)
(module_non_local_exit_check, module_non_local_exit_clear)
(module_non_local_exit_get, module_non_local_exit_signal)
(module_non_local_exit_throw): Assert thread and environment.
(module_get_environment): Assert thread and runtime.
(module_make_function, module_funcall, module_intern)
(module_funcall, module_make_integer, module_make_float)
(module_make_string, module_make_user_ptr, module_vec_get)
(funcall_module, Fmodule_load): Adapt callers.
(module_make_global_ref): If assertions are enabled, use the global
environment to store global values.
(module_free_global_ref): Remove value from global value list.

* test/Makefile.in (EMACSOPT): Enable module assertions when testing
modules.

* test/data/emacs-module/mod-test.c (Fmod_test_invalid_store)
(Fmod_test_invalid_load): New functions to test module assertions.
(emacs_module_init): Bind the new functions.

* test/src/emacs-module-tests.el (mod-test-emacs): New constant for
the Emacs binary file.
(mod-test-file): New constant for the test module file name.
(module--test-assertions): New unit test.
2017-06-12 15:22:27 +02:00
Paul Eggert
5324710841 Minor improvements to format field numbers
* src/editfns.c (styled_format): Allow field numbers in a %% spec.
No need for a special diagnostic for field numbers greater than
PTRDIFF_MAX.  Reword diagnostic for field 0.
* test/src/editfns-tests.el (format-with-field): Adjust to match.
2017-06-02 00:25:48 +02:00
Philipp Stephani
0dd1bbb0bb Implement field numbers in format strings
A field number explicitly specifies the argument to be formatted.
This is especially important for potential localization work, since
grammars of various languages dictate different word orders.

* src/editfns.c (Fformat): Update documentation.
(styled_format): Implement field numbers.

* doc/lispref/strings.texi (Formatting Strings): Document field numbers.

* lisp/emacs-lisp/bytecomp.el (byte-compile-format-warn): Adapt.

* test/src/editfns-tests.el (format-with-field): New unit test.
2017-06-02 00:22:13 +02:00
Vasilij Schneidermann
cb9aa3515a Add customizable to display raw bytes as hex
* src/xdisp.c (get_next_display_element): Dispatch used format string
for unprintables based on new display-raw-bytes-as-hex variable.
(display-raw-bytes-as-hex): New variable.  (Bug#27122)

* lisp/cus-start.el: Add defcustom form for display-raw-bytes-as-hex.

* doc/emacs/display.texi: Document the new variable.
* etc/NEWS: Mention display-raw-bytes-as-hex.

* test/manual/redisplay-testsuite.el (test-redisplay-5-toggle)
(test-redisplay-5): New tests.
(test-redisplay): Call test-redisplay-5.
2017-06-01 21:25:58 +03:00
Eli Zaretskii
e5de79992a Revert "Add customizable to display raw bytes as hex"
This reverts commit 7c9ac111c5.
2017-06-01 21:24:15 +03:00
Eli Zaretskii
7c9ac111c5 Add customizable to display raw bytes as hex
* src/xdisp.c (get_next_display_element): Dispatch used format string
for unprintables based on new display-raw-bytes-as-hex variable.
(display-raw-bytes-as-hex): New variable.  (Bug#27122)

* lisp/cus-start.el: Add defcustom form for display-raw-bytes-as-hex.

* doc/emacs/display.texi: Document the new variable.
* etc/NEWS: Mention display-raw-bytes-as-hex.

* test/manual/redisplay-testsuite.el (test-redisplay-5-toggle)
(test-redisplay-5): New tests.
(test-redisplay): Call test-redisplay-5.
2017-06-01 21:12:39 +03:00
Eli Zaretskii
140ddc321b Support lower bound on hscrolling when only current line scrolls
* doc/emacs/display.texi (Horizontal Scrolling): Document the new
mode of auto-hscrolling only the current line.

* src/xdisp.c (init_iterator): When hscrolling only the
current line, apply the	window's min_hscroll here, so that
non-current lines will be hscrolled by that minimum.
Suggested by Stephen Berman <stephen.berman@gmx.net>.
(hscroll_window_tree): Account for window's min_hscroll when
deciding whether to recompute the hscroll.
(display_line): Subtract window's min_hscroll from x_incr, as that
was already accounted for in init_iterator.  (Bug#27008)
2017-05-31 19:01:31 +03:00
Noam Postavsky
75b8492946 Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to '--bg-daemon'
* doc/emacs/cmdargs.texi (Initial Options):
* doc/lispref/os.texi (Startup Summary):
* etc/NEWS:
* etc/emacs.service:
* src/emacs.c (main):
* src/lisp.h: Rename '--new-daemon' to 'fg-daemon' and '--old-daemon' to
'--bg-daemon'.
2017-05-29 22:18:55 -04:00
Tak Kunihiro
c0f2c29877 Support drag and drop of region by mouse (Bug#26725)
* doc/emacs/frames.texi (Drag and Drop): Document support of drag
and drop region by mouse.
* lisp/mouse.el (mouse-drag-region): Call mouse-drag-and-drop-region
when start-event is on region.
(mouse-drag-and-drop-region): New function, moves the region by
(mouse-drag-and-drop-region): New defcustom.
* etc/NEWS: Mention mouse-drag-and-drop-region.
2017-05-27 14:57:11 +03:00
Peder O. Klingenberg
8f6550b38c New dns-mode command for IPv6 address conversion
This converts IPv6 addresses to a format suitable for
reverse lookup zone files.  (Bug#26820)
* lisp/textmodes/dns-mode.el (dns-mode-map, dns-mode-menu):
Add dns-mode-ipv6-to-nibbles.
(dns-mode-ipv6-to-nibbles, dns-mode-reverse-and-expand-ipv6):
New functions.
* test/lisp/dns-mode-tests.el: New file.
; * etc/NEWS: Mention this.
2017-05-23 20:34:08 -04:00
Alan Mackenzie
b0b02ca7f3 Enhance mode-line percentage offset facility, with "%o" and "%q"
"%o" will display the percentage "travel" of the window through the buffer.
"%q" will display a combination of the percentage offsets of the top and
bottom of the window.  The new user option mode-line-percent-position will
facilitate selecting a setting for this part of the mode line.

* lisp/bindings.el (mode-line-percent-position): New customizable user option.
(mode-line-position): Use mode-line-percent-position in place of "%p", etc.

* src/xdisp.c (decode_mode_spec): Add handlers for "%o" and "%q".

* doc/lispref/modes.texi (Mode Line Variables): Document
mode-line-percent-position.
(%-Constructs): Document %o and %q.

* etc/NEWS: Add an entry for these new facilities.
2017-05-21 10:16:09 +00:00
Charles A. Roelli
7e5a8cdceb Fix macOS mouse movement
* lisp/frame.el (ns-set-mouse-absolute-pixel-position): New
function (Lisp).
(set-mouse-absolute-pixel-position): Change it to call
`ns-set-mouse-absolute-pixel-position' on macOS.
* src/nsfns.m (Fns_set_mouse_absolute_pixel_position): New
function.
* src/nsterm.h (NS_PARENT_WINDOW_TOP_POS): Use the primary
screen's height as a base for calculating global coordinates.
* src/nsterm.m (frame_set_mouse_pixel_position): Fix it in macOS.
* test/lisp/mouse-tests.el (bug26816-mouse-frame-movement): Test
movement of mouse relative to frame.
2017-05-21 00:09:41 +01:00
Philipp Stephani
31fded0370 Reimplement module functions
Instead of a lambda, create a new type containing all data required to
call the function, and support it in the evaluator.  Because this type
now also needs to store the function documentation, it is too big for
Lisp_Misc; use a pseudovector instead.  That also has the nice benefit
that we don't have to add special support to the garbage collector.

Since the new type is user-visible, give it a predicate.

Now we can easily support 'help-function-args' and 'func-arity'; add
unit tests for these.

* src/lisp.h (allocate_module_function, MODULE_FUNCTIONP)
(XMODULE_FUNCTION): New pseudovector type 'module function'.

* src/eval.c (FUNCTIONP): Also treat module functions as functions.
(funcall_lambda, Ffuncall, eval_sub): Add support for calling module
functions.
(Ffunc_arity): Add support for detecting the arity of module
functions.

* src/emacs-module.c (module_make_function): Adapt to new structure.
Return module function object directly instead of wrapping it in a
lambda; remove FIXME.
(funcall_module): New function to call module functions.  Replaces
`internal--module-call' and is called directly from eval.c.
(syms_of_module): Remove internal helper function, which is no longer
needed.
(module_function_arity): New helper function.

* src/data.c (Ftype_of): Adapt to new implementation.
(Fmodule_function_p, syms_of_data): New user-visible function.  Now
that module functions are first-class objects, they deserve a
predicate.  Define it even if not compiled with --enable-modules so
that Lisp code doesn't have to check for the function's existence.

* src/doc.c (Fdocumentation): Support module functions.

* src/print.c (print_object): Adapt to new implementation.

* src/alloc.c (mark_object): Specialized garbage collector support is
no longer needed.

* lisp/help.el (help-function-arglist): Support module functions.
While there, simplify the arity calculation by using `func-arity',
which does the right thing for all kinds of functions.

* test/data/emacs-module/mod-test.c: Amend docstring so we can test
the argument list.

* test/src/emacs-module-tests.el (mod-test-sum-docstring): Adapt to
new docstring.
(mod-test-non-local-exit-signal-test): Because `internal--module-call'
is gone, the backtrace has changed and no longer leaks the
implementation.
(module--func-arity): New test for `func-arity'.
(module--help-function-arglist): New test for `help-function-arglist'.
2017-05-20 15:32:52 +02:00
Charles A. Roelli
021430f4b4 New commands: find-library-other-window, find-library-other-frame
* lisp/emacs-lisp/find-func.el (find-library-other-window)
(find-library-other-frame): New commands to complement the
existing 'find-library' command.  (Bug#26712)
(read-library-name): New function to read a library name.
* etc/NEWS: Mention 'find-library-other-window' and
'find-library-other-frame'.
2017-05-20 14:41:53 +03:00
Noam Postavsky
acd58c9198 Limit integers printed as characters (Bug#16828)
* lisp/simple.el (eval-expression-print-maximum-character): New
variable.
(eval-expression-print-format): Only display value as character if
it's less than or equal to `eval-expression-print-maximum-character'.
(eval-expression-get-print-arguments): Check
eval-expression-print-maximum-character, allow negative arg to
override it.
(eval-expression):
* lisp/progmodes/elisp-mode.el (elisp--eval-last-sexp):
(elisp--eval-last-sexp-print-value): Handle new variable.
* doc/emacs/building.texi (Lisp Eval): Document new variable and
behavior.
* etc/NEWS: Announce it.
* test/lisp/progmodes/elisp-mode-tests.el
(eval-last-sexp-print-format-small-int)
(eval-last-sexp-print-format-small-int-echo)
(eval-last-sexp-print-format-large-int)
(eval-last-sexp-print-format-large-int-echo):
* test/lisp/simple-tests.el (eval-expression-print-format-small-int)
(eval-expression-print-format-small-int-echo)
(eval-expression-print-format-large-int)
(eval-expression-print-format-large-int-echo): New tests.
2017-05-19 18:16:38 -04:00
Eli Zaretskii
7430617d3d Support remote editing in emacsclient via Tramp
* lib-src/emacsclient.c (main, decode_options)
(print_help_and_exit, longopts): New option '--tramp' / '-T' which
specifies how emacs should use tramp to find remote files.

* doc/emacs/misc.texi (TCP Emacs server): New subsection describing
the various knobs to tune server.el for TCP opereation.
(emacsclient Options): Reference "TCP Emacs server" from description of
--server-file.  Document the new '--tramp' / '-T' options.
* doc/emacs/emacs.texi (Top): Update the top-level menu.

* etc/NEWS: Mention the new option.
2017-05-19 11:51:16 +03:00