Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4239544
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:02:56+00:00 2026-05-21T03:02:56+00:00

Using Emacs 23.2.1 on Ubuntu Lucid, any mode based on Comint inserts occasional line

  • 0

Using Emacs 23.2.1 on Ubuntu Lucid, any mode based on Comint inserts occasional line breaks for larger outputs (see example Shell and SQL mode output, below). I’ve tried this in both SQL Mode and Shell Mode, with the same result in either case. Running similar commands in a plain terminal emulator does not cause these problems (for both shell mode and mysql mode commands).

Things I have tried:

  • Using MySQL in SQL Mode, adding the following flags: -A, -C, -t, -f, -n, and setting max_allowed_packet to 16MB.

  • Setting comint-buffer-maximum-size to 10240.

None of these have any effect on this behavior.

If I scroll up to the lines in question and delete the line breaks, the output then appears correctly, so a possible solution to this problem could involve a hook that deletes every 4096th character, if such a thing is possible.

Note: In the terminal examples, the output appears to be cut off at points other than every 4096 characters. In SQL-mode, it is exactly every 4096 (a suspicious number indeed).

Here is some sample output:

brent@battlecruiser:/$ for i in {1..4096}; do echo -n 0; done; echo;

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

In this case, it should print out a single line of 0s, but in fact has inserted a new line character after 904 characters.

Also an Example in SQL Mode using MySQL:

mysql> show variables like '%n%';

+-----------------------------------------+----------------------------------+
| Variable_name                           | Value                            |
+-----------------------------------------+----------------------------------+
| auto_increment_increment                | 1                                |
| auto_increment_offset                   | 1                                |
| binlog_cache_size                       | 32768                            |
| binlog_format                           | STATEMENT                        |
| bulk_insert_buffer_size                 | 8388608                          |
| character_set_client                    | utf8                             |
| character_set_connection                | utf8                             |
| collation_connection                    | utf8_general_ci                  |
| collation_database                      | latin1_swedish_ci                |
| collation_server                        | latin1_swedish_ci                |
| completion_type                         | 0                                |
| concurrent_insert                       | 1                                |
| connect_timeout                         | 10                               |
| delayed_insert_limit                    | 100                              |
| delayed_insert_timeout                  | 300                              |
| div_precision_increment                 | 4                                |
| engine_condition_pushdown               | ON                               |
| error_count                             | 0                                |
| event_scheduler                         | OFF                              |
| foreign_key_checks                      | ON                               |
| ft_boolean_syntax                       | + -><()~*:""&|                   |
| ft_max_word_len                         | 84                               |
| ft_min_word_len                         | 4                                |
| ft_query_expansion_limit                | 20                               |
| general_log                             | OFF                              |
| general_log_file                        | /var/lib/mysql/battlecruiser.log |
| group_concat_max_len                    | 1024                             |
| have_community_features                 | YES                              |
| have_dynamic_loading                    | YES                              |
| have_innodb                             | YES                              |
| have_ndbcluster                         | NO                               |
| have_openssl                            | DISABLED                         |
| have_partitioning                       | YES                              |
| have_symlink                            | YES                              |
| hostname                                | battlecruiser                    |
| identity                                | 0                                |
| ignore_builtin_innodb                   | OFF                              |
| init_connect                            |                                  |
| init_file                               |                                  |
| init_slave                              |                                  |
| innodb_adaptive_hash_index              | ON                               |
| innodb_additional_mem_pool_size         | 1048576                          |
| innodb_autoextend_increment             | 8                                |
| innodb_autoinc_lock_mode                | 1                                |
| innodb_buffer_pool_size                 | 8388608                          |
| innodb_checksums                        | ON                               |
| innodb_commit_concurrency               | 0                                |
| innodb_concurrency_tickets              | 500                              |
| innodb_data_file_path                   | ibdata1:10M:autoextend
           |
| innodb_data_home_dir                    |                                  |
| innodb_doublewrite                      | ON                               |
| innodb_fast_shutdown                    | 1                                |
| innodb_file_io_threads                  | 4                                |
| innodb_file_per_table                   | OFF                              |
| innodb_flush_log_at_trx_commit          | 1                                |
| innodb_flush_method                     |                                  |
| innodb_force_recovery                   | 0                                |
| innodb_lock_wait_timeout                | 50                               |
| innodb_locks_unsafe_for_binlog          | OFF                              |
| innodb_log_buffer_size                  | 1048576                          |
| innodb_log_file_size                    | 5242880                          |
| innodb_log_files_in_group               | 2                                |
| innodb_log_group_home_dir               | ./                               |
| innodb_max_dirty_pages_pct              | 90                               |
| innodb_max_purge_lag                    | 0                                |
| innodb_mirrored_log_groups              | 1                                |
| innodb_open_files                       | 300                              |
| innodb_rollback_on_timeout              | OFF                              |
| innodb_stats_on_metadata                | ON                               |
| innodb_support_xa                       | ON                               |
| innodb_sync_spin_loops                  | 20                               |
| innodb_table_locks                      | ON                               |
| innodb_thread_concurrency               | 8                                |
| innodb_thread_sleep_delay               | 10000                            |
| innodb_use_legacy_cardinality_algorithm | ON                               |
| insert_id                               | 0                                |
| interactive_timeout                     | 28800                            |
| join_buffer_size                        | 131072                           |
| keep_files_on_create                    | OFF                              |
| key_cache_division_limit                | 100                              |
| language                                | /usr/share/mysql/english/        |
| last_insert_id                          | 0                                |
| lc_time_names                           | en_US                            |
| license                                 | GPL                              |
| local_infile                            | ON                               |
| locked_in_memory                        | OFF                              |
| log_bin                                 | OFF                              |
| log_bin_trust_function_creators         | OFF                              |
| log_bin_trust_routine_creators          | OFF                              |
| log_queries_not_using_indexes           | OFF                              |
| log_warnings                            | 1                                |
| long_query_time                         | 10.000000                        |
| lower_case_table_names                  | 0                                |
| max_binlog_cache_size                   | 4294963200                       |
| max_binlog_size                         | 104857600                        |
| max_connect_errors                      | 10                               |
| max_connections                         | 151                              |
| max_error_count                         | 64                               |
| max_insert_delayed_threads              | 20                               |
| max_join_size                           | 18446744073709551615             |
| max_length_for_sort_data                | 1024     
                        |
| max_prepared_stmt_count                 | 16382                            |
| max_sort_length                         | 1024                             |
| max_sp_recursion_depth                  | 0                                |
| max_user_connections                    | 0                                |
| max_write_lock_count                    | 4294967295                       |
| min_examined_row_limit                  | 0                                |
| multi_range_count                       | 256                              |
| myisam_data_pointer_size                | 6                                |
| myisam_recover_options                  | BACKUP                           |
| net_buffer_length                       | 16384                            |
| net_read_timeout                        | 30                               |
| net_retry_count                         | 10                               |
| net_write_timeout                       | 60                               |
| new                                     | OFF                              |
| open_files_limit                        | 1024                             |
| optimizer_prune_level                   | 1                                |
| plugin_dir                              | /usr/lib/mysql/plugin            |
| profiling                               | OFF                              |
| profiling_history_size                  | 15                               |
| protocol_version                        | 10                               |
| query_cache_min_res_unit                | 4096                             |
| query_cache_wlock_invalidate            | OFF                              |
| rand_seed1                              |                                  |
| rand_seed2                              |                                  |
| range_alloc_block_size                  | 4096                             |
| read_only                               | OFF                              |
| read_rnd_buffer_size                    | 262144                           |
| relay_log_index                         |                                  |
| relay_log_info_file                     | relay-log.info                   |
| rpl_recovery_rank                       | 0                                |
| skip_external_locking                   | ON                               |
| skip_networking                         | OFF                              |
| slave_net_timeout                       | 3600                             |
| slave_transaction_retries               | 10                               |
| slow_launch_time                        | 2                                |
| sql_auto_is_null                        | ON                               |
| sql_log_bin                             | ON                               |
| sql_max_join_size                       | 18446744073709551615             |
| sql_notes                               | ON                               |
| sql_slave_skip_counter                  |                                  |
| sql_warnings                            | OFF                              |
| storage_engine                          | MyISAM                           |
| sync_binlog                             | 0                                |
| sync_frm                                | ON                               |
| system_time_zone                        | EDT                              |
| table_definition_cache                  | 256                              |
| table_open_cache                        | 64                               |
| thread_handling                         | one-thread-per-connection        |
| time_zone                               | SYSTEM                           |
| transaction_alloc_block_size            | 8192                             |
| transaction_prealloc_size               | 4096                             |
| tx_isolation                          
  | REPEATABLE-READ                  |
| unique_checks                           | ON                               |
| version                                 | 5.1.41-3ubuntu12.10              |
| version_comment                         | (Ubuntu)                         |
| version_compile_machine                 | i486                             |
| version_compile_os                      | debian-linux-gnu                 |
| warning_count                           | 0                                |
+-----------------------------------------+----------------------------------+
159 rows in set (0.00 sec)

Here the output is always interrupted by a newline at exact intervals of 4096 characters.

In addition to possible solutions, any new ways to find more information about what is happening would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:02:57+00:00Added an answer on May 21, 2026 at 3:02 am

    I have found the solution to this problem. I had put in my configuration file the following code sourced from http://www.emacswiki.org/emacs/SqlMode

      (defun sql-add-newline-first (output)
        "Add newline to beginning of OUTPUT for `comint-preoutput-filter-functions'"
        (concat "\n" output))
    
      (defun sqli-add-hooks ()
        "Add hooks to `sql-interactive-mode-hook'."
        (add-hook 'comint-preoutput-filter-functions
                  'sql-add-newline-first))
    
      (add-hook 'sql-interactive-mode-hook 'sqli-add-hooks)
    

    After removing the code (which because it sets the comint-preoutput-filter-functions, affects shell-mode as well), I no longer experience these issues.

    My proposed replacement for this code to get the behavior I want (works for me so far):

    (defun sql-add-newline-first (output)
      "Add newline to beginning of OUTPUT for `comint-preoutput-filter-functions'"
      (remove-hook 'comint-preoutput-filter-functions
               'sql-add-newline-first)
      (concat "\n" output))
    
    (defun sql-send-region-better (start end)
      "Send a region to the SQL process."
      (interactive "r")
      (if (buffer-live-p sql-buffer)
          (save-excursion
        (add-hook 'comint-preoutput-filter-functions
              'sql-add-newline-first)
        (comint-send-region sql-buffer start end)
        (if (string-match "\n$" (buffer-substring start end))
            ()
          (comint-send-string sql-buffer "\n"))
        (message "Sent string to buffer %s." (buffer-name sql-buffer))
        (if sql-pop-to-buffer-after-send-region
            (pop-to-buffer sql-buffer)
          (display-buffer sql-buffer)))
        (message "No SQL process started.")))
    
    (defvar sql-mode-map
      (let ((map (make-sparse-keymap)))
        (define-key map (kbd "C-c C-c") 'sql-send-paragraph)
        (define-key map (kbd "C-c C-r") 'sql-send-region-better)
        (define-key map (kbd "C-c C-s") 'sql-send-string)
        (define-key map (kbd "C-c C-b") 'sql-send-buffer)
        map)
      "Mode map used for `sql-mode'.")
    

    Essentially, I am adding the hook right before my sql-send-region-better code starts sending output, then inside the hook I am removing the hook again, guaranteeing that it only inserts the one new line that I want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am now using Emacs 23 with visual-line-mode turned of for text editing but
I am using emacs in Ubuntu. How can I remap META to the ALT
I'm using emacs tramp mode to remotely edit files over ssh. The problem is
I'm using Emacs with clojure mode and slime connected to a swank server produced
Since I've upgraded to Ubuntu lucid and emacs23, Emacs pops up the debugger in
I am using emacs 23.2 on Ubuntu 10.04 & Windows XP along with cedet
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
So I wrote the following code in linux(Ubuntu) using the emacs text editor it
I'm using emacs-calc through org-mode spreadsheet and I would like to count the number
I am using emacs 22.2.1 on Ubuntu 9.04. Every time I open a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.